-
Notifications
You must be signed in to change notification settings - Fork 905
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modernize packaging and test automation
- Use GitHub Actions (replacing the obsolete Travis CI) - Use Tox to run tests, linting and packaging jobs - Use modern `pyproject.toml` for packaging (replacing `setup.{py,cfg}`) - Use `six` instead of `future` where possible (avoid side-effects with Python 3) - Install `future` for Python 2 only (avoid affecting Python 3 installations) - Exclude source code of tests from source distribution package
- Loading branch information
Showing
16 changed files
with
401 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Checks | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
push: | ||
branches: | ||
- master | ||
|
||
env: | ||
PIP_DISABLE_PIP_VERSION_CHECK: '1' | ||
PY_COLORS: '1' | ||
|
||
jobs: | ||
check: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
env: | ||
#- ruff | ||
#- black | ||
- package | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
- name: Install build tools | ||
run: | | ||
python -m pip install tox wheel | ||
- name: Run ${{ matrix.env }} | ||
run: tox -e ${{ matrix.env }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Publish | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
env: | ||
PIP_DISABLE_PIP_VERSION_CHECK: '1' | ||
PY_COLORS: '1' | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
- name: Install build tools | ||
run: | | ||
python -m pip install build twine wheel | ||
- name: Build package | ||
run: python -m build | ||
- name: Upload to PyPI | ||
env: | ||
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | ||
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | ||
run: twine upload dist/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: Tests | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
push: | ||
branches: | ||
- master | ||
|
||
env: | ||
PIP_DISABLE_PIP_VERSION_CHECK: '1' | ||
PY_COLORS: '1' | ||
|
||
jobs: | ||
test: | ||
runs-on: ${{ matrix.platform }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
platform: | ||
- ubuntu-20.04 | ||
- macos-latest | ||
- windows-latest | ||
python-version: | ||
- '2.7' | ||
- '3.5' | ||
- '3.6' | ||
- '3.7' | ||
- '3.8' | ||
- '3.9' | ||
- '3.10' | ||
- '3.11' | ||
- pypy-2.7 | ||
- pypy-3.8 | ||
- pypy-3.9 | ||
dependencies: | ||
- none | ||
- scipy | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install build tools | ||
run: python -m pip install tox-gh-actions wheel | ||
- name: Install optional dependencies | ||
run: python -m pip install ${{ matrix.dependencies }} | ||
if: ${{ matrix.dependencies != 'none' }} | ||
- name: Run tests | ||
run: tox | ||
- name: Upload coverage report | ||
uses: codacy/codacy-coverage-reporter-action@v1 | ||
with: | ||
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} | ||
coverage-reports: coverage.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,69 @@ | ||
*.pyc | ||
scratch/ | ||
examples/data | ||
.idea/ | ||
.DS_Store | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
data/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
coverage.* | ||
*.cover | ||
.hypothesis/ | ||
nosetests.xml | ||
.pytest_cache/ | ||
junit-report.xml | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# mypy | ||
.mypy_cache/ | ||
|
||
# OS and IDE config files | ||
.DS_Store | ||
.idea/ | ||
|
||
# project-specific | ||
data/ | ||
*.so | ||
*.c | ||
scratch/ | ||
examples/data | ||
|
||
.asv/ | ||
autograd.egg-info/ | ||
asv.conf.json | ||
benchmarks/asv.conf.js |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Contributing | ||
|
||
Use Tox to run tests and linting, e.g. | ||
|
||
```shell | ||
pip install tox | ||
``` | ||
|
||
## Run tests, linting, packaging checks | ||
|
||
```shell | ||
tox list # list all Tox environments | ||
tox run -e black,ruff # run code style checks | ||
tox run -e py # run tests with your default Python | ||
tox run -e package # verify packaging | ||
tox # run all Tox environments | ||
``` | ||
|
||
Make sure all tests pass before you push your changes to GitHub. | ||
GH Actions will run the tests across all supported Python versions. | ||
|
||
## Using arguments (reformat, upload package, help) | ||
|
||
You can use additional arguments for the tools called by Tox by | ||
separating them from the Tox arguments by a double-dash `--`, e.g. | ||
|
||
```shell | ||
tox run -e black -- autograd/core.py --check --diff | ||
tox run -e black -- autograd/core.py | ||
``` | ||
|
||
```shell | ||
tox run -e ruff -- autograd/core.py --show-source | ||
tox run -e ruff -- autograd/core.py --fix | ||
``` | ||
|
||
```shell | ||
tox run -e package -- upload | ||
``` | ||
|
||
```shell | ||
tox run -e py -- --help | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
recursive-include autograd *.c *.h *.pyx | ||
prune tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.