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

👌 Make PreProcessingPipeline methods return a new instance #1263

Merged
merged 2 commits into from
Mar 8, 2023

Conversation

s-weigand
Copy link
Member

@s-weigand s-weigand commented Mar 5, 2023

This changes the behavior of methods on PreProcessingPipeline to be closer to how pandas or xarray work (object creation instead of in place mutation), which makes it more intuitive and prevents accidental state changes in the pipeline (e.g. executing a cell in a notebook that does not include the instantiation multiple times).

Change summary

Checklist

  • ✔️ Passing the tests (mandatory for all PR's)
  • 🚧 Added changes to changelog (mandatory for all PR's)

This changes the behaviour to be closer to how pandas or xarray work and prevents accidental state changes in the pipeline
@s-weigand s-weigand requested review from jsnel and a team as code owners March 5, 2023 17:38
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Mar 5, 2023

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 0.12 ⭐ 0.16 ⭐ 0.04 👎
Method Length 39.60 ⭐ 41.56 ⭐ 1.96 👎
Working memory 4.35 ⭐ 4.39 ⭐ 0.04 👎
Quality 90.45% 90.29% -0.16% 👎
Other metrics Before After Change
Lines 114 106 -8
Changed files Quality Before Quality After Quality Change
glotaran/io/preprocessor/pipeline.py 93.92% ⭐ 92.60% ⭐ -1.32% 👎
glotaran/io/preprocessor/test/test_preprocessor.py 88.58% ⭐ 89.18% ⭐ 0.60% 👍

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

File Function Complexity Length Working Memory Quality Recommendation

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!

@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2023

Binder 👈 Launch a binder notebook on branch s-weigand/pyglotaran/better-pre-process-pipeline

@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2023

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]       [a1290e7c]
     <v0.6.0>                   
!      41.3±0.1ms           failed      n/a  BenchmarkOptimize.time_optimize(False, False, False)
!      43.8±0.3ms           failed      n/a  BenchmarkOptimize.time_optimize(False, False, True)
!      41.3±0.1ms           failed      n/a  BenchmarkOptimize.time_optimize(False, True, False)
!      44.0±0.2ms           failed      n/a  BenchmarkOptimize.time_optimize(False, True, True)
!      51.4±0.4ms           failed      n/a  BenchmarkOptimize.time_optimize(True, False, False)
!       92.1±40ms           failed      n/a  BenchmarkOptimize.time_optimize(True, False, True)
!      50.9±0.4ms           failed      n/a  BenchmarkOptimize.time_optimize(True, True, False)
!       96.1±20ms           failed      n/a  BenchmarkOptimize.time_optimize(True, True, True)
             205M             211M     1.03  IntegrationTwoDatasets.peakmem_optimize
-      1.83±0.02s       1.02±0.02s     0.56  IntegrationTwoDatasets.time_optimize

Benchmark diff main vs. PR

Parametrized benchmark signatures:

BenchmarkOptimize.time_optimize(index_dependent, grouped, weight)

All benchmarks:

       before           after         ratio
     [a1290e7c]       [73b9dde7]
           failed           failed      n/a  BenchmarkOptimize.time_optimize(False, False, False)
           failed           failed      n/a  BenchmarkOptimize.time_optimize(False, False, True)
           failed           failed      n/a  BenchmarkOptimize.time_optimize(False, True, False)
           failed           failed      n/a  BenchmarkOptimize.time_optimize(False, True, True)
           failed           failed      n/a  BenchmarkOptimize.time_optimize(True, False, False)
           failed           failed      n/a  BenchmarkOptimize.time_optimize(True, False, True)
           failed           failed      n/a  BenchmarkOptimize.time_optimize(True, True, False)
           failed           failed      n/a  BenchmarkOptimize.time_optimize(True, True, True)
             211M             210M     1.00  IntegrationTwoDatasets.peakmem_optimize
       1.02±0.02s         987±30ms     0.97  IntegrationTwoDatasets.time_optimize

@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 5, 2023

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 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@codecov
Copy link

codecov bot commented Mar 5, 2023

Codecov Report

Patch coverage: 100.0% and project coverage change: -0.1 ⚠️

Comparison is base (a1290e7) 88.4% compared to head (73b9dde) 88.4%.

Additional details and impacted files
@@           Coverage Diff           @@
##            main   #1263     +/-   ##
=======================================
- Coverage   88.4%   88.4%   -0.1%     
=======================================
  Files        107     107             
  Lines       5151    5147      -4     
  Branches     854     854             
=======================================
- Hits        4554    4550      -4     
  Misses       479     479             
  Partials     118     118             
Impacted Files Coverage Δ
glotaran/io/preprocessor/pipeline.py 100.0% <100.0%> (ø)

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.

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.

Looks good to me.

@jsnel jsnel requested a review from joernweissenborn March 5, 2023 20:04
@s-weigand s-weigand merged commit 8ae0eb5 into glotaran:main Mar 8, 2023
@s-weigand s-weigand deleted the better-pre-process-pipeline branch March 8, 2023 12:17
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