Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consolidate Python config files #1104

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions .codecov.yml

This file was deleted.

7 changes: 2 additions & 5 deletions .github/workflows/beta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}
Expand All @@ -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
Expand Down
12 changes: 2 additions & 10 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,10 @@ jobs:
- false
openmm:
- true
- false

env:
OE_LICENSE: ${{ github.workspace }}/oe_license.txt
COV: --cov=openff/interchange --cov-report=xml --cov-config=setup.cfg --cov-append
COV: --cov=openff/interchange --cov-report=xml --cov-config=pyproject.toml --cov-append

steps:
- uses: actions/checkout@v4
Expand All @@ -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 }}
Expand Down Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions devtools/conda-envs/examples_env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ dependencies:
- mdtraj
- pytest
- pytest-xdist
- pytest-cov
- nbval
# Examples
- openmmforcefields
Expand Down
1 change: 0 additions & 1 deletion devtools/conda-envs/test_env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ dependencies:
- openff-nagl-models ~=0.3
- mbuild =1
- foyer =1
- gmso ~=0.12
- nglview
# Drivers
- gromacs
Expand Down
2 changes: 1 addition & 1 deletion docs/developing.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
14 changes: 9 additions & 5 deletions openff/interchange/components/interchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@
from openff.toolkit import ForceField

if has_package("foyer"):
from foyer import Forcefield as FoyerForcefield
try:
from foyer.forcefield import Forcefield as FoyerForcefield
except ModuleNotFoundError:
# case of openff/interchange/foyer/ being detected as the real package
pass
if has_package("nglview"):
import nglview

Expand Down Expand Up @@ -836,13 +840,13 @@ def from_foyer(

>>> from openff.interchange import Interchange
>>> from openff.toolkit import Molecule, Topology
>>> from foyer import Forcefield
>>> from foyer.forcefield import Forcefield # doctest: +SKIP
>>> mol = Molecule.from_smiles("CC")
>>> mol.generate_conformers(n_conformers=1)
>>> top = Topology.from_molecules([mol])
>>> oplsaa = Forcefield(name="oplsaa")
>>> interchange = Interchange.from_foyer(topology=top, force_field=oplsaa)
>>> interchange
>>> oplsaa = Forcefield(name="oplsaa") # doctest: +SKIP
>>> interchange = Interchange.from_foyer(topology=top, force_field=oplsaa) # doctest: +SKIP
>>> interchange # doctest: +SKIP
Interchange with 8 collections, non-periodic topology with 8 atoms.

"""
Expand Down
7 changes: 6 additions & 1 deletion openff/interchange/foyer/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@
from typing import TYPE_CHECKING

from openff.toolkit import Topology
from openff.utilities import has_package

from openff.interchange.components.potentials import Collection, Potential
from openff.interchange.models import PotentialKey, TopologyKey

if TYPE_CHECKING:
from foyer import Forcefield
if has_package("foyer"):
try:
from foyer.forcefield import Forcefield
except ModuleNotFoundError:
pass


# Is this the safest way to achieve PotentialKey id separation?
Expand Down
5 changes: 4 additions & 1 deletion openff/interchange/foyer/_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
from openff.interchange.models import TopologyKey

if has_package("foyer"):
from foyer.forcefield import Forcefield
try:
from foyer.forcefield import Forcefield
except ModuleNotFoundError:
pass

_CollectionAlias = type[Collection]

Expand Down
5 changes: 4 additions & 1 deletion openff/interchange/foyer/_nonbonded.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
from openff.interchange.models import PotentialKey, TopologyKey

if has_package("foyer"):
from foyer import Forcefield
try:
from foyer.forcefield import Forcefield
except ModuleNotFoundError:
pass


class FoyerVDWHandler(vdWCollection):
Expand Down
59 changes: 59 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,54 @@ authors = [{name = "Open Force Field Initiative", email = "[email protected]
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
Expand Down Expand Up @@ -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",
]
3 changes: 0 additions & 3 deletions pytest.ini

This file was deleted.

90 changes: 0 additions & 90 deletions setup.cfg

This file was deleted.

6 changes: 0 additions & 6 deletions setup.py

This file was deleted.

Loading