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

Bad behavior when .nf-core.yml is absent from current directory #3340

Closed
AlexVCaron opened this issue Dec 10, 2024 · 5 comments
Closed

Bad behavior when .nf-core.yml is absent from current directory #3340

AlexVCaron opened this issue Dec 10, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@AlexVCaron
Copy link

AlexVCaron commented Dec 10, 2024

Description of the bug

Basic setup :

  • an empty folder, in which I want to develop a pipeline
  • nf-core/tools installed in the current python environment

Context

Calling install commands for any component, nf-core will first try to identify the directory by finding a .nf-core.yml file. If absent, the command traverses the parent directories to find a base directory that is either a pipeline or a module repository.

Current behavior :

If there is a .nf-core.yml file somewhere there, the command selects the right parent as its base directory, which is valid.

However, if there is none, the command selects the deepest parent in the current directory's tree, which ends up evaluating to / in pretty much all cases, potentially really bad !

Expected behavior :

If no .nf-core.yml file is found, the selected directory should be the current directory.

Cause of the bug :

The bad behavior of determine_base_dir in this current context, caused by this line.

I'd be happy to open a PR and fix this if needed, just tell me ! It would be great however if this fix could patch version 2.14, as my project is bound to it for the time being.

Command used and terminal output

nf-core modules install
nf-core subworkflows install

I can add the terminal output if you need, but it is uninformative (basically tells you it selected / and gives no errors) and I already know where the bug is and how to fix it.

System information

nf-core 2.14.1, but I checked the code and the problem is still present in 3.0.2 and on the master branch

@mirpedrol
Copy link
Member

Hello @AlexVCaron,
Thanks for reporting this!
I see the problem with selecting the root directory, however, install commands are not supposed to be run on an empty directory. You can only install components on a pipeline, so you will want first to run nf-core pipelines create and then nf-core modules install.
We don't do fixes on old releases, but it would be great if you want to contribute by fixing this issue for the current version 🙂

@ewels
Copy link
Member

ewels commented Dec 11, 2024

It would be great however if this fix could patch version 2.14, as my project is bound to it for the time being.

For specifically your project can you not just add the YAML file? Backporting fixes is a lot of work for us, so is only something we'd consider in pretty extreme cases.

@AlexVCaron
Copy link
Author

It would be great however if this fix could patch version 2.14, as my project is bound to it for the time being.

For specifically your project can you not just add the YAML file? Backporting fixes is a lot of work for us, so is only something we'd consider in pretty extreme cases.

I was inquiring, since it touches two close versions. It's no problem, we'll create the file manually for now and add warnings in our doc. Thanks !

@awgymer
Copy link
Contributor

awgymer commented Jan 14, 2025

So, I have wrestled with this method over and over and I was somewhat surprised to see this error reported again after it has been addressed several times:

Issue #2421
PR #2562
Issue #2999
PR #3003

I note that you are on 2.14.1 where that second issue is related to. But it has been verified as fixed in that last PR and I have tested the method on the latest version locally and it correctly returns Path('.') as the default if there is no .nf-core.yml present anywhere in your tree.

I think that, absent an attempt to patch 2.14.1 which I don't believe will happen, this issue can be closed.

@AlexVCaron
Copy link
Author

Thnk you very much ! We are planning to upgrade our stack soon, to get to the latest nf-core version among others. We'll test this once we get there, but I think we can close this issue for now. We'll keep track of this on our side !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants