Skip to content

[codex] fix circular import in mussel.utils#136

Merged
raylim merged 1 commit into
mainfrom
codex/fix-circular-import
Jun 22, 2026
Merged

[codex] fix circular import in mussel.utils#136
raylim merged 1 commit into
mainfrom
codex/fix-circular-import

Conversation

@raylim

@raylim raylim commented Jun 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes a circular import triggered by importing mussel.datasets before mussel.cli.extract_features.

Root Cause

mussel.utils.__init__ eagerly imported symbols from mussel.utils.feature_extract. That pulled in feature extraction dependencies while other modules were still initializing, which made some import orders fail in a clean interpreter.

Changes

  • Lazily exports feature-extraction symbols from mussel.utils via __getattr__.
  • Preserves the existing public import surface, including from mussel.utils import aggregate_slide_features_batch.
  • Adds clean-interpreter regression tests for the problematic import orders.

Validation

PYTHONPATH=/tmp/mussel-circular-import /gpfs/mskmind_ess/limr/repos/Mussel-titan-fix/.venv/bin/python -m pytest /tmp/mussel-circular-import/tests/mussel/test_import_order.py -q

Result: 3 passed

@raylim raylim marked this pull request as ready for review June 22, 2026 15:54
@raylim raylim merged commit 5d6892e into main Jun 22, 2026
3 checks passed
@raylim raylim deleted the codex/fix-circular-import branch June 22, 2026 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant