diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 65b6163db..a484c63cf 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,11 +8,6 @@ repos: - id: ruff-format - id: ruff-check args: [--fix] -- repo: https://github.com/adamchainz/blacken-docs - rev: 1.20.0 - hooks: - - id: blacken-docs - files: ^docs/.*\.(rst|md)$ - repo: https://github.com/tox-dev/pyproject-fmt rev: v2.30.1 hooks: diff --git a/README.md b/README.md index a5c2d3b7b..6c031d884 100644 --- a/README.md +++ b/README.md @@ -56,16 +56,19 @@ SMIRNOFF force fields can be parsed by the `ForceField` class, which offers meth # Load a molecule into the OpenFF Molecule object from openff.toolkit import Molecule from openff.toolkit.utils import get_data_file_path -sdf_file_path = get_data_file_path('molecules/ethanol.sdf') + +sdf_file_path = get_data_file_path("molecules/ethanol.sdf") molecule = Molecule.from_file(sdf_file_path) # Create an OpenFF Topology object from the molecule from openff.toolkit import Topology + topology = Topology.from_molecules(molecule) # Load the latest OpenFF force field release: version 2.1.0, codename "Sage" from openff.toolkit import ForceField -forcefield = ForceField('openff-2.3.0.offxml') + +forcefield = ForceField("openff-2.3.0.offxml") # Create an Interchange object for representations in other formats @@ -73,7 +76,6 @@ interchange = forcefield.create_interchange(topology) # Create an OpenMM system representing the molecule with SMIRNOFF-applied parameters openmm_system = interchange.to_openmm(topology) - ``` Detailed examples of using SMIRNOFF with the toolkit can be found [in the documentation](https://open-forcefield-toolkit.readthedocs.io/en/stable/examples.html). diff --git a/devtools/conda-envs/examples.yaml b/devtools/conda-envs/examples.yaml index 488353266..089d5ea11 100644 --- a/devtools/conda-envs/examples.yaml +++ b/devtools/conda-envs/examples.yaml @@ -32,7 +32,7 @@ dependencies: - msgpack-python - pydantic =2 - qcelemental - - qcportal >=0.50 + - qcportal >=0.70 - qcengine - nbval - mdtraj diff --git a/devtools/conda-envs/test_env.yaml b/devtools/conda-envs/test_env.yaml index d7e8f98d3..7b951359a 100644 --- a/devtools/conda-envs/test_env.yaml +++ b/devtools/conda-envs/test_env.yaml @@ -36,17 +36,17 @@ dependencies: - msgpack-python - pydantic =2 - qcelemental - - qcportal >=0.50 + - qcportal >=0.70 - qcengine - nglview - mdtraj - nbval + - mypy =2 + - types-setuptools + - types-toml + - types-PyYAML + - types-networkx + - types-xmltodict + - types-cachetools - pip: - - mypy ==2 - - types-setuptools - - types-toml - - types-PyYAML - - types-networkx - - types-xmltodict - - types-cachetools - mongo-types diff --git a/devtools/conda-envs/test_env_no_openeye.yaml b/devtools/conda-envs/test_env_no_openeye.yaml index ccb17fca3..d9b0d068c 100644 --- a/devtools/conda-envs/test_env_no_openeye.yaml +++ b/devtools/conda-envs/test_env_no_openeye.yaml @@ -34,15 +34,15 @@ dependencies: - msgpack-python - pydantic =2 - qcelemental - - qcportal >=0.50 + - qcportal >=0.70 - qcengine - nglview + - mypy =2 + - types-setuptools + - types-toml + - types-PyYAML + - types-networkx + - types-xmltodict + - types-cachetools - pip: - - mypy ==2 - - types-setuptools - - types-toml - - types-PyYAML - - types-networkx - - types-xmltodict - - types-cachetools - mongo-types diff --git a/docs/api/toolkits.md b/docs/api/toolkits.md index e69865304..7e418fe52 100644 --- a/docs/api/toolkits.md +++ b/docs/api/toolkits.md @@ -65,11 +65,8 @@ The [`toolkit_registry_manager`] context manager allows `GLOBAL_TOOLKIT_REGISTRY >>> from openff.toolkit.utils import toolkit_registry_manager >>> print(len(GLOBAL_TOOLKIT_REGISTRY.registered_toolkits)) 5 ->>> with toolkit_registry_manager( -... ToolkitRegistry([RDKitToolkitWrapper(), AmberToolsToolkitWrapper()]) -... ): +>>> with toolkit_registry_manager(ToolkitRegistry([RDKitToolkitWrapper(), AmberToolsToolkitWrapper()])): ... print(len(GLOBAL_TOOLKIT_REGISTRY.registered_toolkits)) -... 2 ``` diff --git a/openff/toolkit/topology/molecule.py b/openff/toolkit/topology/molecule.py index d50301b83..3d1f04851 100644 --- a/openff/toolkit/topology/molecule.py +++ b/openff/toolkit/topology/molecule.py @@ -298,7 +298,7 @@ def add_bond(self, bond: "Bond"): self._bonds.append(bond) - def to_dict(self) -> dict[str, None | str | int | bool | dict[Any, Any]]: + def to_dict(self) -> dict[str, str | int | bool | dict[Any, Any] | None]: """Return a dict representation of the :class:`Atom` class instance. Output dictionary keys and values align with parameters used to initialize @@ -1170,7 +1170,14 @@ def to_dict(self) -> dict: # https://mypy.readthedocs.io/en/latest/typed_dict.html#typeddict molecule_dict: dict[ str, - str | bytes | dict[str, Any] | list[str] | list[bytes] | list[HierarchyElement] | list[dict[str, Any]] | None, + str + | bytes + | dict[str, Any] + | list[str] + | list[bytes] + | list[HierarchyElement] + | list[dict[str, Any]] + | None, ] = dict() molecule_dict["name"] = self._name @@ -1953,7 +1960,7 @@ def are_isomorphic( bond_stereochemistry_matching: bool = True, strip_pyrimidal_n_atom_stereo: bool = True, toolkit_registry: TKR = GLOBAL_TOOLKIT_REGISTRY, - ) -> tuple[bool, None | dict[int, int]]: + ) -> tuple[bool, dict[int, int] | None]: """ Determine if ``mol1`` is isomorphic to ``mol2``. diff --git a/openff/toolkit/topology/topology.py b/openff/toolkit/topology/topology.py index ea8e56bee..8a7eeaa4e 100644 --- a/openff/toolkit/topology/topology.py +++ b/openff/toolkit/topology/topology.py @@ -1329,7 +1329,7 @@ def from_openmm( cls, openmm_topology: "openmm.app.Topology", unique_molecules: Iterable[FrozenMolecule] | None = None, - positions: Union[None, Quantity, "OMMQuantity"] = None, + positions: Union[Quantity, "OMMQuantity", None] = None, ) -> "Topology": """ Construct an OpenFF Topology object from an OpenMM Topology object. @@ -2124,7 +2124,7 @@ def from_mdtraj( cls, mdtraj_topology: "mdtraj.Topology", unique_molecules: Iterable[MoleculeLike] | None = None, - positions: Union[None, "OMMQuantity", Quantity] = None, + positions: Union["OMMQuantity", Quantity, None] = None, ): """ Construct an OpenFF ``Topology`` from an MDTraj ``Topology``