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 update.py #1536

Merged
merged 107 commits into from
Jul 21, 2022
Merged

Conversation

fabianegli
Copy link
Contributor

@fabianegli fabianegli commented Apr 29, 2022

Main edits by @ErikDanielsson

  • Refactor code into methods
  • Always use a temporary directory when updating. This makes the code simpler, and reduces the risk that the files are removed before the update has shown to be successful.

This is a work in progress, do not merge.

Refactoring, bugfixes and other improvements.

PR checklist

  • This comment contains a description of changes (with reason)
  • CHANGELOG.md is updated
  • If you've fixed a bug or added code that should be tested, add tests!
  • Documentation in docs is updated

@codecov
Copy link

codecov bot commented Apr 29, 2022

Codecov Report

Merging #1536 (22f9ca7) into dev (1d427a2) will increase coverage by 0.35%.
The diff coverage is 73.39%.

@@            Coverage Diff             @@
##              dev    #1536      +/-   ##
==========================================
+ Coverage   67.88%   68.24%   +0.35%     
==========================================
  Files          56       56              
  Lines        6677     6694      +17     
==========================================
+ Hits         4533     4568      +35     
+ Misses       2144     2126      -18     
Impacted Files Coverage Δ
nf_core/__main__.py 53.06% <ø> (ø)
nf_core/modules/update.py 73.76% <71.98%> (+8.70%) ⬆️
nf_core/modules/install.py 72.72% <100.00%> (-0.35%) ⬇️
nf_core/modules/modules_json.py 63.13% <100.00%> (-0.13%) ⬇️
nf_core/modules/modules_repo.py 81.52% <100.00%> (+0.23%) ⬆️
nf_core/utils.py 80.48% <100.00%> (+0.11%) ⬆️

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 1d427a2...22f9ca7. Read the comment docs.

@ewels ewels marked this pull request as draft April 30, 2022 05:57
@ewels ewels added the WIP Work in progress label Apr 30, 2022
Copy link
Member

@ewels ewels left a comment

Choose a reason for hiding this comment

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

Just had a quick read through on my phone and all looks good so far 👌🏻 Thanks!

I've converted the PR to a draft. When you're ready for it to be reviewed + merged, drop the label and remove the draft status 👍🏻

nf_core/modules/update.py Outdated Show resolved Hide resolved
@ErikDanielsson
Copy link
Contributor

The main issue with doing it that way is that we need to report the errors in different ways. But I'm still working on it, so I'll have a look on how we can reduce the code bloat.

@ErikDanielsson
Copy link
Contributor

ErikDanielsson commented Jul 20, 2022

Couldn't get_all_modules_info() use get_single_module_info() internally?

It is convenient when reporting skipped and overridden directories in get_all_modules_info due to entries in the .nf-core.yml to loop through the file at the repo level. We could not do this as easy if we were to try to reuse the code from get_single_module_info. Therefore I don't think it is worth to change currently.

@ErikDanielsson ErikDanielsson marked this pull request as ready for review July 20, 2022 14:15
@ErikDanielsson
Copy link
Contributor

I think this PR is mature enough now to be merged. update.py might benefint from more refactoring in the future, but I think this is good start at least.

@fabianegli fabianegli removed the WIP Work in progress label Jul 20, 2022
CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
@fabianegli
Copy link
Contributor Author

The docs are out of date: https://nf-co.re/tools/#update-modules-in-a-pipeline

Copy link
Member

@mirpedrol mirpedrol 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, thanks!

@ErikDanielsson
Copy link
Contributor

Great, thanks for the review! Are you happy merging @fabianegli?

@fabianegli
Copy link
Contributor Author

Yes, I think it is fine now. Thank you @mirpedrol for the review and @ErikDanielsson for the refactoring.

@ErikDanielsson ErikDanielsson merged commit f8eb445 into nf-core:dev Jul 21, 2022
@fabianegli fabianegli deleted the fabianegli-update-refactor branch July 21, 2022 16:19
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.

6 participants