You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# /// script# requires-python = ">=3.11"# dependencies = [# "datajoint @ git+https://github.com/datajoint/datajoint-python.git@82a9223b484f639bd2cf26a9d48bc29d56cda8aa",# ]# ///"""Reproducer for circular import bug in datajoint pre/v2.1 branch.Run with: uv run reproducer.pyExpected: datajoint imports successfully and prints versionActual: ImportError due to missing builtin_codecs moduleThe issue is in datajoint/codecs.py:590 which tries to import: from . import builtin_codecs as _builtin_codecsbut builtin_codecs does not exist in the package."""importdatajointprint(f"datajoint version: {datajoint.__version__}")
(dj-zarr-codecs) d-v-b@pc ➜ dj-zarr-codecs git:(chore/repo-housekeeping) ✗ uv run reproducer.py
Traceback (most recent call last):
File "/home/d-v-b/dev/dj-zarr-codecs/reproducer.py", line 20, in <module>
import datajoint
File "/home/d-v-b/.cache/uv/environments-v2/reproducer-561c46f342a40bb5/lib/python3.11/site-packages/datajoint/__init__.py", line 65, in <module>
from .codecs import (
File "/home/d-v-b/.cache/uv/environments-v2/reproducer-561c46f342a40bb5/lib/python3.11/site-packages/datajoint/codecs.py", line 590, in <module>
from . import builtin_codecs as _builtin_codecs # noqa: F401, E402
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ImportError: cannot import name 'builtin_codecs' from partially initialized module 'datajoint' (most likely due to a circular import) (/home/d-v-b/.cache/uv/environments-v2/reproducer-561c46f342a40bb5/lib/python3.11/site-packages/datajoint/__init__.py)
The root cause is the misconfiguration of setuptools in pyproject.toml. Setuptools is not finding subpackages (like builtin_codecs) and so they are not being packaged. The fix is to fix the setuptools configuration, or even better, use a modern build system like hatchling.
Activity
dimitri-yatsenko commentedon Jan 30, 2026
Fixed in #1358