Commit 91830aa
committed
fix: resolve circular import and configure Python source directory
Configuration (pyproject.toml):
- Add [tool.setuptools] with package-dir = {"" = "python"}
- Add mypy_path = "python" to [tool.mypy]
- Tells IDEs that python/ is the source root (not python/rivet_di)
Circular Import Fix (python/rivet_di/decorators.py):
- Import Scope from rivet_di.scope module directly
- Avoids going through rivet_di.__init__.py during import
- Keeps type safety with Scope enum
The issue was that importing 'from rivet_di import Scope' triggers
__init__.py loading, but __init__.py also imports decorators, creating
a cycle. By importing from rivet_di.scope directly, we bypass __init__.py.
All behave tests passing (25/25 steps)1 parent d216da6 commit 91830aa
2 files changed
+6
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
54 | 57 | | |
55 | 58 | | |
56 | 59 | | |
| |||
61 | 64 | | |
62 | 65 | | |
63 | 66 | | |
| 67 | + | |
64 | 68 | | |
65 | 69 | | |
66 | 70 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
0 commit comments