Skip to content

Commit

Permalink
deprecate support for python 2.7
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel Hoffman committed May 7, 2019
1 parent 0cf736f commit 94c054e
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 50 deletions.
19 changes: 4 additions & 15 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
language: python

python: "3.6"

env:
global:
- UCI_HTTPS_URL="https://archive.ics.uci.edu/ml/machine-learning-databases"
Expand All @@ -20,22 +22,9 @@ install:
- if ! wget ${UCI_HTTPS_URL}/statlog/german/german.doc -P aif360/data/raw/german/ ; then wget ${UCI_FTP_URL}/statlog/german/german.doc -P aif360/data/raw/german/; fi
- wget https://raw.githubusercontent.com/propublica/compas-analysis/master/compas-scores-two-years.csv -P aif360/data/raw/compas/

matrix:
# Python 2.7 has a special requirement for BlackBoxAuditing
include:
- python: "2.7"
before_script:
- git clone https://github.com/algofairness/BlackBoxAuditing.git /tmp/BlackBoxAuditing/
- echo -n /tmp/BlackBoxAuditing/BlackBoxAuditing/weka.jar > /tmp/BlackBoxAuditing/python2_source/BlackBoxAuditing/model_factories/weka.path
- echo include python2_source/BlackBoxAuditing/model_factories/weka.path >> /tmp/BlackBoxAuditing/MANIFEST.in
- pip install --no-deps /tmp/BlackBoxAuditing/
- pip list
- python: "3.6"
before_script:
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
- flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics

script:
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
- flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
# stop the build if there are Python syntax errors or undefined names
- flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics
- travis_wait pytest tests
55 changes: 21 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,13 @@ Supported Configurations:

| OS | Python version |
| ------- | -------------- |
| macOS | 2.7, 3.5, 3.6 |
| Ubuntu | 2.7, 3.5, 3.6 |
| macOS | 3.5, 3.6 |
| Ubuntu | 3.5, 3.6 |
| Windows | 3.5 |

NOTE: Python 2.7 support has been **deprecated** in this version. This message
will be removed in the next release.

Installation is easiest on a Unix-like system running Python 3. See the
[Troubleshooting](#troubleshooting) section if you have issues with other
configurations.
Expand Down Expand Up @@ -105,9 +108,6 @@ To install the latest stable version from PyPI, run:
pip install aif360
```

This package supports Python 2.7, 3.5, and 3.6. However, for Python 2, the
`BlackBoxAuditing` package must be [installed manually](#blackboxauditing).

Some algorithms require additional dependencies not included in the minimal
installation. To use these, we recommend a full installation.

Expand All @@ -126,26 +126,33 @@ their respective folders as described in
Then, navigate to the root directory of the project and run:

```bash
pip install .
pip install -e .
```

#### Run the Examples

To run the example notebooks, install the additional requirements as follows:
To run the example notebooks, complete the full installation steps above. Then,
install the additional requirements as follows:

```bash
pip install -r requirements.txt
```

Then, follow the [Getting Started](https://pytorch.org) instructions from
PyTorch to download and install the latest version for your machine.
PyTorch to download and install the latest version for your machine. With conda,
this is simple:

```bash
# LINUX/WINDOWS
conda install pytorch-cpu torchvision-cpu -c pytorch
# MACOS
conda install pytorch torchvision -c pytorch
```

For CUDA support or alternative installation, see the instructions.

Finally, if you did not already, download the datasets as described in
[aif360/data/README.md](aif360/data/README.md) but place them **in the
appropriate sub-folder** in
`$ANACONDA_PATH/envs/aif360/lib/python3.5/site-packages/aif360/data/raw` where
`$ANACONDA_PATH` is the base path to your conda installation (e.g.
`~/anaconda`).
[aif360/data/README.md](aif360/data/README.md).

### Troubleshooting

Expand Down Expand Up @@ -176,7 +183,7 @@ TensorFlow is only required for use with the
#### CVXPY

On Windows, you may need to download the appropriate [Visual Studio C++
compiler for Python](https://wiki.python.org/moin/WindowsCompilers). Then,
compiler for Python](https://wiki.python.org/moin/WindowsCompilers#Microsoft_Visual_C.2B-.2B-_14.0_standalone:_Build_Tools_for_Visual_Studio_2017_.28x86.2C_x64.2C_ARM.2C_ARM64.29). Then,
re-run:

```bat
Expand All @@ -190,26 +197,6 @@ for an alternate installation procedure using conda.
CVXPY is only required for use with the
`aif360.algorithms.preprocessing.OptimPreproc` class.

#### BlackBoxAuditing

Some additional installation is required to use
`aif360.algorithms.preprocessing.DisparateImpactRemover` with Python 2.7. In a
directory of your choosing, run:

```bash
git clone https://github.com/algofairness/BlackBoxAuditing
```

In the root directory of `BlackBoxAuditing`, run:

```bash
echo -n $PWD/BlackBoxAuditing/weka.jar > python2_source/BlackBoxAuditing/model_factories/weka.path
echo "include python2_source/BlackBoxAuditing/model_factories/weka.path" >> MANIFEST.in
pip install --no-deps .
```

This will produce a minimal installation which satisfies our requirements.

## Using AIF360

The `examples` directory contains a diverse collection of jupyter notebooks
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
long_description_content_type='text/markdown',
license='Apache License 2.0',
packages=[pkg for pkg in find_packages() if pkg.startswith('aif360')],
# python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <3.7',
# python_requires='>=3.5, <3.7',
install_requires=[
'numpy>=1.14,<1.16',
'scipy',
Expand Down

0 comments on commit 94c054e

Please sign in to comment.