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 nf-core modules commands work with arbitrary git remotes #1724

Merged
merged 11 commits into from
Aug 3, 2022

Conversation

ErikDanielsson
Copy link
Contributor

As @awgymer reported in #1721, several of the nf-core modules commands depended on that git remotes had the same format as in GitHub, i.e. owner/repo. This meant that the commands failed when repo names of greater nesting were used, for example group/subgroup/repo.

I've fixed this by letting the modules.json file be the only source of information for what modules are installed in a pipeline -- the commands should not need to interact with the directory structure directly.

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

@ErikDanielsson ErikDanielsson changed the title Make nf-core modules command work with repostories of greater nesting Make nf-core modules command work with arbitrary git remotes Aug 3, 2022
@ErikDanielsson ErikDanielsson changed the title Make nf-core modules command work with arbitrary git remotes Make nf-core modules commands work with arbitrary git remotes Aug 3, 2022
@codecov
Copy link

codecov bot commented Aug 3, 2022

Codecov Report

Merging #1724 (b88a423) into dev (a9d0665) will decrease coverage by 0.06%.
The diff coverage is 70.14%.

@@            Coverage Diff             @@
##              dev    #1724      +/-   ##
==========================================
- Coverage   68.29%   68.23%   -0.07%     
==========================================
  Files          59       59              
  Lines        7063     7071       +8     
==========================================
+ Hits         4824     4825       +1     
- Misses       2239     2246       +7     
Impacted Files Coverage Δ
nf_core/modules/list.py 71.23% <ø> (-0.39%) ⬇️
nf_core/modules/info.py 17.16% <12.50%> (+0.24%) ⬆️
nf_core/modules/module_test.py 53.33% <50.00%> (-1.47%) ⬇️
nf_core/modules/modules_command.py 84.00% <60.00%> (-3.81%) ⬇️
nf_core/lint/modules_json.py 80.76% <80.00%> (+0.76%) ⬆️
nf_core/modules/modules_json.py 65.52% <80.00%> (+0.78%) ⬆️
nf_core/modules/lint/__init__.py 82.98% <87.50%> (+0.01%) ⬆️
nf_core/modules/install.py 72.36% <100.00%> (-0.36%) ⬇️
nf_core/modules/patch.py 81.48% <100.00%> (ø)
nf_core/modules/remove.py 83.87% <100.00%> (+3.31%) ⬆️
... and 1 more

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

@awgymer
Copy link
Contributor

awgymer commented Aug 3, 2022

When trying --branch non-standard-path (which I have just created and pushed to test base-path) I am getting:

ERROR    Branch 'non-standard-path' not found in '<repo>'

@awgymer
Copy link
Contributor

awgymer commented Aug 3, 2022

FWIW the <repo> in the error message above is just the dirname part? i.e. org/group/name without any url parts

@ErikDanielsson
Copy link
Contributor Author

When trying --branch non-standard-path (which I have just created and pushed to test base-path) I am getting:

ERROR    Branch 'non-standard-path' not found in '<repo>'

Are you able to create and work with a branch where you've not changed the base-path?

@awgymer
Copy link
Contributor

awgymer commented Aug 3, 2022

So I did some debugging and when it was doing the call to branch_exists, self.repo.branches contained only master.
I had to add a self.repo.git.fetch before the checkout and it worked fine. I suspect this may be a caching issue or something?

@awgymer
Copy link
Contributor

awgymer commented Aug 3, 2022

Not sure if this is intended/expected, and may be outside the scope of this PR, but list with non-standard path/branch has some issues.

modules list local

...

WARNING  Repository '<repo>' (master) does not contain the 'othermods' directory

Message and Date are listed as Not Available in the table.
Passing both the branch and path gave the same error.

Leaving out the path resulted in:

CRITICAL Repository '<repo>' (non-standard-path) does not contain the 'modules' directory

@ErikDanielsson
Copy link
Contributor Author

Yes, put it in an issue and I'll have a look at it this afternoon

@ErikDanielsson
Copy link
Contributor Author

The issues mentioned should've been address elsewhere, so this PR should be ready for review now

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.

The code looks good to me, only a couple of suggestions :)
I am not sure how to test this functionality, so if @awgymer is happy with it I think we can merge

nf_core/modules/modules_command.py Outdated Show resolved Hide resolved
if module is None:
module = questionary.autocomplete(
"Tool name:", choices=self.module_names[repo_name], style=nf_core.utils.nfcore_question_style
"Tool name:",
choices=self.modules_from_repo(repo_name),
Copy link
Member

Choose a reason for hiding this comment

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

I think this line should change in the other commands also, is that right?
For example the one from patch.py is failing

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 you are right, thanks! Though it seems like patch.py was the only one I missed, I've updated it now.

ErikDanielsson and others added 2 commits August 3, 2022 16:35
Co-authored-by: Júlia Mir Pedrol <mirp.julia@gmail.com>
@awgymer
Copy link
Contributor

awgymer commented Aug 3, 2022

I am not sure how to test this functionality, so if @awgymer is happy with it I think we can merge

The things I have tried so far all seem to be working.

@ErikDanielsson ErikDanielsson merged commit da1f79f into nf-core:dev Aug 3, 2022
@ErikDanielsson
Copy link
Contributor Author

Thanks @awgymer for testing and @mirpedrol for reviewing!

@ErikDanielsson ErikDanielsson deleted the git-remote-agnostic branch August 3, 2022 15:03
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.

modules list doesn't work for custom remotes with a subproject
3 participants