From c0049b08c18c9c442cd6d370376e855e1f5c0fda Mon Sep 17 00:00:00 2001 From: Adam Talbot Date: Wed, 5 Oct 2022 12:03:49 +0000 Subject: [PATCH] NF-Core Sync includes template.yaml as option Fixes #1879 --- nf_core/__main__.py | 5 +++-- nf_core/create.py | 1 + nf_core/sync.py | 5 +++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/nf_core/__main__.py b/nf_core/__main__.py index 9df0b2ff97..461a901ec9 100755 --- a/nf_core/__main__.py +++ b/nf_core/__main__.py @@ -1054,7 +1054,8 @@ def bump_version(new_version, dir, nextflow): @click.option("-p", "--pull-request", is_flag=True, default=False, help="Make a GitHub pull-request with the changes.") @click.option("-g", "--github-repository", type=str, help="GitHub PR: target repository.") @click.option("-u", "--username", type=str, help="GitHub PR: auth username.") -def sync(dir, from_branch, pull_request, github_repository, username): +@click.option("-t", "--template-yaml", help="Pass a YAML file to customize the template") +def sync(dir, from_branch, pull_request, github_repository, username, template_yaml): """ Sync a pipeline [cyan i]TEMPLATE[/] branch with the nf-core template. @@ -1071,7 +1072,7 @@ def sync(dir, from_branch, pull_request, github_repository, username): nf_core.utils.is_pipeline_directory(dir) # Sync the given pipeline dir - sync_obj = nf_core.sync.PipelineSync(dir, from_branch, pull_request, github_repository, username) + sync_obj = nf_core.sync.PipelineSync(dir, from_branch, pull_request, github_repository, username, template_yaml) try: sync_obj.sync() except (nf_core.sync.SyncException, nf_core.sync.PullRequestException) as e: diff --git a/nf_core/create.py b/nf_core/create.py index 1cd4fecba0..8b028d90af 100644 --- a/nf_core/create.py +++ b/nf_core/create.py @@ -39,6 +39,7 @@ class PipelineCreate(object): force (bool): Overwrites a given workflow directory with the same name. Defaults to False. May the force be with you. outdir (str): Path to the local output directory. + template_yaml (str): Path to template.yml file for pipeline creation settings. """ def __init__( diff --git a/nf_core/sync.py b/nf_core/sync.py index a663f1c7a7..365d6d1371 100644 --- a/nf_core/sync.py +++ b/nf_core/sync.py @@ -52,6 +52,7 @@ class PipelineSync(object): required_config_vars (list): List of nextflow variables required to make template pipeline gh_username (str): GitHub username gh_repo (str): GitHub repository name + template_yaml (str): Path to template.yml file for pipeline creation settings. """ def __init__( @@ -61,6 +62,7 @@ def __init__( make_pr=False, gh_repo=None, gh_username=None, + template_yaml_path=None, ): """Initialise syncing object""" @@ -77,6 +79,8 @@ def __init__( self.gh_repo = gh_repo self.pr_url = "" + self.template_yaml_path = template_yaml_path + # Set up the API auth if supplied on the command line self.gh_api = nf_core.utils.gh_api self.gh_api.lazy_init() @@ -233,6 +237,7 @@ def make_template_pipeline(self): force=True, outdir=self.pipeline_dir, author=self.wf_config["manifest.author"].strip('"').strip("'"), + template_yaml_path=self.template_yaml_path, plain=True, ).init_pipeline()