Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into maint
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwthompson committed Jan 14, 2025
2 parents f716094 + c482d8c commit ee831a4
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 13 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
os: [macos-latest, ubuntu-latest]
openmm: ["true", "false"]
python-version: ["3.10", "3.11", "3.12"]
pint-version: ["0.21", "0.22", "0.23"]
pint-version: ["0.24"]

env:
CI_OS: ${{ matrix.os }}
Expand Down Expand Up @@ -70,13 +70,17 @@ jobs:
run: python -m pytest $PYTEST_ARGS downstream_dummy/tests/

- name: Run mypy
if: ${{ matrix.python-version == '3.12' && matrix.openmm == 'true' }}
if: ${{ matrix.python-version == '3.12' }}
run: python -m mypy -p "openff.units" && python -m mypy downstream_dummy/ --exclude=downstream_dummy/build/

- name: Run docexamples
if: ${{ matrix.openmm == 'true' }}
run: pytest --doctest-modules $PYTEST_ARGS openff --ignore=openff/units/_tests

- name: Check OpenMM is lazy-imported
if: ${{ matrix.openmm == 'true' }}
run: python -c "import sys; from openff.units import unit, Quantity; assert 'openmm' not in sys.modules"

- name: Codecov
uses: codecov/codecov-action@v5
with:
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ci:
autoupdate_schedule: "monthly"
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.2
rev: v0.9.1
hooks:
- id: ruff
args: [--fix]
Expand Down
2 changes: 1 addition & 1 deletion devtools/conda-envs/docs_env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: openff-units-test
channels:
- conda-forge
dependencies:
- python
- python <3.13
- pip
- numpy
- pint >=0.20.1
Expand Down
2 changes: 1 addition & 1 deletion devtools/conda-envs/test_env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ dependencies:
- uncertainties

# Typing
- mypy ~=1.13
- mypy
- types-setuptools
4 changes: 2 additions & 2 deletions openff/units/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
__version__ = version("openff.units")

__all__ = [
"unit",
"Quantity",
"Measurement",
"Quantity",
"Unit",
"ensure_quantity",
"unit",
]

_objects: dict[str, str] = {
Expand Down
2 changes: 1 addition & 1 deletion openff/units/elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@

__all__ = [
"MASSES",
"SYMBOLS",
"NUMBERS",
"SYMBOLS",
]

"""Mapping from atomic number to atomic mass"""
Expand Down
4 changes: 2 additions & 2 deletions openff/units/openmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
from openff.units.units import Quantity, Unit

__all__ = [
"ensure_quantity",
"from_openmm",
"to_openmm",
"openmm_unit_to_string",
"string_to_openmm_unit",
"ensure_quantity",
"to_openmm",
]

if has_package("openmm.unit"):
Expand Down
4 changes: 2 additions & 2 deletions openff/units/units.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

__all__ = (
"DEFAULT_UNIT_REGISTRY",
"Quantity",
"Measurement",
"Quantity",
"Unit",
"unit",
)
Expand Down Expand Up @@ -76,7 +76,7 @@ class UnitRegistry(pint.UnitRegistry):
_measurement_class = Measurement


DEFAULT_UNIT_REGISTRY = UnitRegistry(get_defaults_path())
DEFAULT_UNIT_REGISTRY = UnitRegistry(get_defaults_path(), cache_folder=":auto:")

unit = DEFAULT_UNIT_REGISTRY

Expand Down
2 changes: 1 addition & 1 deletion stubs/openmm/unit/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Generator
from collections.abc import Generator

import numpy
from openmm.unit.baseunit import BaseUnit
Expand Down

0 comments on commit ee831a4

Please sign in to comment.