Fix object import - #1738
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors module lazy-loading in ramble.repository by replacing ObjectNamespace and RepositoryNamespace with a unified RambleNamespace class, and switching from import to importlib.import_module. It also adds corresponding unit tests. The feedback highlights an issue where catching all ImportError exceptions and raising AttributeError masks nested import errors within the imported modules. It is recommended to only raise AttributeError if the ImportError matches the target submodule name, allowing other import errors to propagate.
Ramble Performance Test MetricsResults produced with commit: 660da65
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #1738 +/- ##
===========================================
+ Coverage 94.07% 94.10% +0.02%
===========================================
Files 370 370
Lines 37424 37432 +8
===========================================
+ Hits 35207 35225 +18
+ Misses 2217 2207 -10 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@linsword13 LGTM. Some merge conflicts need resolving though |
e2d03a1 to
9afcd34
Compare
Thanks! Should be resolved now. |
9afcd34 to
265fa3a
Compare
Previously things like `import ... as` is not supported. Change to use `importlib` to support such standard access patterns. Also unify the previous `ObjectNamespace` and `RepositoryNamespace`, into a single `RambleNamespace`. Signed-off-by: Lin Guo <linsword13@gmail.com>
265fa3a to
660da65
Compare
Previously things like
import ... asis not supported. Change to useimportlibto support such standard access patterns.Also unify the previous
ObjectNamespaceandRepositoryNamespace, into a singleRambleNamespace.