__________________ ERROR collecting erfa/tests/test_ufunc.py ___________________
ImportError while importing test module '/build/pyerfa-126.96.36.199/erfa/tests/test_ufunc.py'.
Hint: make sure your test modules/packages have valid Python names.
/nix/store/lx8vhp4fxclp494svlfis3sb2g8z4l9h-python3-3.10.12/lib/python3.10/importlib/__init__.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
erfa/__init__.py:5: in <module>
from .version import version as __version__ # noqa
erfa/version.py:25: in <module>
from . import ufunc
E ImportError: cannot import name 'ufunc' from partially initialized module 'erfa' (most likely due to a circular import) (/build/pyerfa-188.8.131.52/erfa/__init__.py)
The accused file from upstream is this. I don’t see anything unusual there… Does anyone with good Python eyes can help?
Thanks for trying to help @lelgenio ! Are you suggesting that in general, every time a package uses from . import foo or import .foo etc is doing it wrong? I may write an upstream patch that will fix it all… It’s just surprising to me that this is so abundant in this code.
It’s the weirdest thing… I replaced every . with erfa in all imports, and it sort of fixed the issue now, but I had also to add rm -rf erfa in the preCheck to make the build work, because it seems the python interpreter didn’t know whether it should import erfa from $out or from $PWD… This scenario seems rather common in Nixpkgs to me - a Python package naming both the python files’ directory the same as the module (the <> in import <>) - hence it’s so weird that I have to rm -rf erfa in preCheck…
EDIT: Now a detailed investigation is available at: