Subcategory: Overall architecture
Score: 7 → 9 (target)
The import graph has a layer inversion: core/server.py (lower layer) imports the api layer.
src/pycharting/core/server.py:201 — create_app() does a deferred from pycharting.api.routes import router to mount API routes. The function-local import is the classic "break the cycle" smell; app composition belongs at a top-level composition root, not in core.
- Shared mutable module globals couple modules through global state:
_data_managers (api/routes.py:26) and _active_server (api/interface.py:32).
No true import cycle exists today, but the dependency direction is inverted.
Suggested fix: move router-mounting/app assembly to a dedicated composition module (or __init__), and encapsulate the session registry behind an object rather than a module global.
Done when: no module under src/pycharting/core/ imports pycharting.api (deferred or otherwise).
Subcategory: Overall architecture
Score: 7 → 9 (target)
The import graph has a layer inversion:
core/server.py(lower layer) imports theapilayer.src/pycharting/core/server.py:201—create_app()does a deferredfrom pycharting.api.routes import routerto mount API routes. The function-local import is the classic "break the cycle" smell; app composition belongs at a top-level composition root, not incore._data_managers(api/routes.py:26) and_active_server(api/interface.py:32).No true import cycle exists today, but the dependency direction is inverted.
Suggested fix: move router-mounting/app assembly to a dedicated composition module (or
__init__), and encapsulate the session registry behind an object rather than a module global.Done when: no module under
src/pycharting/core/importspycharting.api(deferred or otherwise).