GEOPY-2840: Fix RuntimeWarnings about importing driver module before package#397
Conversation
There was a problem hiding this comment.
Pull request overview
This PR appears to be refactoring package imports from relative imports to fully qualified imports and removing package-level re-exports from many driver subpackages. In this codebase, those __init__.py re-exports are still part of the runtime driver-loading path and public import surface, so the cleanup introduces multiple regressions.
Changes:
- Replaced many local
from .options import ...imports with absolute package imports in driver modules. - Removed package-level re-exports from numerous
__init__.pyfiles across potential fields, EM, electrical, natural-source, and joint drivers. - Simplified a few joint-driver imports while dropping now-unused imports.
Reviewed changes
Copilot reviewed 52 out of 52 changed files in this pull request and generated 18 comments.
Show a summary per file
| File | Description |
|---|---|
| simpeg_drivers/potential_fields/magnetic_vector/inversion.py | Switched options import to absolute path. |
| simpeg_drivers/potential_fields/magnetic_vector/forward.py | Switched options import to absolute path. |
| simpeg_drivers/potential_fields/magnetic_vector/init.py | Removed package re-exports. |
| simpeg_drivers/potential_fields/magnetic_vector_pde/inversion.py | Switched options import to absolute path. |
| simpeg_drivers/potential_fields/magnetic_vector_pde/forward.py | Switched options import to absolute path. |
| simpeg_drivers/potential_fields/magnetic_vector_pde/init.py | Removed package re-exports. |
| simpeg_drivers/potential_fields/magnetic_scalar/inversion.py | Switched options import to absolute path. |
| simpeg_drivers/potential_fields/magnetic_scalar/forward.py | Switched options import to absolute path. |
| simpeg_drivers/potential_fields/magnetic_scalar/init.py | Removed package re-exports. |
| simpeg_drivers/potential_fields/gravity/inversion.py | Switched options import to absolute path. |
| simpeg_drivers/potential_fields/gravity/forward.py | Switched options import to absolute path. |
| simpeg_drivers/potential_fields/gravity/init.py | Removed package re-exports. |
| simpeg_drivers/natural_sources/tipper/inversion.py | Switched options import to absolute path. |
| simpeg_drivers/natural_sources/tipper/forward.py | Switched options import to absolute path. |
| simpeg_drivers/natural_sources/tipper/init.py | Removed package re-exports. |
| simpeg_drivers/natural_sources/magnetotellurics/inversion.py | Switched options import to absolute path. |
| simpeg_drivers/natural_sources/magnetotellurics/forward.py | Switched options import to absolute path. |
| simpeg_drivers/natural_sources/magnetotellurics/init.py | Removed package re-exports. |
| simpeg_drivers/natural_sources/apparent_conductivity/inversion.py | Switched options import to absolute path. |
| simpeg_drivers/natural_sources/apparent_conductivity/forward.py | Switched options import to absolute path. |
| simpeg_drivers/natural_sources/apparent_conductivity/init.py | Removed package re-exports. |
| simpeg_drivers/natural_sources/init.py | Removed top-level natural-sources re-exports. |
| simpeg_drivers/joint/joint_surveys/driver.py | Switched options import to absolute path. |
| simpeg_drivers/joint/joint_surveys/init.py | Removed package re-exports. |
| simpeg_drivers/joint/joint_petrophysics/driver.py | Removed unused import and switched options import. |
| simpeg_drivers/joint/joint_petrophysics/init.py | Removed package re-exports. |
| simpeg_drivers/joint/joint_cross_gradient/driver.py | Switched options import to absolute path. |
| simpeg_drivers/joint/joint_cross_gradient/init.py | Removed package re-exports. |
| simpeg_drivers/electromagnetics/time_domain/inversion.py | Switched options import to absolute path. |
| simpeg_drivers/electromagnetics/time_domain/forward.py | Switched options import to absolute path. |
| simpeg_drivers/electromagnetics/time_domain/init.py | Removed package re-exports. |
| simpeg_drivers/electromagnetics/time_domain_1d/inversion.py | Switched options import to absolute path. |
| simpeg_drivers/electromagnetics/time_domain_1d/forward.py | Switched options import to absolute path. |
| simpeg_drivers/electromagnetics/time_domain_1d/init.py | Removed package re-exports. |
| simpeg_drivers/electromagnetics/frequency_domain/inversion.py | Switched options import to absolute path. |
| simpeg_drivers/electromagnetics/frequency_domain/forward.py | Switched options import to absolute path. |
| simpeg_drivers/electromagnetics/frequency_domain/init.py | Removed package re-exports. |
| simpeg_drivers/electromagnetics/frequency_domain_1d/inversion.py | Switched options import to absolute path. |
| simpeg_drivers/electromagnetics/frequency_domain_1d/forward.py | Switched options import to absolute path. |
| simpeg_drivers/electromagnetics/frequency_domain_1d/init.py | Removed package re-exports. |
| simpeg_drivers/electricals/induced_polarization/two_dimensions/inversion.py | Switched options import to absolute path. |
| simpeg_drivers/electricals/induced_polarization/two_dimensions/forward.py | Switched options import to absolute path. |
| simpeg_drivers/electricals/induced_polarization/two_dimensions/init.py | Removed package re-exports. |
| simpeg_drivers/electricals/induced_polarization/three_dimensions/inversion.py | Switched options import to absolute path. |
| simpeg_drivers/electricals/induced_polarization/three_dimensions/forward.py | Switched options import to absolute path. |
| simpeg_drivers/electricals/induced_polarization/three_dimensions/init.py | Removed package re-exports. |
| simpeg_drivers/electricals/direct_current/two_dimensions/inversion.py | Switched options import to absolute path. |
| simpeg_drivers/electricals/direct_current/two_dimensions/forward.py | Switched options import to absolute path. |
| simpeg_drivers/electricals/direct_current/two_dimensions/init.py | Removed package re-exports. |
| simpeg_drivers/electricals/direct_current/three_dimensions/inversion.py | Switched options import to absolute path. |
| simpeg_drivers/electricals/direct_current/three_dimensions/forward.py | Switched options import to absolute path. |
| simpeg_drivers/electricals/direct_current/three_dimensions/init.py | Removed package re-exports. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -7,11 +7,3 @@ | |||
| # (see LICENSE file at the root of this source code package). ' | |||
| # ' | |||
| # ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' | |||
There was a problem hiding this comment.
Not sure why it's getting flagged for magnetic_scalar only, seems like they're all formatted the same in DRIVER_MAP. I can test scalar mag with 'inversion_type' put back in the ui.json specifically to see if this is actually an issue.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## release/GA_4.8 #397 +/- ##
==================================================
- Coverage 90.42% 90.36% -0.06%
==================================================
Files 129 110 -19
Lines 6577 6527 -50
Branches 825 826 +1
==================================================
- Hits 5947 5898 -49
Misses 416 416
+ Partials 214 213 -1
🚀 New features to boost your workflow:
|
| @@ -7,11 +7,3 @@ | |||
| # (see LICENSE file at the root of this source code package). ' | |||
| # ' | |||
| # ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' | |||
There was a problem hiding this comment.
Not sure why it's getting flagged for magnetic_scalar only, seems like they're all formatted the same in DRIVER_MAP. I can test scalar mag with 'inversion_type' put back in the ui.json specifically to see if this is actually an issue.
GEOPY-2840 - Fix RuntimeWarnings about importing driver module before package