-
Notifications
You must be signed in to change notification settings - Fork 2
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
openff-units 0.2.1 breaks mypy for openff-models #69
Comments
0.2.1 breaks lots of stuff for reasons that have caused me physiological aging (blood pressure, hair loss, etc.). For now the recommendation is to stick to 0.2.0, since I think that works, and we'll have fixes out as soon as we can (one attempt at #68). |
I'm also not sure if this affects both Pint 0.21 and 0.22, but I'm pretty sure one of them works with 0.2.0 |
With #84 I have it passing on Pint 0.21, 0.22, 0.23 With openforcefield/openff-models#42 it's also passing with Pydantic models. The #77 would be my preferred solution but that's around three years out of being compatible with OpenFF's Python support |
This still sticks around on the v1 API, it should be gone with v2 $ cat example.py && python example.py && mypy example.py 14:00:02 ☁ 0.2.2 ☂
# file named example.py
import openff.units
import openff.models
from openff.models.types import FloatQuantity
from pydantic.v1 import BaseModel
from openff.units import Quantity
print(f"{openff.units.__version__=}")
print(f"{openff.models.__version__=}")
class Model(BaseModel):
temperature: FloatQuantity["kelvin"]
print(f"{Model(temperature=Quantity("419.0 kelvin")).temperature=}")
openff.units.__version__='0.2.2'
openff.models.__version__='0.1.2'
Model(temperature=Quantity("419.0 kelvin")).temperature=<Quantity(419.0, 'kelvin')>
example.py:15: error: Variable "openff.models.types.FloatQuantity" is not valid as a type [valid-type]
example.py:15: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
example.py:15: error: Name "kelvin" is not defined [name-defined]
Found 2 errors in 1 file (checked 1 source file) |
These code paths are outdated now - closing, let us know if this needs to be revived |
Not sure if this belongs here or on openff-models, but here's a MCVE:
Then, with openff-units 0.2.0 (and openff-models at current release, 0.0.5):
With openff-units 0.2.1:
see also OpenFreeEnergy/openfe#461
The text was updated successfully, but these errors were encountered: