Skip to content

GEOPY-2840: Fix RuntimeWarnings about importing driver module before package#397

Merged
domfournier merged 7 commits into
release/GA_4.8from
GEOPY-2840
May 7, 2026
Merged

GEOPY-2840: Fix RuntimeWarnings about importing driver module before package#397
domfournier merged 7 commits into
release/GA_4.8from
GEOPY-2840

Conversation

@domfournier
Copy link
Copy Markdown
Collaborator

@domfournier domfournier commented May 5, 2026

GEOPY-2840 - Fix RuntimeWarnings about importing driver module before package

Copilot AI review requested due to automatic review settings May 5, 2026 17:06
@github-actions github-actions Bot changed the title GEOPY-2840 GEOPY-2840: Fix RuntimeWarnings about importing driver module before package May 5, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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__.py files 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.

Comment thread simpeg_drivers/potential_fields/gravity/__init__.py
@@ -7,11 +7,3 @@
# (see LICENSE file at the root of this source code package). '
# '
# '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread simpeg_drivers/potential_fields/magnetic_vector/__init__.py
Comment thread simpeg_drivers/potential_fields/magnetic_vector_pde/__init__.py
Comment thread simpeg_drivers/natural_sources/apparent_conductivity/__init__.py
Comment thread simpeg_drivers/joint/joint_cross_gradient/__init__.py
@codecov
Copy link
Copy Markdown

codecov Bot commented May 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.36%. Comparing base (8bdfcd7) to head (96982b2).

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     
Files with missing lines Coverage Δ
...tricals/direct_current/three_dimensions/forward.py 70.00% <100.00%> (ø)
...icals/direct_current/three_dimensions/inversion.py 70.00% <100.00%> (ø)
...ectricals/direct_current/two_dimensions/forward.py 72.72% <100.00%> (ø)
...tricals/direct_current/two_dimensions/inversion.py 72.72% <100.00%> (ø)
...s/induced_polarization/three_dimensions/forward.py 70.00% <100.00%> (ø)
...induced_polarization/three_dimensions/inversion.py 70.00% <100.00%> (ø)
...als/induced_polarization/two_dimensions/forward.py 72.72% <100.00%> (ø)
...s/induced_polarization/two_dimensions/inversion.py 72.72% <100.00%> (ø)
...ivers/electromagnetics/frequency_domain/forward.py 75.00% <100.00%> (ø)
...ers/electromagnetics/frequency_domain/inversion.py 70.00% <100.00%> (ø)
... and 24 more

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

benk-mira
benk-mira previously approved these changes May 6, 2026
@@ -7,11 +7,3 @@
# (see LICENSE file at the root of this source code package). '
# '
# '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@domfournier domfournier merged commit 2ff14af into release/GA_4.8 May 7, 2026
16 of 17 checks passed
@domfournier domfournier deleted the GEOPY-2840 branch May 7, 2026 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants