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

👌 Add SavingOptions to save_result API #966

Merged
merged 11 commits into from
Jan 24, 2022

Conversation

s-weigand
Copy link
Member

@s-weigand s-weigand commented Jan 24, 2022

My take on #874 😝

The main difference is data_filter is applied on the save_result level instead of adding an unused keyword to all save_dataset methods.
I also deprecated the legacy plugin and made folder throw a warning when not used from inside another plugin, thus promoting yml to the goto save_result plugin, which will make the transition to project easier.
The folder plugin now also doesn't save model.yml nor scheme.yml, that way it can easier be reused in different plugins.

Change summary

  • 🚧 Salvage parts of PR 874
  • 🧪 Removed part of a test which fails and should fail
  • 👌 Restored wanted functionality
  • 👌 Homogenized save_result return value to always be a list of strings
  • 👌 Properly reexport functionality from glotaran.deprecation
  • 🗑️ Deprecated save_result legacy plugin and made folder plugin internal use only

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)

Closes issues

closes #874

@s-weigand s-weigand requested review from jsnel and a team as code owners January 24, 2022 02:07
@github-actions
Copy link
Contributor

Binder 👈 Launch a binder notebook on branch s-weigand/pyglotaran/improve-saving-options

@codecov
Copy link

codecov bot commented Jan 24, 2022

Codecov Report

Merging #966 (c3a7d19) into main (707c227) will increase coverage by 0.2%.
The diff coverage is 100.0%.

Impacted file tree graph

@@           Coverage Diff           @@
##            main    #966     +/-   ##
=======================================
+ Coverage   85.3%   85.6%   +0.2%     
=======================================
  Files         90      90             
  Lines       4859    4883     +24     
  Branches     913     916      +3     
=======================================
+ Hits        4149    4181     +32     
+ Misses       561     552      -9     
- Partials     149     150      +1     
Impacted Files Coverage Δ
glotaran/builtin/io/folder/folder_plugin.py 100.0% <100.0%> (+2.3%) ⬆️
glotaran/builtin/io/yml/yml.py 90.2% <100.0%> (+1.6%) ⬆️
glotaran/deprecation/__init__.py 100.0% <100.0%> (ø)
glotaran/io/__init__.py 100.0% <100.0%> (ø)
glotaran/io/interface.py 100.0% <100.0%> (ø)
glotaran/plugin_system/io_plugin_utils.py 100.0% <100.0%> (ø)
glotaran/plugin_system/project_io_registration.py 100.0% <100.0%> (ø)
glotaran/project/result.py 88.4% <100.0%> (+7.0%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 707c227...c3a7d19. Read the comment docs.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 24, 2022

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

Benchmark diff v0.5.1 vs. main

Parametrized benchmark signatures:

BenchmarkOptimize.time_optimize(index_dependent, grouped, weight)

All benchmarks:

       before           after         ratio
     [96b42630]       [c3a7d195]
     <v0.5.1>                   
       61.5±0.7ms       60.7±0.4ms     0.99  BenchmarkOptimize.time_optimize(False, False, False)
        66.9±10ms         68.5±3ms     1.02  BenchmarkOptimize.time_optimize(False, False, True)
       61.2±0.5ms         62.0±1ms     1.01  BenchmarkOptimize.time_optimize(False, True, False)
         66.1±2ms        71.4±20ms     1.08  BenchmarkOptimize.time_optimize(False, True, True)
         75.6±3ms         76.2±2ms     1.01  BenchmarkOptimize.time_optimize(True, False, False)
         82.6±2ms         80.6±1ms     0.98  BenchmarkOptimize.time_optimize(True, False, True)
       74.5±0.5ms       74.8±0.3ms     1.00  BenchmarkOptimize.time_optimize(True, True, False)
        87.2±30ms         81.5±6ms     0.93  BenchmarkOptimize.time_optimize(True, True, True)
             202M             199M     0.99  IntegrationTwoDatasets.peakmem_optimize
       2.13±0.02s       2.01±0.03s     0.95  IntegrationTwoDatasets.time_optimize

Benchmark diff main vs. PR

Parametrized benchmark signatures:

BenchmarkOptimize.time_optimize(index_dependent, grouped, weight)

All benchmarks:

       before           after         ratio
     [707c227c]       [c3a7d195]
         61.1±1ms       60.7±0.4ms     0.99  BenchmarkOptimize.time_optimize(False, False, False)
        74.2±30ms         68.5±3ms     0.92  BenchmarkOptimize.time_optimize(False, False, True)
       61.4±0.6ms         62.0±1ms     1.01  BenchmarkOptimize.time_optimize(False, True, False)
         68.9±4ms        71.4±20ms     1.04  BenchmarkOptimize.time_optimize(False, True, True)
         76.3±1ms         76.2±2ms     1.00  BenchmarkOptimize.time_optimize(True, False, False)
         83.4±5ms         80.6±1ms     0.97  BenchmarkOptimize.time_optimize(True, False, True)
         74.8±1ms       74.8±0.3ms     1.00  BenchmarkOptimize.time_optimize(True, True, False)
         81.6±2ms         81.5±6ms     1.00  BenchmarkOptimize.time_optimize(True, True, True)
             207M             199M     0.96  IntegrationTwoDatasets.peakmem_optimize
       2.01±0.08s       2.01±0.03s     1.00  IntegrationTwoDatasets.time_optimize

Copy link
Member

@joernweissenborn joernweissenborn left a comment

Choose a reason for hiding this comment

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

lgtm

jsnel
jsnel previously approved these changes Jan 24, 2022
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.

Reviewed ok.

@s-weigand s-weigand dismissed stale reviews from jsnel and joernweissenborn via 72ca809 January 24, 2022 20:27
@s-weigand s-weigand force-pushed the improve-saving-options branch from 3b1ffe8 to 72ca809 Compare January 24, 2022 20:27
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Jan 24, 2022

Sourcery Code Quality Report

❌  Merging this PR will decrease code quality in the affected files by 1.08%.

Quality metrics Before After Change
Complexity 1.53 ⭐ 1.81 ⭐ 0.28 👎
Method Length 36.33 ⭐ 37.98 ⭐ 1.65 👎
Working memory 5.50 ⭐ 5.65 ⭐ 0.15 👎
Quality 84.95% 83.87% -1.08% 👎
Other metrics Before After Change
Lines 2118 2332 214
Changed files Quality Before Quality After Quality Change
glotaran/builtin/io/folder/folder_plugin.py 59.69% 🙂 60.66% 🙂 0.97% 👍
glotaran/builtin/io/folder/test/test_folder_plugin.py 87.00% ⭐ 76.49% ⭐ -10.51% 👎
glotaran/builtin/io/yml/yml.py 77.86% ⭐ 76.54% ⭐ -1.32% 👎
glotaran/builtin/io/yml/test/test_save_result.py 87.74% ⭐ 86.56% ⭐ -1.18% 👎
glotaran/deprecation/init.py % 96.84% ⭐ %
glotaran/io/init.py 87.99% ⭐ 87.99% ⭐ 0.00%
glotaran/io/interface.py 97.71% ⭐ 92.39% ⭐ -5.32% 👎
glotaran/plugin_system/io_plugin_utils.py 85.22% ⭐ 85.22% ⭐ 0.00%
glotaran/plugin_system/project_io_registration.py 83.86% ⭐ 84.70% ⭐ 0.84% 👍
glotaran/plugin_system/test/test_io_plugin_utils.py 94.79% ⭐ 94.79% ⭐ 0.00%
glotaran/plugin_system/test/test_project_io_registration.py 90.24% ⭐ 90.16% ⭐ -0.08% 👎
glotaran/project/result.py 77.52% ⭐ 77.38% ⭐ -0.14% 👎
glotaran/project/test/test_result.py 93.62% ⭐ 82.73% ⭐ -10.89% 👎

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

File Function Complexity Length Working Memory Quality Recommendation
glotaran/builtin/io/yml/yml.py YmlProjectIo.save_model 15 🙂 106 🙂 13 😞 48.93% 😞 Extract out complex expressions
glotaran/project/result.py Result.markdown 6 ⭐ 173 😞 13 😞 49.52% 😞 Try splitting into smaller methods. Extract out complex expressions
glotaran/builtin/io/folder/folder_plugin.py FolderProjectIo.save_result 6 ⭐ 199 😞 8 🙂 56.82% 🙂 Try splitting into smaller methods
glotaran/plugin_system/project_io_registration.py save_result 2 ⭐ 67 🙂 12 😞 68.19% 🙂 Extract out complex expressions
glotaran/plugin_system/project_io_registration.py save_model 2 ⭐ 58 ⭐ 10 😞 73.22% 🙂 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!

@sonarqubecloud
Copy link

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 1 Code Smell

No Coverage information No Coverage information
0.9% 0.9% Duplication

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