Skip to content

Commit

Permalink
Merge branch 'main' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
tmke8 committed Aug 18, 2022
2 parents 55a3442 + 2181e47 commit 0d63a08
Show file tree
Hide file tree
Showing 148 changed files with 1,542 additions and 1,654 deletions.
1 change: 1 addition & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ updates:
# Check the pypi registry for updates every week
schedule:
interval: "weekly"
versioning-strategy: lockfile-only
64 changes: 47 additions & 17 deletions .github/workflows/continuous_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ on:
- make_release.sh
- CITATION.cff

env:
PYTHON_VERSION: "3.8"


jobs:

lint_with_pylint:
Expand All @@ -28,10 +32,10 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
python-version: ${{ env.PYTHON_VERSION }}
- name: Install pylint
run: |
python -m pip install --upgrade pip
Expand All @@ -47,10 +51,10 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
python-version: ${{ env.PYTHON_VERSION }}
- name: Install black
run: |
python -m pip install --upgrade pip
Expand Down Expand Up @@ -88,8 +92,25 @@ jobs:
run: |
sphinx-build -W -b html ./docs ./docs/_build
check_with_darglint:

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install darglint
run: |
python -m pip install --upgrade pip
pip install darglint
- name: Check with darglint
run: |
sh run_darglint.sh
test_with_pytest:
needs: [lint_with_pylint, format_with_black_and_isort, check_docstrings]
needs: [lint_with_pylint, format_with_black_and_isort, check_docstrings, check_with_darglint]
runs-on: ubuntu-latest

steps:
Expand All @@ -98,10 +119,10 @@ jobs:
#----------------------------------------------
- name: Check out repository
uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: ${{ env.PYTHON_VERSION }}

#----------------------------------------------
# ----- install & configure poetry -----
Expand All @@ -112,23 +133,32 @@ jobs:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Set ENV VARS
run: |
echo "POETRY_VERSION=$(poetry -V | cut -d' ' -f3)" >> $GITHUB_ENV
#----------------------------------------------
# cache the directory where poetry caches packages
#----------------------------------------------
- name: Cache Poetry cache
uses: actions/cache@v3
with:
path: ~/.cache/pypoetry
key: poetry-cache-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ env.POETRY_VERSION }}

#----------------------------------------------
# load cached venv if cache exists
# cache the directory where pip caches packages
#----------------------------------------------
- name: Set up Poetry cache for Python dependencies
id: cached-poetry-dependencies
# uses: actions/cache@v2
uses: pat-s/always-upload-cache@v2
- name: Cache Pip cache
uses: actions/cache@v3
with:
path: .venv
key: venvEM2-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
path: ~/.cache/pip
key: pip-cache-${{ runner.os }}-${{ env.PYTHON_VERSION }}

#----------------------------------------------
# install dependencies if cache does not exist
# --------- install dependencies --------
#----------------------------------------------
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: |
poetry install -E ci --no-interaction --no-root
poetry run pip install torch --extra-index-url https://download.pytorch.org/whl/cpu
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/dummy_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@ jobs:
run: |
sphinx-build -W -b html ./docs ./docs/_build
check_with_darglint:

runs-on: ubuntu-latest

steps:
- name: Check with darglint
run: |
echo "pass!"
test_with_pytest:

runs-on: ubuntu-latest
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,5 @@ results/*
!/ethicml/data/csvs/celeba.csv.zip
!/ethicml/data/csvs/genfaces.csv.zip
!/ethicml/data/csvs/health.csv.zip

/darglint.out
2 changes: 1 addition & 1 deletion check_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import subprocess

import black
import pytest
from mypy import api as mypy
from pylint import lint as pylint
import pytest

# pytest
print("############### pytest #################")
Expand Down
5 changes: 5 additions & 0 deletions docs/ethicml/evaluate.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Model evaluation
================

.. automodule:: ethicml.evaluators.evaluate
:autosummary:
7 changes: 0 additions & 7 deletions docs/ethicml/evaluate_models.rst

This file was deleted.

2 changes: 2 additions & 0 deletions docs/ethicml/utility.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ Utils
:members:
:imported-members:
:autosummary:

.. autoclass:: Results
2 changes: 1 addition & 1 deletion ethicml/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"""
from .common import *
from .evaluators.cross_validator import *
from .evaluators.evaluate_models import *
from .evaluators.evaluate import *
from .evaluators.parallelism import *
from .preprocessing.adjust_labels import *
from .preprocessing.biased_split import *
Expand Down
2 changes: 1 addition & 1 deletion ethicml/common.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Common variables / constants that make things run smoother."""
import os
from importlib import util
import os
from pathlib import Path

__all__ = ["TORCH_AVAILABLE", "ROOT_DIR", "ROOT_PATH"]
Expand Down
2 changes: 1 addition & 1 deletion ethicml/data/csvs/make_lipton.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def main() -> None:
hair_length_1: np.ndarray = 35 * rng.beta(2, 2, SAMPLES)
hair_length = np.where(z == 1, hair_length_1, hair_length_0)

pois = rng.poisson((25 + 6 * z))
pois = rng.poisson(25 + 6 * z)
norm = rng.normal(20, 0.2, SAMPLES)
work_experience: np.ndarray = pois - norm

Expand Down
2 changes: 1 addition & 1 deletion ethicml/data/csvs/make_nursery.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
]
x1 = df.drop(features1, axis=1)

x2 = df.drop(features, axis=1) # type: ignore[arg-type]
x2 = df.drop(features, axis=1)
x2 = pd.get_dummies(x2)

df = pd.concat([x1, x2], axis=1)
Expand Down
2 changes: 1 addition & 1 deletion ethicml/data/csvs/make_toy_dataset.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Script to generate the toy dataset."""
import random
from pathlib import Path
import random

import numpy as np
import pandas as pd
Expand Down
1 change: 1 addition & 0 deletions ethicml/data/csvs/utility.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Functions used in either generating data, or pre-processing raw data."""
from __future__ import annotations

import numpy as np

Expand Down
Loading

0 comments on commit 0d63a08

Please sign in to comment.