Closed zobac closed 2 years ago
This does not work as get_application_registry()
is defined after pint_array
is imported and the body of PintType
is executed.
Played around with this a bit and tried replacing PintType.ureg
in __new__()
with no success unfortunately.
I tried something and it seems to work https://github.com/hgrecco/pint-pandas/pull/63/files, it lets me import pint.
No idea why doing that works and this doesn't.
Never mind, that breaks the import in pint.
I think we'd have to remove the import in pint for this to work. https://github.com/hgrecco/pint/blob/master/pint/__init__.py#L39
this was done in https://github.com/hgrecco/pint-pandas/pull/67
If the user defines pint._APP_REGISTRY (pint.set_application_registry) PintType.ureg will be that registry. Otherwise it will be the default registry defined with "default_en.txt"
This provides a means of guaranteeing PintTypes will use the same UnitRegistry.