From ab32ee7b7856b60546230736a240f491429e2494 Mon Sep 17 00:00:00 2001 From: "Matthew W. Thompson" Date: Thu, 16 Jan 2025 10:13:21 -0600 Subject: [PATCH] MAINT: Consolidate Python config in `pyproject.toml` --- .codecov.yml | 14 ----- .github/workflows/beta.yaml | 7 +-- .github/workflows/ci.yaml | 10 +-- devtools/conda-envs/examples_env.yaml | 1 + devtools/conda-envs/test_env.yaml | 1 - docs/developing.md | 2 +- pyproject.toml | 59 ++++++++++++++++++ pytest.ini | 3 - setup.cfg | 90 --------------------------- setup.py | 6 -- 10 files changed, 64 insertions(+), 129 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 e7a54cebc..6b4c806bf 100644 --- a/.github/workflows/beta.yaml +++ b/.github/workflows/beta.yaml @@ -28,7 +28,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 @@ -52,9 +51,7 @@ jobs: python=${{ matrix.python-version }} - name: Install package - run: | - 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 }} @@ -71,7 +68,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@v5 diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 58456dc2a..d13978f1f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -37,7 +37,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 @@ -52,11 +51,7 @@ jobs: python=${{ matrix.python-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 }} @@ -85,9 +80,6 @@ jobs: # and also uninstalls RDKit run: micromamba install rdkit "ambertools =23" "lammps >=2023.08.02" "jax >=0.3" "jaxlib >=0.3" -c conda-forge - - name: Install Foyer - run: micromamba install "foyer >=0.12.1" -c conda-forge -yq - - name: Run tests run: python -m pytest $COV openff/interchange/ -r fExs -n logical --durations=10 diff --git a/devtools/conda-envs/examples_env.yaml b/devtools/conda-envs/examples_env.yaml index 00d197cc6..cd51766f5 100644 --- a/devtools/conda-envs/examples_env.yaml +++ b/devtools/conda-envs/examples_env.yaml @@ -30,6 +30,7 @@ dependencies: - mdtraj - pytest - pytest-xdist + - pytest-cov - nbval # Examples - openmmforcefields diff --git a/devtools/conda-envs/test_env.yaml b/devtools/conda-envs/test_env.yaml index 7de4cef5a..572c46bf4 100644 --- a/devtools/conda-envs/test_env.yaml +++ b/devtools/conda-envs/test_env.yaml @@ -21,7 +21,6 @@ dependencies: - openff-nagl-models ~=0.3 - mbuild =1 - foyer =1 - - gmso ~=0.12 - nglview # Drivers - gromacs 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 a34e6de9a..000000000 --- a/setup.cfg +++ /dev/null @@ -1,90 +0,0 @@ -[coverage:run] -omit = - */*/_tests/* - -[coverage:report] -exclude_lines = - pragma: no cover - if TYPE_CHECKING: - raise NotImplementedError - @overload - -[mypy] -python_version = 3.12 -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 -exclude = openff/interchange/_tests/ - -[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, -)