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

♻️ Refactor: Model and Parameters #1135

Merged
merged 45 commits into from
Nov 4, 2022

Conversation

joernweissenborn
Copy link
Member

@joernweissenborn joernweissenborn commented Oct 3, 2022

This PR completely reimplements the model and parameter package.

Instead of using our own homegrown metaprogramming solution from 4 years ago, this change utilizes the battle-proven attrs library and modern python typing (3.10).
This improves the code readability, static type checking and maintainability.

Change summary

  • Complete refactor of model and parameter packages using attrs

Checklist

  • ✔️ Passing the tests (mandatory for all PR's)
  • 🚧 Added changes to changelog (mandatory for all PR's)
  • 👌 Closes issue (mandatory for ✨ feature and 🩹 bug fix PR's)
  • 🧪 Adds new tests for the feature (mandatory for ✨ feature and 🩹 bug fix PR's)
  • 📚 Adds documentation of the feature

Closes issues

closes #917

@joernweissenborn joernweissenborn requested review from jsnel, s-weigand and a team as code owners October 3, 2022 14:26
@github-actions
Copy link
Contributor

github-actions bot commented Oct 3, 2022

Binder 👈 Launch a binder notebook on branch joernweissenborn/pyglotaran/refactor/model_and_parameters

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Oct 3, 2022

Sourcery Code Quality Report

✅  Merging this PR will increase code quality in the affected files by 0.32%.

Quality metrics Before After Change
Complexity 3.35 ⭐ 2.99 ⭐ -0.36 👍
Method Length 71.69 🙂 70.67 🙂 -1.02 👍
Working memory 7.43 🙂 7.83 🙂 0.40 👎
Quality 69.21% 🙂 69.53% 🙂 0.32% 👍
Other metrics Before After Change
Lines 15785 13763 -2022
Changed files Quality Before Quality After Quality Change
benchmark/benchmarks/integration/ex_two_datasets/benchmark.py 90.71% ⭐ 82.35% ⭐ -8.36% 👎
benchmark/pytest/analysis/test_optimization_group.py 80.91% ⭐ 81.17% ⭐ 0.26% 👍
glotaran/builtin/io/pandas/csv.py 79.02% ⭐ 79.27% ⭐ 0.25% 👍
glotaran/builtin/io/pandas/tsv.py 89.66% ⭐ 91.00% ⭐ 1.34% 👍
glotaran/builtin/io/pandas/xlsx.py 86.54% ⭐ 91.00% ⭐ 4.46% 👍
glotaran/builtin/io/pandas/test/test_pandas_parameters.py 74.73% 🙂 74.11% 🙂 -0.62% 👎
glotaran/builtin/io/yml/yml.py 73.74% 🙂 72.30% 🙂 -1.44% 👎
glotaran/builtin/io/yml/test/test_model_parser.py 78.09% ⭐ 79.28% ⭐ 1.19% 👍
glotaran/builtin/io/yml/test/test_save_model.py 93.39% ⭐ 93.39% ⭐ 0.00%
glotaran/builtin/megacomplexes/baseline/baseline_megacomplex.py 87.42% ⭐ 87.42% ⭐ 0.00%
glotaran/builtin/megacomplexes/baseline/test/test_baseline_megacomplex.py 65.20% 🙂 73.12% 🙂 7.92% 👍
glotaran/builtin/megacomplexes/clp_guide/clp_guide_megacomplex.py 89.32% ⭐ 89.32% ⭐ 0.00%
glotaran/builtin/megacomplexes/clp_guide/test/test_clp_guide_megacomplex.py 60.28% 🙂 60.41% 🙂 0.13% 👍
glotaran/builtin/megacomplexes/coherent_artifact/coherent_artifact_megacomplex.py 67.70% 🙂 67.82% 🙂 0.12% 👍
glotaran/builtin/megacomplexes/coherent_artifact/test/test_coherent_artifact.py 44.29% 😞 46.35% 😞 2.06% 👍
glotaran/builtin/megacomplexes/damped_oscillation/damped_oscillation_megacomplex.py 48.13% 😞 52.12% 🙂 3.99% 👍
glotaran/builtin/megacomplexes/damped_oscillation/test/test_doas_model.py 62.36% 🙂 61.86% 🙂 -0.50% 👎
glotaran/builtin/megacomplexes/decay/decay_megacomplex.py 87.43% ⭐ 86.06% ⭐ -1.37% 👎
glotaran/builtin/megacomplexes/decay/decay_parallel_megacomplex.py 89.13% ⭐ 90.19% ⭐ 1.06% 👍
glotaran/builtin/megacomplexes/decay/decay_sequential_megacomplex.py 87.91% ⭐ 90.21% ⭐ 2.30% 👍
glotaran/builtin/megacomplexes/decay/initial_concentration.py 86.86% ⭐ 86.86% ⭐ 0.00%
glotaran/builtin/megacomplexes/decay/irf.py 49.90% 😞 57.01% 🙂 7.11% 👍
glotaran/builtin/megacomplexes/decay/k_matrix.py 77.83% ⭐ 78.60% ⭐ 0.77% 👍
glotaran/builtin/megacomplexes/decay/util.py 54.01% 🙂 54.03% 🙂 0.02% 👍
glotaran/builtin/megacomplexes/decay/test/test_decay_megacomplex.py 57.63% 🙂 55.92% 🙂 -1.71% 👎
glotaran/builtin/megacomplexes/decay/test/test_k_matrix.py 69.68% 🙂 71.96% 🙂 2.28% 👍
glotaran/builtin/megacomplexes/decay/test/test_spectral_irf.py 55.18% 🙂 57.22% 🙂 2.04% 👍
glotaran/builtin/megacomplexes/spectral/shape.py 78.73% ⭐ 80.14% ⭐ 1.41% 👍
glotaran/builtin/megacomplexes/spectral/spectral_megacomplex.py 61.44% 🙂 63.33% 🙂 1.89% 👍
glotaran/builtin/megacomplexes/spectral/test/test_spectral_model.py 58.06% 🙂 54.37% 🙂 -3.69% 👎
glotaran/builtin/megacomplexes/test/test_spectral_decay.py 51.95% 🙂 51.89% 🙂 -0.06% 👎
glotaran/builtin/megacomplexes/test/test_spectral_decay_full_model.py 53.41% 🙂 53.91% 🙂 0.50% 👍
glotaran/builtin/megacomplexes/test/test_spectral_penalties.py 44.83% 😞 42.92% 😞 -1.91% 👎
glotaran/deprecation/modules/builtin_io_yml.py 60.74% 🙂 60.07% 🙂 -0.67% 👎
glotaran/deprecation/modules/test/test_builtin_io_yml.py 65.47% 🙂 65.10% 🙂 -0.37% 👎
glotaran/deprecation/modules/test/test_changed_imports.py 88.92% ⭐ 88.92% ⭐ 0.00%
glotaran/io/interface.py 88.29% ⭐ 88.29% ⭐ 0.00%
glotaran/model/init.py % % %
glotaran/model/clp_penalties.py 64.53% 🙂 89.02% ⭐ 24.49% 👍
glotaran/model/dataset_group.py 76.09% ⭐ 75.28% ⭐ -0.81% 👎
glotaran/model/dataset_model.py 75.36% ⭐ 79.23% ⭐ 3.87% 👍
glotaran/model/item.py 62.16% 🙂 76.53% ⭐ 14.37% 👍
glotaran/model/megacomplex.py 70.71% 🙂 89.75% ⭐ 19.04% 👍
glotaran/model/model.py 66.21% 🙂 77.51% ⭐ 11.30% 👍
glotaran/model/weight.py 79.82% ⭐ 93.03% ⭐ 13.21% 👍
glotaran/model/test/test_dataset_model.py 82.03% ⭐ 74.65% 🙂 -7.38% 👎
glotaran/model/test/test_model.py 72.38% 🙂 70.17% 🙂 -2.21% 👎
glotaran/optimization/data_provider.py 68.15% 🙂 68.17% 🙂 0.02% 👍
glotaran/optimization/estimation_provider.py 64.04% 🙂 63.68% 🙂 -0.36% 👎
glotaran/optimization/matrix_provider.py 65.80% 🙂 66.25% 🙂 0.45% 👍
glotaran/optimization/optimization_group.py 58.95% 🙂 58.96% 🙂 0.01% 👍
glotaran/optimization/test/models.py 78.21% ⭐ 79.55% ⭐ 1.34% 👍
glotaran/optimization/test/suites.py 41.91% 😞 41.92% 😞 0.01% 👍
glotaran/optimization/test/test_constraints.py 65.83% 🙂 65.91% 🙂 0.08% 👍
glotaran/optimization/test/test_data_provider.py 70.57% 🙂 70.55% 🙂 -0.02% 👎
glotaran/optimization/test/test_estimation_provider.py 60.37% 🙂 60.36% 🙂 -0.01% 👎
glotaran/optimization/test/test_matrix_provider.py 61.13% 🙂 61.13% 🙂 0.00%
glotaran/optimization/test/test_multiple_goups.py 52.52% 🙂 52.77% 🙂 0.25% 👍
glotaran/optimization/test/test_optimization.py 38.75% 😞 38.97% 😞 0.22% 👍
glotaran/optimization/test/test_penalties.py 61.41% 🙂 61.47% 🙂 0.06% 👍
glotaran/optimization/test/test_relations.py 62.31% 🙂 62.37% 🙂 0.06% 👍
glotaran/parameter/init.py % 91.38% ⭐ %
glotaran/parameter/parameter.py 82.11% ⭐ 84.91% ⭐ 2.80% 👍
glotaran/parameter/parameter_history.py 92.13% ⭐ 92.13% ⭐ 0.00%
glotaran/parameter/test/test_parameter.py 80.02% ⭐ 78.10% ⭐ -1.92% 👎
glotaran/parameter/test/test_parameter_history.py 70.92% 🙂 70.92% 🙂 0.00%
glotaran/plugin_system/project_io_registration.py 80.01% ⭐ 80.01% ⭐ 0.00%
glotaran/plugin_system/test/test_megacomplex_registration.py 94.21% ⭐ 94.24% ⭐ 0.03% 👍
glotaran/plugin_system/test/test_project_io_registration.py 87.88% ⭐ 87.88% ⭐ 0.00%
glotaran/project/project.py 83.50% ⭐ 83.50% ⭐ 0.00%
glotaran/project/project_parameter_registry.py 64.03% 🙂 65.80% 🙂 1.77% 👍
glotaran/project/result.py 71.83% 🙂 71.83% 🙂 0.00%
glotaran/project/scheme.py 69.99% 🙂 93.37% ⭐ 23.38% 👍
glotaran/project/generators/generator.py 76.75% ⭐ 76.61% ⭐ -0.14% 👎
glotaran/project/generators/test/test_genenerate_decay_model.py 40.29% 😞 43.36% 😞 3.07% 👍
glotaran/project/test/test_project.py 72.81% 🙂 73.04% 🙂 0.23% 👍
glotaran/simulation/simulation.py 57.75% 🙂 57.65% 🙂 -0.10% 👎
glotaran/simulation/test/test_simulation.py 64.49% 🙂 64.25% 🙂 -0.24% 👎
glotaran/testing/test/test_plugin_system.py 87.46% ⭐ 87.52% ⭐ 0.06% 👍

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
glotaran/optimization/test/test_optimization.py test_optimization 19 😞 618 ⛔ 14 😞 26.09% 😞 Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
glotaran/model/item.py item_to_markdown 23 😞 165 😞 16 ⛔ 32.48% 😞 Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
glotaran/builtin/megacomplexes/test/test_spectral_penalties.py test_equal_area_penalties 5 ⭐ 895 ⛔ 16 ⛔ 35.78% 😞 Try splitting into smaller methods. Extract out complex expressions
glotaran/builtin/megacomplexes/decay/util.py calculate_decay_matrix_gaussian_irf 11 🙂 204 😞 18 ⛔ 36.64% 😞 Try splitting into smaller methods. Extract out complex expressions
glotaran/builtin/megacomplexes/decay/irf.py IrfMultiGaussian.parameter 14 🙂 227 ⛔ 13 😞 38.13% 😞 Try splitting into smaller methods. Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us improve this quality report!

@lgtm-com
Copy link
Contributor

lgtm-com bot commented Oct 3, 2022

This pull request introduces 2 alerts and fixes 1 when merging ab66705 into e1467ec - view on LGTM.com

new alerts:

  • 2 for Nested loops with same variable

fixed alerts:

  • 1 for `__eq__` not overridden when adding attributes

@lgtm-com
Copy link
Contributor

lgtm-com bot commented Oct 3, 2022

This pull request introduces 2 alerts and fixes 1 when merging 23e3082 into e1467ec - view on LGTM.com

new alerts:

  • 2 for Nested loops with same variable

fixed alerts:

  • 1 for `__eq__` not overridden when adding attributes

@codecov
Copy link

codecov bot commented Oct 3, 2022

Codecov Report

Base: 87.2% // Head: 87.6% // Increases project coverage by +0.4% 🎉

Coverage data is based on head (3c2006e) compared to base (c8d7722).
Patch coverage: 93.6% of modified lines in pull request are covered.

Additional details and impacted files
@@           Coverage Diff           @@
##            main   #1135     +/-   ##
=======================================
+ Coverage   87.2%   87.6%   +0.4%     
=======================================
  Files        103     103             
  Lines       5274    4899    -375     
  Branches     916     807    -109     
=======================================
- Hits        4599    4292    -307     
+ Misses       527     489     -38     
+ Partials     148     118     -30     
Impacted Files Coverage Δ
glotaran/parameter/__init__.py 50.0% <33.3%> (-50.0%) ⬇️
glotaran/model/interval_item.py 52.6% <52.6%> (ø)
glotaran/parameter/parameter_history.py 93.8% <66.6%> (ø)
glotaran/optimization/data_provider.py 92.3% <71.4%> (+<0.1%) ⬆️
...mped_oscillation/damped_oscillation_megacomplex.py 82.7% <73.0%> (-2.7%) ⬇️
glotaran/builtin/io/yml/yml.py 88.4% <81.8%> (-2.3%) ⬇️
glotaran/utils/attrs_helper.py 83.3% <83.3%> (ø)
glotaran/optimization/estimation_provider.py 90.8% <86.6%> (-0.9%) ⬇️
glotaran/optimization/matrix_provider.py 95.7% <92.0%> (+<0.1%) ⬆️
glotaran/parameter/parameters.py 92.1% <92.1%> (ø)
... and 40 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@lgtm-com
Copy link
Contributor

lgtm-com bot commented Oct 3, 2022

This pull request introduces 2 alerts and fixes 1 when merging 02f732a into e1467ec - view on LGTM.com

new alerts:

  • 2 for Nested loops with same variable

fixed alerts:

  • 1 for `__eq__` not overridden when adding attributes

glotaran/model/item.py Outdated Show resolved Hide resolved
glotaran/model/item.py Outdated Show resolved Hide resolved
glotaran/model/model.py Outdated Show resolved Hide resolved
@s-weigand s-weigand changed the title Refactor: Model and Parameters ♻️ Refactor: Model and Parameters Oct 4, 2022
@joernweissenborn joernweissenborn force-pushed the refactor/model_and_parameters branch from 02f732a to af920c2 Compare October 8, 2022 11:24
@lgtm-com
Copy link
Contributor

lgtm-com bot commented Oct 8, 2022

This pull request introduces 2 alerts and fixes 1 when merging af920c2 into 9d5119c - view on LGTM.com

new alerts:

  • 2 for Nested loops with same variable

fixed alerts:

  • 1 for `__eq__` not overridden when adding attributes

@lgtm-com
Copy link
Contributor

lgtm-com bot commented Oct 8, 2022

This pull request introduces 2 alerts and fixes 1 when merging 5bddb96 into 9d5119c - view on LGTM.com

new alerts:

  • 2 for Nested loops with same variable

fixed alerts:

  • 1 for `__eq__` not overridden when adding attributes

@lgtm-com
Copy link
Contributor

lgtm-com bot commented Oct 8, 2022

This pull request introduces 2 alerts and fixes 1 when merging 14968fe into 9d5119c - view on LGTM.com

new alerts:

  • 2 for Nested loops with same variable

fixed alerts:

  • 1 for `__eq__` not overridden when adding attributes

@github-actions
Copy link
Contributor

github-actions bot commented Oct 8, 2022

Benchmark is done. Checkout the benchmark result page.
Benchmark differences below 5% might be due to CI noise.

Benchmark diff v0.6.0 vs. main

Parametrized benchmark signatures:

BenchmarkOptimize.time_optimize(index_dependent, grouped, weight)

All benchmarks:

       before           after         ratio
     [6c3c390e]       [c8d77224]
     <v0.6.0>                   
+      47.4±0.3ms       88.1±0.9ms     1.86  BenchmarkOptimize.time_optimize(False, False, False)
+      50.3±0.4ms        104±0.4ms     2.06  BenchmarkOptimize.time_optimize(False, False, True)
+      47.1±0.3ms       88.6±0.9ms     1.88  BenchmarkOptimize.time_optimize(False, True, False)
+      50.3±0.5ms          104±1ms     2.07  BenchmarkOptimize.time_optimize(False, True, True)
+      60.8±0.3ms          158±1ms     2.59  BenchmarkOptimize.time_optimize(True, False, False)
+        62.2±2ms          171±1ms     2.75  BenchmarkOptimize.time_optimize(True, False, True)
+      58.8±0.8ms        156±0.8ms     2.66  BenchmarkOptimize.time_optimize(True, True, False)
+       63.0±30ms          172±1ms     2.73  BenchmarkOptimize.time_optimize(True, True, True)
             199M             203M     1.02  IntegrationTwoDatasets.peakmem_optimize
-      1.62±0.07s       1.13±0.05s     0.70  IntegrationTwoDatasets.time_optimize

Benchmark diff main vs. PR

Parametrized benchmark signatures:

BenchmarkOptimize.time_optimize(index_dependent, grouped, weight)

All benchmarks:

       before           after         ratio
     [c8d77224]       [3c2006ed]
!      88.1±0.9ms           failed      n/a  BenchmarkOptimize.time_optimize(False, False, False)
!       104±0.4ms           failed      n/a  BenchmarkOptimize.time_optimize(False, False, True)
!      88.6±0.9ms           failed      n/a  BenchmarkOptimize.time_optimize(False, True, False)
!         104±1ms           failed      n/a  BenchmarkOptimize.time_optimize(False, True, True)
!         158±1ms           failed      n/a  BenchmarkOptimize.time_optimize(True, False, False)
!         171±1ms           failed      n/a  BenchmarkOptimize.time_optimize(True, False, True)
!       156±0.8ms           failed      n/a  BenchmarkOptimize.time_optimize(True, True, False)
!         172±1ms           failed      n/a  BenchmarkOptimize.time_optimize(True, True, True)
             203M             208M     1.02  IntegrationTwoDatasets.peakmem_optimize
       1.13±0.05s       1.21±0.07s     1.07  IntegrationTwoDatasets.time_optimize

@lgtm-com
Copy link
Contributor

lgtm-com bot commented Oct 8, 2022

This pull request introduces 2 alerts and fixes 1 when merging 97503db into 9d5119c - view on LGTM.com

new alerts:

  • 2 for Nested loops with same variable

fixed alerts:

  • 1 for `__eq__` not overridden when adding attributes

@s-weigand
Copy link
Member

@joernweissenborn I temporarily changed the CI to only run python 3.10 so you get feedback from the integration tests.
The EqualAreaPenalty needs a type because examples are failing

@lgtm-com
Copy link
Contributor

lgtm-com bot commented Oct 9, 2022

This pull request introduces 2 alerts and fixes 1 when merging 030a713 into 9d5119c - view on LGTM.com

new alerts:

  • 2 for Nested loops with same variable

fixed alerts:

  • 1 for `__eq__` not overridden when adding attributes

@lgtm-com
Copy link
Contributor

lgtm-com bot commented Oct 9, 2022

This pull request introduces 2 alerts and fixes 1 when merging ef9a765 into 9d5119c - view on LGTM.com

new alerts:

  • 2 for Nested loops with same variable

fixed alerts:

  • 1 for `__eq__` not overridden when adding attributes

@jsnel
Copy link
Member

jsnel commented Oct 12, 2022

As is clear from the previous comments in this PR, the incoming changes effectively require raising the minimum supported Python version from 3.8 to 3.10, due to relying on the improvements to the typing system added in 3.10. After some internal deliberation we have concluded that the benefits this PR bring us (cleaner and more maintainable model definitions) outweigh the cost of dropping 3.8 and 3.9 support, even though these versions are still supported by the wider Python community.

However, for posterity I want to record that we did carefully consider the impact of these changes and don't consider taking such a change lightly. Other than the aforementioned advantages the incoming code changes bring us, our reason for going ahead is two fold:

  • As is clearly indicated in the README, this version of pyglotaran is still unstable (pre 1.0) and major changes (like this) are to be expected. Now is still the time these changes can be made, once we settle on 1.0 that will be different.
  • Right now, very early in adoption by the greater (scientific) community, we are not yet expected to be a library that people depend on to develop their own software against, so we expect minimal inconvenience from this change at this point. Right now the package is expected to be mostly used by end users who can relatively easily install the latest release of Python to try the subsequent release.

Hopefully this provides enough motivation and documentation for the incoming change in supported Python versions. Part of this will also be added to the README.

@jsnel
Copy link
Member

jsnel commented Oct 12, 2022

@s-weigand the two commits to raise the minimum version of Python to 3.10 can be made more permanent (change from ❌ to 🚧 or 🚇 or ⬆️), and add a commit to update the changelog and readme to reflect this change. e.g.:

♻️ Refactored internal Model and Parameter code definition using modern Python 3.10 typing (#1135)
🚧 Dropped support for Python 3.8 and 3.9 and only support 3.10 (#1135)

@s-weigand
Copy link
Member

@jsnel I will add a 💥 BREAKING CHANGE section to the changelog.

@lgtm-com
Copy link
Contributor

lgtm-com bot commented Oct 14, 2022

This pull request introduces 2 alerts and fixes 1 when merging a4b195a into 9d5119c - view on LGTM.com

new alerts:

  • 2 for Nested loops with same variable

fixed alerts:

  • 1 for `__eq__` not overridden when adding attributes

@jsnel jsnel force-pushed the refactor/model_and_parameters branch from b0f646c to 90ac37a Compare November 2, 2022 22:29
@lgtm-com
Copy link
Contributor

lgtm-com bot commented Nov 2, 2022

This pull request introduces 2 alerts and fixes 1 when merging 90ac37a into c8d7722 - view on LGTM.com

new alerts:

  • 2 for Nested loops with same variable

fixed alerts:

  • 1 for `__eq__` not overridden when adding attributes

@jsnel
Copy link
Member

jsnel commented Nov 2, 2022

Issues with some checks not being executed:

Required check from branch protection, which do not get executed anymore

So before we merge we'll fix the branch protection settings.

@lgtm-com
Copy link
Contributor

lgtm-com bot commented Nov 4, 2022

This pull request introduces 2 alerts and fixes 1 when merging a23d15e into c8d7722 - view on LGTM.com

new alerts:

  • 2 for Nested loops with same variable

fixed alerts:

  • 1 for `__eq__` not overridden when adding attributes

The unitest benchmarks are still partially broken since we decided that they are not very informative since they mostly reflect setup time
@lgtm-com
Copy link
Contributor

lgtm-com bot commented Nov 4, 2022

This pull request introduces 2 alerts and fixes 1 when merging c5996bf into c8d7722 - view on LGTM.com

new alerts:

  • 2 for Nested loops with same variable

fixed alerts:

  • 1 for `__eq__` not overridden when adding attributes

s-weigand
s-weigand previously approved these changes Nov 4, 2022
Copy link
Member

@s-weigand s-weigand left a comment

Choose a reason for hiding this comment

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

From my side this is fine to merge.
Thanks @joernweissenborn for making the code a lot more readable and maintainable. 🎉

Fixes redefined-builtin (W0622)
@lgtm-com
Copy link
Contributor

lgtm-com bot commented Nov 4, 2022

This pull request introduces 2 alerts and fixes 1 when merging f96340f into c8d7722 - view on LGTM.com

new alerts:

  • 2 for Nested loops with same variable

fixed alerts:

  • 1 for `__eq__` not overridden when adding attributes

Line added:
♻️ Complete refactor of model and parameter packages using attrs (glotaran#1135)
@sonarqubecloud
Copy link

sonarqubecloud bot commented Nov 4, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 12 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@lgtm-com
Copy link
Contributor

lgtm-com bot commented Nov 4, 2022

This pull request introduces 2 alerts and fixes 1 when merging 3c2006e into c8d7722 - view on LGTM.com

new alerts:

  • 2 for Nested loops with same variable

fixed alerts:

  • 1 for `__eq__` not overridden when adding attributes

Copy link
Member

@jsnel jsnel left a comment

Choose a reason for hiding this comment

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

Added some minor changes from my side, still ok!

@jsnel jsnel merged commit ac99524 into glotaran:main Nov 4, 2022
@s-weigand s-weigand mentioned this pull request Nov 6, 2022
2 tasks
s-weigand added a commit to s-weigand/pyglotaran that referenced this pull request Nov 10, 2022
PR glotaran#1135 changed the colmn names from 'non-negative' -> 'non_negative' and 'standard-error' -> 'standard_error' which causes crashes in load_parameters when reading parameters files that were created before the merge (e.g. 'optimized_parameters.csv').

This change allows reading of those old files, while saving still uses the new version
s-weigand added a commit to s-weigand/pyglotaran that referenced this pull request Nov 12, 2022
PR glotaran#1135 changed the colmn names from 'non-negative' -> 'non_negative' and 'standard-error' -> 'standard_error' which causes crashes in load_parameters when reading parameters files that were created before the merge (e.g. 'optimized_parameters.csv').

This change allows reading of those old files, while saving still uses the new version
jsnel added a commit that referenced this pull request Nov 12, 2022
…1174)

* 🩹 Fix reading of old pandas saved parameters files 

PR #1135 changed the column names from 'non-negative' -> 'non_negative' and 'standard-error' -> 'standard_error' which causes crashes in load_parameters when reading parameters files that were created before the merge (e.g. 'optimized_parameters.csv').

This change allows reading of those old files, while saving still uses the new version

* 🚧📚 Added change to change log
* 🧹 Moved column renaming resposibility to plugin implementation
👌 Allow alternate notation used in yaml for pandas plugins
👌 Make column names case insensitive for pandas plugins
* 🧪 Added unittest for Parameters.from_dataframe column validation
* 🚧📚 Updated changelog with changed PR title
* 🧪Added parameters subset csv test

Co-authored-by: Joris Snellenburg <[email protected]>
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.

Further refactor ModelProperty
3 participants