Skip to content

openff-units 0.2.1 breaks mypy for openff-models #69

Description

@dwhswenson

Not sure if this belongs here or on openff-models, but here's a MCVE:

# file named example.py
from openff.models.types import FloatQuantity
import openff.units  # type: ignore

print(f"{openff.units.__version__=}")
models_quantity: FloatQuantity["kelvin"]

Then, with openff-units 0.2.0 (and openff-models at current release, 0.0.5):

$ python example.py && mypy example.py
openff.units.__version__='0.2.0'
Success: no issues found in 1 source file

With openff-units 0.2.1:

$ python example.py && mypy example.py
openff.units.__version__='0.2.1'
example.py:5: error: Variable "openff.models.types.FloatQuantity" is not valid as a type  [valid-type]
example.py:5: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
example.py:5: error: Name "kelvin" is not defined  [name-defined]
Found 2 errors in 1 file (checked 1 source file)

see also OpenFreeEnergy/openfe#461

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions