Skip to content

Commit

Permalink
Merge pull request #441 from rsokl/ryan/upgrade
Browse files Browse the repository at this point in the history
update python deps and ci and support numpy 2.0
  • Loading branch information
rsokl authored Sep 8, 2024
2 parents 0faa105 + d3b71f9 commit e3d78b4
Show file tree
Hide file tree
Showing 63 changed files with 443 additions and 2,907 deletions.
3 changes: 3 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[flake8]
extend-ignore = F811,D1,D205,D209,D213,D400,D401,D999,D202,E203,E501,W503,E721,F403,F405,E701
exclude = .git,__pycache__,docs,old,build,dis,tests/annotations/*, tests/test_py310.py,docs/*, src/mygrad/__init__.py, src/mygrad/numpy_compat/__init__.py,src/mygrad/nnet/__init__.py
36 changes: 8 additions & 28 deletions .github/workflows/tox_run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
strategy:
max-parallel: 3
matrix:
python-version: [3.7, 3.8, 3.9]
python-version: [3.9, "3.10", 3.11]
fail-fast: false

steps:
Expand All @@ -40,7 +40,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7"]
python-version: ["3.10"]
fail-fast: false

steps:
Expand All @@ -57,31 +57,11 @@ jobs:
run: tox -e coverage


py310:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10"]
fail-fast: false

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Test with tox
run: tox -e py310

py311:
py312:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11"]
python-version: ["3.12"]
fail-fast: false

steps:
Expand All @@ -95,13 +75,13 @@ jobs:
python -m pip install --upgrade pip
pip install tox
- name: Test with tox
run: tox -e py311
run: tox -e py312

minimum_numpy:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7"]
python-version: ["3.9"]
fail-fast: false

steps:
Expand All @@ -121,10 +101,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.9
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.9
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
repos:
- repo: https://github.com/psf/black
rev: 22.10.0
rev: 24.8.0
hooks:
- id: black
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
rev: 7.0.0
hooks:
- id: flake8
- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.10.1
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
5 changes: 3 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
include versioneer.py
include mygrad/_version.py
recursive-exclude tests *
recursive-exclude project_tooling *
global-exclude *.py[cod]
11 changes: 11 additions & 0 deletions docs/source/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@ This is a record of all past mygrad releases and what went into them,
in reverse chronological order. All previous releases should still be available
on pip.

.. _v2.3.0:

------------------
2.3.0 - 2024-09-07
------------------

- Adds support for NumPy 2.0
- Minimum supported NumPy version is now 1.24
- Minimum supported Python version is now 3.9
- Adds testing for Python 3.12

.. _v2.2.0:

------------------
Expand Down
183 changes: 183 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
[build-system]
requires = [
"setuptools >= 35.0.2",
"wheel >= 0.29.0",
"setuptools_scm[toml]==7.0.5",
]
build-backend = "setuptools.build_meta"

[project]
name = "mygrad"
dynamic = ["version"]
description = "Drop-in automatic differentiation to NumPy"
readme = "README.md"
requires-python = ">=3.9"
dependencies = ["numpy >= 1.24, !=1.25.0", "typing-extensions >= 4.1.0, !=4.6.0"]
license = { text = "MIT" }

authors = [
{ name = "Ryan Soklaski", email = "[email protected]" },
]
maintainers = [{ name = "Ryan Soklaski", email = "[email protected]" }]

classifiers = [
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Intended Audience :: Science/Research",
"Intended Audience :: Education",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Scientific/Engineering",
]


[project.optional-dependencies]
test = ["pytest >= 3.8", "hypothesis >= 6.17.1", "scipy"]
rnn = ["numba>=0.34.0"]



[project.urls]
"Homepage" = "https://mygrad.readthedocs.io/en/latest/"
"Bug Reports" = "https://github.com/rsokl/MyGrad/issues"
"Source" = "https://github.com/rsokl/MyGrad"


[tool.setuptools_scm]
write_to = "src/mygrad/_version.py"
version_scheme = "no-guess-dev"


[tool.setuptools]
package-dir = { "" = "src" }

[tool.setuptools.packages.find]
where = ["src"]
exclude = ["tests*", "tests.*"]

[tool.setuptools.package-data]
mygrad = ["py.typed"]


[tool.isort]
known_third_party = ["graphviz", "hypothesis", "numpy", "numba", "pytest", "scipy"]
known_first_party = ["mygrad", "tests"]
profile = "black"
src_paths=["src/mygrad","tests"]

[tool.coverage.run]
omit = ["src/mygrad/_version.py", "src/mygrad/computational_graph.py"]

[tool.coverage.report]
omit = ["src/mygrad/_version.py"]

[tool.codespell]
skip = ["*.po","*.ts","**/_version.py","docs/source/generated/*"]
ignore-words-list = ["ND","nd","nin","dout"]

[tool.tox]
legacy_tox_ini = """
[tox]
envlist = py39,py310,py311,py312,format,min_numpy
[gh-actions]
python =
3.9: py39
3.10: py310
3.11: py311
3.12: py312
[testenv]
deps =
pytest
hypothesis
scipy
pytest-xdist
commands = pytest -n auto --hypothesis-profile ci \
{posargs}
extras = rnn
[testenv:min_numpy]
deps = numpy==1.24
{[testenv]deps}
basepython = python3.9
commands = pytest -n auto --hypothesis-profile ci \
{posargs}
extras =
[testenv:py310]
deps = {[testenv]deps}
commands = pytest -n auto --hypothesis-profile ci \
{posargs}
extras =
[testenv:py311]
deps = {[testenv]deps}
commands = pytest -n auto --hypothesis-profile ci \
{posargs}
extras =
[testenv:py312] # exclude numba dependency for now
deps = pytest
pytest-xdist
hypothesis
scipy
commands = pytest -n auto --hypothesis-profile ci \
{posargs}
extras =
[testenv:coverage]
setenv = NUMBA_DISABLE_JIT=1
MYGRAD_COVERAGE_MODE=1
usedevelop = true
basepython = python3.10
deps = {[testenv]deps}
coverage
pytest-cov
commands = pytest -n auto --cov-report term-missing --cov-config=pyproject.toml --cov-fail-under=100 --cov=mygrad tests
[testenv:format]
deps =
autoflake
black
isort
commands =
autoflake --recursive --in-place --remove-duplicate-keys --remove-unused-variables .
isort .
black .
[testenv:pre-release] # test against pre-releases of dependencies
pip_pre = true
deps = pytest
hypothesis
scipy
pytest-xdist
basepython = python3.11
commands = pytest -n auto --hypothesis-profile ci \
{posargs}
extras =
[testenv:enforce-format]
skip_install=true
basepython=python3.11
deps=black
isort
flake8
pytest
codespell
commands=
black src/ tests/ --diff --check
isort src/ tests/ --diff --check
flake8 src/ tests/
codespell src/ docs/
"""
Loading

0 comments on commit e3d78b4

Please sign in to comment.