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

Modules remove patch #2216

Merged
merged 10 commits into from
Apr 25, 2023
Merged

Modules remove patch #2216

merged 10 commits into from
Apr 25, 2023

Conversation

awgymer
Copy link
Contributor

@awgymer awgymer commented Mar 28, 2023

#1920

This is an initial commit of an example of how we could achieve this using exisiting functionality to apply a patch in reverse.

Would need significant improvements in error-handling.
May be better to do an update on the current sha?

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

@awgymer awgymer marked this pull request as draft March 28, 2023 10:40
@codecov
Copy link

codecov bot commented Mar 28, 2023

Codecov Report

❗ No coverage uploaded for pull request base (dev@e2ef749). Click here to learn what that means.
The diff coverage is 71.69%.

@@          Coverage Diff           @@
##             dev    #2216   +/-   ##
======================================
  Coverage       ?   72.98%           
======================================
  Files          ?       77           
  Lines          ?     8396           
  Branches       ?        0           
======================================
  Hits           ?     6128           
  Misses         ?     2268           
  Partials       ?        0           
Impacted Files Coverage Δ
nf_core/__main__.py 59.83% <40.00%> (ø)
nf_core/modules/modules_json.py 79.92% <66.66%> (ø)
nf_core/modules/patch.py 79.04% <76.92%> (ø)

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

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 very good! :) Maybe we could add a recommendation to lint the module after that? And also an option to force the remove and skip the questionary.

os.rmdir(temp_module_dir)

# Remove patch file
patch_path.unlink()
Copy link
Member

Choose a reason for hiding this comment

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

I would catch possible errors here before removing it from modules.json

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, error handling needs to be added for sure!

@awgymer
Copy link
Contributor Author

awgymer commented Mar 29, 2023

I've added some code to check if the reverted module matches the code for the known sha and if it doesn't we suggest a reinstall.
Still think this process is quite messy and not sure if deleting the patch and removing from the JSON followed by a reinstall would be better?

Not sure what the best way to write a test for this is either.

@mirpedrol
Copy link
Member

Even if it would be the easiest, I think we should avoid reinstalling because we could lose track from the "installed_by" in modules.json
Regarding tests, we are already testing applying a reverse patch, so I would only test if this function deletes the file and removes it from modules.json.

@awgymer awgymer marked this pull request as ready for review April 25, 2023 13:06
@awgymer awgymer changed the title Draft: Modules remove patch Modules remove patch Apr 25, 2023
@awgymer
Copy link
Contributor Author

awgymer commented Apr 25, 2023

Failure due to an API rate-limit issue. Tests for 3.9 all passed though. Could I get a re-review on the test I implemented please @mirpedrol

@awgymer awgymer requested a review from mirpedrol April 25, 2023 13:47
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.

LGTM when tests pass 🙂 thanks!

@awgymer awgymer merged commit 40c41c5 into nf-core:dev Apr 25, 2023
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.

2 participants