calliope-project / calliope

A multi-scale energy systems modelling framework
https://www.callio.pe
Apache License 2.0
276 stars 89 forks source link

Improved backend maintainability #630

Closed irm-codebase closed 2 days ago

irm-codebase commented 3 days ago

Fixes #624

Summary of changes in this pull request

Reviewer checklist

codecov[bot] commented 3 days ago

Codecov Report

Attention: Patch coverage is 91.30435% with 4 lines in your changes missing coverage. Please review.

Project coverage is 95.26%. Comparing base (872978d) to head (f3c50b1). Report is 23 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #630 +/- ## ========================================== - Coverage 95.85% 95.26% -0.60% ========================================== Files 24 25 +1 Lines 3619 3671 +52 Branches 788 736 -52 ========================================== + Hits 3469 3497 +28 + Misses 86 84 -2 - Partials 64 90 +26 ``` | [Files](https://app.codecov.io/gh/calliope-project/calliope/pull/630?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=calliope-project) | Coverage Δ | | |---|---|---| | [src/calliope/backend/backend\_model.py](https://app.codecov.io/gh/calliope-project/calliope/pull/630?src=pr&el=tree&filepath=src%2Fcalliope%2Fbackend%2Fbackend_model.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=calliope-project#diff-c3JjL2NhbGxpb3BlL2JhY2tlbmQvYmFja2VuZF9tb2RlbC5weQ==) | `98.09% <100.00%> (+0.18%)` | :arrow_up: | | [src/calliope/backend/latex\_backend\_model.py](https://app.codecov.io/gh/calliope-project/calliope/pull/630?src=pr&el=tree&filepath=src%2Fcalliope%2Fbackend%2Flatex_backend_model.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=calliope-project#diff-c3JjL2NhbGxpb3BlL2JhY2tlbmQvbGF0ZXhfYmFja2VuZF9tb2RlbC5weQ==) | `96.32% <100.00%> (-1.48%)` | :arrow_down: | | [src/calliope/backend/parsing.py](https://app.codecov.io/gh/calliope-project/calliope/pull/630?src=pr&el=tree&filepath=src%2Fcalliope%2Fbackend%2Fparsing.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=calliope-project#diff-c3JjL2NhbGxpb3BlL2JhY2tlbmQvcGFyc2luZy5weQ==) | `96.03% <100.00%> (-1.74%)` | :arrow_down: | | [src/calliope/backend/pyomo\_backend\_model.py](https://app.codecov.io/gh/calliope-project/calliope/pull/630?src=pr&el=tree&filepath=src%2Fcalliope%2Fbackend%2Fpyomo_backend_model.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=calliope-project#diff-c3JjL2NhbGxpb3BlL2JhY2tlbmQvcHlvbW9fYmFja2VuZF9tb2RlbC5weQ==) | `95.60% <100.00%> (+0.18%)` | :arrow_up: | | [src/calliope/model.py](https://app.codecov.io/gh/calliope-project/calliope/pull/630?src=pr&el=tree&filepath=src%2Fcalliope%2Fmodel.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=calliope-project#diff-c3JjL2NhbGxpb3BlL21vZGVsLnB5) | `94.73% <100.00%> (+1.08%)` | :arrow_up: | | [src/calliope/backend/\_\_init\_\_.py](https://app.codecov.io/gh/calliope-project/calliope/pull/630?src=pr&el=tree&filepath=src%2Fcalliope%2Fbackend%2F__init__.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=calliope-project#diff-c3JjL2NhbGxpb3BlL2JhY2tlbmQvX19pbml0X18ucHk=) | `87.50% <87.50%> (ø)` | | | [src/calliope/backend/helper\_functions.py](https://app.codecov.io/gh/calliope-project/calliope/pull/630?src=pr&el=tree&filepath=src%2Fcalliope%2Fbackend%2Fhelper_functions.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=calliope-project#diff-c3JjL2NhbGxpb3BlL2JhY2tlbmQvaGVscGVyX2Z1bmN0aW9ucy5weQ==) | `95.98% <50.00%> (-1.78%)` | :arrow_down: | ... and [3 files with indirect coverage changes](https://app.codecov.io/gh/calliope-project/calliope/pull/630/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=calliope-project)
irm-codebase commented 3 days ago

Today I learned that python's use of TYPE_CHECKING is inconsistent for some cases: https://vickiboykis.com/2023/12/11/why-if-type_checking/

irm-codebase commented 2 days ago

The codeconv issue is likely due to #629. The only added file that has extra code is the backend's __init__.py, and it has 100% coverage.

irm-codebase commented 2 days ago

@brynpickering all fixes are in!