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

Dump template yml to file in pipeline repo after creation #2189

Merged
merged 6 commits into from
Mar 27, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions nf_core/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def __init__(
plain=False,
default_branch=None,
):
self.template_params, skip_paths_keys = self.create_param_dict(
self.template_params, skip_paths_keys, self.template_yaml = self.create_param_dict(
name, description, author, version, template_yaml_path, plain
)

Expand Down Expand Up @@ -178,7 +178,7 @@ def create_param_dict(self, name, description, author, version, template_yaml_pa
if not re.match(r"^[a-z]+$", param_dict["short_name"]):
raise UserWarning("[red]Invalid workflow name: must be lowercase without punctuation.")

return param_dict, skip_paths
return param_dict, skip_paths, template_yaml

def customize_template(self, template_areas):
"""Customizes the template parameters.
Expand Down Expand Up @@ -348,6 +348,11 @@ def render_template(self):
# Update the .nf-core.yml with linting configurations
self.fix_linting()

log.debug("Dumping pipeline template yml to file")
if self.template_yaml:
with open(self.outdir / "pipeline_template.yml", "w") as fh:
yaml.safe_dump(self.template_yaml, fh)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
yaml.safe_dump(self.template_yaml, fh)
yaml.safe_dump(self.template_yaml, fh)
run_prettier_on_file(fh.name)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So this should only trigger when a template_yml is either supplied (which perhaps is silly) or someone customises something on the CLI.

Currently there are no tests which mock passing information in via the CLI prompts that I'm aware of. Happy to try adding them but not sure if it's best done as a unit-test or as part of one of the fuller tests defined in the GH actions?


def update_nextflow_schema(self):
"""
Removes unused parameters from the nextflow schema.
Expand Down