Skip to content

Commit

Permalink
Test with dummy downstream package
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwthompson committed Apr 1, 2024
1 parent cf95f84 commit 0a8464a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@ jobs:
- name: Install package
run: python -m pip install -e . downstream_dummy/

- name: Run mypy
if: ${{ matrix.python-version == '3.12' }}
run: mypy -p "openff.units"

- name: Run unit tests
run: |
if [[ ${{ matrix.openmm }} == false ]]; then
Expand All @@ -72,6 +68,16 @@ jobs:
- name: Run dummy package tests
run: pytest $PYTEST_ARGS downstream_dummy/tests/

- name: Run mypy
if: ${{ matrix.python-version == '3.12' }}
run: mypy -p "openff.units"

- name: Install, typecheck, and test dummy downstream package
run: |
python -m pip install -e downstream_dummy/
mypy downstream_dummy/
pytest $PYTEST_ARGS downstream_dummy/tests/
- name: Run docexamples
if: ${{ matrix.openmm == 'true' }}
run: pytest --doctest-modules $PYTEST_ARGS $COV openff --ignore=openff/units/_tests
Expand Down
3 changes: 2 additions & 1 deletion devtools/conda-envs/test_env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ dependencies:
- uncertainties

# Typing
- mypy
- mypy =1.9
- types-setuptools
11 changes: 9 additions & 2 deletions openff/units/units.pyi
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
from typing import overload

import numpy

class Unit:
def __init__(self, *args, **kwargs): ...
def __mul__(self, other: int | float | numpy.ndarray) -> Quantity: ...
__rmul__ = __mul__

class Quantity:
def __init__(self, *args, **kwargs): ...
def to(self, unit: str | Unit = "dimensionless") -> Quantity: ...
def to_base_units(self, unit: str | Unit = "dimensionless") -> Quantity: ...
def is_compatible_with(self, unit: str | Unit) -> bool: ...
@property
def units(self) -> Unit: ...

# lists are cast to ndarray
def m(self) -> float | int | numpy.ndarray: ...
def m_as(self) -> float | int | numpy.ndarray: ...

magnitude = m

0 comments on commit 0a8464a

Please sign in to comment.