refactor: Improve compatibility shim for historical imports and enhance module loading
This commit is contained in:
@@ -1,8 +1,38 @@
|
||||
from __future__ import annotations
|
||||
|
||||
"""Package proxy to the development entry module.
|
||||
|
||||
This makes `thechart.main` importable while keeping the app in `src/main.py`.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
"""Compatibility shim for historical `from thechart import main` imports.
|
||||
|
||||
from src.main import * # noqa: F401,F403
|
||||
Delegates to the existing application entrypoint from common locations
|
||||
without forcing a hard dependency on the src layout.
|
||||
"""
|
||||
|
||||
import importlib # noqa: E402
|
||||
|
||||
# Re-export run() and MedTrackerApp from the located main module
|
||||
try:
|
||||
_mod = importlib.import_module("src.main")
|
||||
except Exception:
|
||||
try:
|
||||
_mod = importlib.import_module("main")
|
||||
except Exception: # Fallback to package dispatcher
|
||||
from .__main__ import main as _entry_main # type: ignore
|
||||
|
||||
def run() -> None: # noqa: D401
|
||||
"""Run the application."""
|
||||
|
||||
_entry_main()
|
||||
|
||||
__all__ = ["run"]
|
||||
else:
|
||||
from main import * # type: ignore # noqa: F401,F403
|
||||
|
||||
__all__ = [name for name in dir() if not name.startswith("_")]
|
||||
else:
|
||||
from src.main import * # type: ignore # noqa: F401,F403
|
||||
|
||||
__all__ = [name for name in dir() if not name.startswith("_")]
|
||||
|
||||
Reference in New Issue
Block a user