Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve model extension import #2604

Merged
merged 1 commit into from
Nov 28, 2024
Merged

Conversation

dweindl
Copy link
Member

@dweindl dweindl commented Nov 26, 2024

Previously, it wasn't possible to import two model modules with the same name. Now this is at least possible if they are in different locations. Overwriting and importing a previously imported extension is still not supported.

In essence, we avoid using import and sys.modules, and directly import the specific files. For a single file, this works pretty neatly, but for an actual package less so.

Closes #1936

@dweindl dweindl self-assigned this Nov 26, 2024
Copy link

codecov bot commented Nov 26, 2024

Codecov Report

Attention: Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.

Project coverage is 77.60%. Comparing base (4ed131b) to head (759cf39).
Report is 2 commits behind head on develop.

Files with missing lines Patch % Lines
python/sdist/amici/__init__.py 85.71% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #2604      +/-   ##
===========================================
- Coverage    77.61%   77.60%   -0.02%     
===========================================
  Files          329      329              
  Lines        21701    21708       +7     
  Branches      1477     1477              
===========================================
+ Hits         16843    16846       +3     
- Misses        4847     4851       +4     
  Partials        11       11              
Flag Coverage Δ
cpp 73.48% <85.71%> (-0.01%) ⬇️
cpp_python 34.14% <85.71%> (-0.01%) ⬇️
petab 36.95% <85.71%> (-0.02%) ⬇️
python 72.20% <85.71%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
python/sdist/amici/__init__.py 94.11% <85.71%> (-1.34%) ⬇️

... and 2 files with indirect coverage changes

@dweindl dweindl force-pushed the better_import branch 3 times, most recently from 09e1141 to 8ccca39 Compare November 27, 2024 21:40
@dweindl dweindl marked this pull request as ready for review November 27, 2024 21:42
@dweindl dweindl requested a review from a team as a code owner November 27, 2024 21:42
@dweindl dweindl force-pushed the better_import branch 2 times, most recently from 74346e9 to eeafa84 Compare November 27, 2024 22:04
Previously, it wasn't possible to import two model modules with the same name.
Now this is at least possible if they are in different locations.
Overwriting and importing a previously imported extension is still not supported.
@dweindl dweindl merged commit e77fabb into AMICI-dev:develop Nov 28, 2024
17 of 20 checks passed
@dweindl dweindl deleted the better_import branch November 28, 2024 08:42
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.

2 participants