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

nf-core pipelines sync overwrites newly generated .nf-core.yml content #3391

Open
awgymer opened this issue Jan 9, 2025 · 0 comments
Open
Labels
bug Something isn't working

Comments

@awgymer
Copy link
Contributor

awgymer commented Jan 9, 2025

Description of the bug

When we first create a pipeline we add a lint section to .nf-core.yml with all the correct checks ignored for the chosen skipped template sections.

When we do a sync this method runs and if you have updated the skipped sections (added or removed any) then fix_linting is called again and the updated lint section is written to the .nf-core.yml file in the TEMPLATE branch.

However at the end of the sync call we then update the .nf-core.yml based on the CreateConfig object in pipeline_create_obj.config. source code

This overwrites the already written updated whole config with the config from before the new template update and just updates the template subsection of it with the new config for that.

I believe the solution here is to replace the linked source above like so:

Current:

# set force to false to avoid overwriting files in the future
if self.config_yml.template is not None:
    self.config_yml.template = pipeline_create_obj.config
    # Set force true in config to overwrite existing files
    self.config_yml.template.force = False
    # Set outdir as the current directory to avoid local info leaking
    self.config_yml.template.outdir = "."
    # Update nf-core version
    self.config_yml.nf_core_version = nf_core.__version__
    dump_yaml_with_prettier(self.config_yml_path, self.config_yml.model_dump(exclude_none=True))

New:

# Load the updated config
_, updated_config = nf_core.utils.load_tools_config(self.pipeline_dir)
# set force to false to avoid overwriting files in the future
if updated_config.template is not None:
    updated_config.template = pipeline_create_obj.config
    # Set force true in config to overwrite existing files
    updated_config.template.force = False
    # Set outdir as the current directory to avoid local info leaking
    updated_config.template.outdir = "."
    # Update nf-core version
    updated_config.nf_core_version = nf_core.__version__
    dump_yaml_with_prettier(self.config_yml_path, updated_config.model_dump(exclude_none=True))

Command used and terminal output

System information

nf-core/tools v3.1.1

@awgymer awgymer added the bug Something isn't working label Jan 9, 2025
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

1 participant