Skip to content

Annotations not imported from other modules #64

@Ealdwulf

Description

@Ealdwulf

Hi

I am having some issue with variables imported from other modules - impunity seems to fail to find the annotations and treats them as dimensionless. In the attached example, kT_over_q and k, T, and Q are defined with units in t1.py, and used in t2.py. In the definition of D_n2, using variables imported from t1.py, it fails with "Expected unit m^2/s but received incompatible unit m^2/V/s". But re-attaching the annotations using a local variable, does not produce this error (in the similar definition of D_n). Wondering what is going on here. It does not seem to make a difference if I use Annotated or not.

This is with Python 3.12.3

I wonder if there is also a way not to default to dimensionless (once you combine with a dimensioned variable), so that this kind of issue produces a noisy warning.

t1.py
t2.py

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions