From 1f4131c344a14533e47aeaf68331de5664eff142 Mon Sep 17 00:00:00 2001 From: "Matthew W. Thompson" Date: Wed, 13 Nov 2024 08:40:41 -0600 Subject: [PATCH] MAINT: Consolidate Python config in `pyproject.toml` --- .codecov.yml | 14 ------ .github/workflows/beta.yaml | 10 +--- .github/workflows/ci.yaml | 9 +--- .github/workflows/examples.yaml | 5 -- docs/developing.md | 2 +- pyproject.toml | 59 ++++++++++++++++++++++ pytest.ini | 3 -- setup.cfg | 88 --------------------------------- setup.py | 6 --- 9 files changed, 64 insertions(+), 132 deletions(-) delete mode 100644 .codecov.yml delete mode 100644 pytest.ini delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/.codecov.yml b/.codecov.yml deleted file mode 100644 index 03d226863..000000000 --- a/.codecov.yml +++ /dev/null @@ -1,14 +0,0 @@ -# Codecov configuration to make it a bit less noisy -coverage: - status: - patch: false - project: - default: - threshold: 50% -comment: - layout: "header" - require_changes: false - branches: null - behavior: default - flags: null - paths: null diff --git a/.github/workflows/beta.yaml b/.github/workflows/beta.yaml index 46b87ef5e..0bf134e6e 100644 --- a/.github/workflows/beta.yaml +++ b/.github/workflows/beta.yaml @@ -29,7 +29,6 @@ jobs: env: OE_LICENSE: ${{ github.workspace }}/oe_license.txt - COV: --cov=openff/interchange --cov-report=xml --cov-config=setup.cfg --cov-append steps: - uses: actions/checkout@v4 @@ -46,12 +45,7 @@ jobs: pydantic=${{ matrix.pydantic-version }} - name: Install package - run: | - micromamba remove --force openff-interchange openff-interchange-base - python -m pip install . plugins/ - - - name: Environment Information - run: conda info && conda list + run: python -m pip install . plugins/ - name: License OpenEye if: ${{ matrix.openeye == true }} @@ -67,7 +61,7 @@ jobs: - name: Run all tests if: always() - run: python -m pytest -v $COV openff/interchange/ + run: python -m pytest -v openff/interchange/ - name: Codecov uses: codecov/codecov-action@v4 diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c9add7cbe..22b9078f5 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -41,7 +41,6 @@ jobs: env: OE_LICENSE: ${{ github.workspace }}/oe_license.txt - COV: --cov=openff/interchange --cov-report=xml --cov-config=setup.cfg --cov-append steps: - uses: actions/checkout@v4 @@ -58,11 +57,7 @@ jobs: pydantic=${{ matrix.pydantic-version }} - name: Install package - run: | - # These packages are brought in by conda (via the toolkit) and must be removed manually - # since pip doesn't know about the -base split and does not uninstall the -base package - micromamba remove --force openff-interchange openff-interchange-base - python -m pip install . plugins/ + run: python -m pip install . plugins/ - name: Install and license OpenEye Toolkits if: ${{ matrix.openeye == true }} @@ -97,7 +92,7 @@ jobs: - name: Run tests if: always() run: | - python -m pytest $COV openff/interchange/ -r fExs -n logical --durations=10 + python -m pytest openff/interchange/ -r fExs -n logical --durations=10 - name: Run small molecule regression tests if: ${{ matrix.openeye == true && matrix.openmm == true }} diff --git a/.github/workflows/examples.yaml b/.github/workflows/examples.yaml index ac174f8d0..d579040df 100644 --- a/.github/workflows/examples.yaml +++ b/.github/workflows/examples.yaml @@ -50,11 +50,6 @@ jobs: run: | python -m pip install . - - name: Environment Information - run: | - micromamba info - micromamba list - - name: License OpenEye run: | echo "${SECRET_OE_LICENSE}" > ${OE_LICENSE} diff --git a/docs/developing.md b/docs/developing.md index 1bfcd431d..b4eda3a46 100644 --- a/docs/developing.md +++ b/docs/developing.md @@ -24,7 +24,7 @@ Style is enforced with automated linters that run in CI. See `.github/workflows/ ### Type-checking -Type hints are **optional** but encouraged. Many optional flags are passed to `mypy`; check the action for a recommended invocation. Check `setup.cfg` for some configuration, mostly ignoring libraries that do not have support for type-checking. +Type hints are **optional** but encouraged. Many optional flags are passed to `mypy`; check the action for a recommended invocation. Check `pyproject.toml` for some configuration, mostly ignoring libraries that do not have support for type-checking. ### Pre-commit diff --git a/pyproject.toml b/pyproject.toml index 6163e361a..8acc970bf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,8 +13,54 @@ authors = [{name = "Open Force Field Initiative", email = "info@openforcefield.o license = {text = "MIT"} dynamic = ["version"] +[tool.setuptools.packages.find] +where = ["openff/interchange"] + [tool.versioningit] +[tool.mypy] +mypy_path = "stubs/" +python_version = "3.11" +plugins = "numpy.typing.mypy_plugin,pydantic.mypy" +warn_unused_configs = true +warn_unused_ignores = true +warn_incomplete_stub = true +show_error_codes = true + +[[tool.mypy.overrides]] +module = [ + "pandas", + "networkx", + "openmm", + "openmm.app", + "openmm.app.element", + "openmm.unit", + "intermol.*", + "rdkit", + "openff.toolkit.*", + "openff.units.*", + "openff.utilities.*", + "openff.recharge.*", + "parmed", + "parmed.amber", + "pmdtest.utils", + "pytest", + "pint", + "unyt", + "openeye", + "jax", + "scipy.spatial", + "nonbonded_plugins.*", + "lammps", +] +ignore_missing_imports = true + +[tool.pytest.ini_options] +markers = [ + "slow: marks tests as slow (deselect with '-m \"not slow\"')", +] +addopts = "--cov=openff/interchange --cov-report=xml" + [tool.interrogate] ignore-init-method = true ignore-init-module = true @@ -60,3 +106,16 @@ known-first-party = ["openff.interchange"] [tool.ruff.lint.pydocstyle] property-decorators=["validator"] + +[tool.coverage.run] +omit = [ + "*/*/_tests/*", +] + +[tool.coverage.report] +exclude_lines = [ + "pragma: no cover", + "if TYPE_CHECKING:", + "raise NotImplementedError", + "@overload", +] diff --git a/pytest.ini b/pytest.ini deleted file mode 100644 index 761785364..000000000 --- a/pytest.ini +++ /dev/null @@ -1,3 +0,0 @@ -[pytest] -markers = - slow: marks tests as slow (deselect with '-m "not slow"') diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index ed47a2469..000000000 --- a/setup.cfg +++ /dev/null @@ -1,88 +0,0 @@ -[coverage:run] -omit = - */*/_tests/* - -[coverage:report] -exclude_lines = - pragma: no cover - if TYPE_CHECKING: - raise NotImplementedError - @overload - -[mypy] -mypy_path = stubs/ -plugins = numpy.typing.mypy_plugin,pydantic.mypy -warn_unused_configs = True -warn_unused_ignores = True -warn_incomplete_stub = True -show_error_codes = True - -[mypy-pandas.*] -ignore_missing_imports = True - -[mypy-networkx] -ignore_missing_imports = True - -[mypy-openmm] -ignore_missing_imports = True - -[mypy-openmm.app] -ignore_missing_imports = True - -[mypy-openmm.app.element] -ignore_missing_imports = True - -[mypy-openmm.unit] -ignore_missing_imports = True - -[mypy-intermol.*] -ignore_missing_imports = True - -[mypy-rdkit] -ignore_missing_imports = True - -[mypy-openff.toolkit.*] -ignore_missing_imports = True - -[mypy-openff.units.*] -ignore_missing_imports = True - -[mypy-openff.utilities.*] -ignore_missing_imports = True - -[mypy-openff.recharge.*] -ignore_missing_imports = True - -[mypy-parmed] -ignore_missing_imports = True - -[mypy-parmed.amber] -ignore_missing_imports = True - -[mypy-pmdtest.utils] -ignore_missing_imports = True -ignore_errors = True - -[mypy-pytest] -ignore_missing_imports = True - -[mypy-pint] -ignore_missing_imports = True - -[mypy-unyt] -ignore_missing_imports = True - -[mypy-openeye] -ignore_missing_imports = True - -[mypy-jax] -ignore_missing_imports = True - -[mypy-scipy.spatial] -ignore_missing_imports = True - -[mypy-nonbonded_plugins.*] -ignore_missing_imports = True - -[mypy-lammps] -ignore_missing_imports = True diff --git a/setup.py b/setup.py deleted file mode 100644 index 1b36eb65a..000000000 --- a/setup.py +++ /dev/null @@ -1,6 +0,0 @@ -from setuptools import find_namespace_packages, setup - -setup( - packages=find_namespace_packages(), - include_package_data=True, -)