128 occurrences across 43 files. This pattern is what you write when you're not sure whether the module is being imported as part of a package or as a top‑level script. The cost is:
- Every import does filesystem work twice.
- Genuine
ImportErrors inside your own code are swallowed on the first try and get reported wrong on the second.
- Static analysis tools (pylint, mypy) go crazy.
Fix the packaging (you already have setup.py), run the app as python -m openlens, and delete all of them.
4.6 services.py is present but underused
src/services.py defines LensService / CalculationService / MaterialDatabaseService but most of its methods are bypassed:
openlens.py:123 and the widget handlers mutate Lens directly and then call _save_to_database() on the main window.
src/desensitization.py:156 and src/global_optimizer.py:119,219 call optimize_simplex(...) directly despite AGENTS.md stating "always use optimize()".
Either delete the service layer or actually route work through it. Right now it is a stub that future readers assume is real.
128 occurrences across 43 files. This pattern is what you write when you're not sure whether the module is being imported as part of a package or as a top‑level script. The cost is:
ImportErrors inside your own code are swallowed on the first try and get reported wrong on the second.Fix the packaging (you already have
setup.py), run the app aspython -m openlens, and delete all of them.4.6
services.pyis present but underusedsrc/services.pydefinesLensService/CalculationService/MaterialDatabaseServicebut most of its methods are bypassed:openlens.py:123and the widget handlers mutateLensdirectly and then call_save_to_database()on the main window.src/desensitization.py:156andsrc/global_optimizer.py:119,219calloptimize_simplex(...)directly despiteAGENTS.mdstating "always useoptimize()".Either delete the service layer or actually route work through it. Right now it is a stub that future readers assume is real.