Skip to content

Commit 5aec73a

Browse files
docxologyclaude
andcommitted
fix: restore dependency-ordered imports in core/__init__.py
isort alphabetized imports which broke the carefully ordered dependency chain. Utils (config, logging) must be imported BEFORE data, io, execution, engine, ui - since those modules reference metainformant.core attributes at module level. Added isort: skip_file directive. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 5bee9ee commit 5aec73a

File tree

1 file changed

+53
-43
lines changed

1 file changed

+53
-43
lines changed

src/metainformant/core/__init__.py

Lines changed: 53 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,29 @@
77

88
from __future__ import annotations
99

10-
# 6. UI (Terminal Interface)
11-
# 5. Engine (Workflow Manager)
12-
# 4. Execution (Workflow)
13-
# Depends on IO and Utils
14-
# 3. IO (Input/Output)
15-
# Depends on Utils for logging/config
10+
# Import subpackages in dependency order (NOT alphabetical - order matters!)
11+
# isort: skip_file
12+
13+
# 1. Utils (Foundation) - must be first, other modules depend on config/logging
14+
from . import utils # noqa: E402
15+
from .utils import ( # noqa: E402
16+
Timer,
17+
config,
18+
errors,
19+
hash,
20+
logging,
21+
optional_deps,
22+
progress,
23+
rate_limiter,
24+
symbols,
25+
text,
26+
timed,
27+
timeout_after,
28+
)
29+
1630
# 2. Data (Structures)
17-
# Import subpackages (reordered for dependency resolution)
18-
# 1. Utils (Foundation)
19-
from . import data, engine, execution, io, ui, utils
20-
from .data import (
31+
from . import data # noqa: E402
32+
from .data import ( # noqa: E402
2133
validate_not_empty,
2234
validate_not_none,
2335
validate_path_exists,
@@ -26,22 +38,10 @@
2638
validate_type,
2739
validation,
2840
)
29-
from .engine import (
30-
SampleStage,
31-
SampleState,
32-
WorkflowManager,
33-
)
34-
from .execution import (
35-
cpu_count,
36-
discover_configs,
37-
discover_functions,
38-
discovery,
39-
parallel,
40-
parallel_batch,
41-
thread_map,
42-
workflow,
43-
)
44-
from .io import (
41+
42+
# 3. IO (Input/Output) - depends on Utils for logging/config
43+
from . import io # noqa: E402
44+
from .io import ( # noqa: E402
4545
atomic_replace,
4646
atomic_write,
4747
cache,
@@ -53,8 +53,8 @@
5353
download_file,
5454
dump_json,
5555
)
56-
from .io import io as io_module
57-
from .io import (
56+
from .io import io as io_module # noqa: E402
57+
from .io import ( # noqa: E402
5858
load_json,
5959
load_yaml,
6060
paths,
@@ -65,24 +65,34 @@
6565
verify_checksum_file,
6666
write_checksum_file,
6767
)
68-
from .ui import (
68+
69+
# 4. Execution (Workflow) - depends on IO and Utils
70+
from . import execution # noqa: E402
71+
from .execution import ( # noqa: E402
72+
cpu_count,
73+
discover_configs,
74+
discover_functions,
75+
discovery,
76+
parallel,
77+
parallel_batch,
78+
thread_map,
79+
workflow,
80+
)
81+
82+
# 5. Engine (Workflow Manager)
83+
from . import engine # noqa: E402
84+
from .engine import ( # noqa: E402
85+
SampleStage,
86+
SampleState,
87+
WorkflowManager,
88+
)
89+
90+
# 6. UI (Terminal Interface)
91+
from . import ui # noqa: E402
92+
from .ui import ( # noqa: E402
6993
ProgressState,
7094
TerminalInterface,
7195
)
72-
from .utils import (
73-
Timer,
74-
config,
75-
errors,
76-
hash,
77-
logging,
78-
optional_deps,
79-
progress,
80-
rate_limiter,
81-
symbols,
82-
text,
83-
timed,
84-
timeout_after,
85-
)
8696

8797
# Optional dependencies
8898
try:

0 commit comments

Comments
 (0)