From 078fde1861ac0969cbbcdec4a05888bfca517934 Mon Sep 17 00:00:00 2001 From: kevinmenden Date: Mon, 10 May 2021 12:07:53 +0200 Subject: [PATCH 01/11] add new version to template --- nf_core/bump_version.py | 8 +++++++- nf_core/pipeline-template/README.md | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/nf_core/bump_version.py b/nf_core/bump_version.py index 28e3f9eeaa..ef2068a65f 100644 --- a/nf_core/bump_version.py +++ b/nf_core/bump_version.py @@ -159,7 +159,13 @@ def bump_nextflow_version(pipeline_obj, new_version): ( r"nextflow-%E2%89%A5{}-brightgreen.svg".format(current_version.replace(".", r"\.")), "nextflow-%E2%89%A5{}-brightgreen.svg".format(new_version), - ) + ), + ( + r"1. Install [`nextflow`](https://nf-co.re/usage/installation) (`>={}`)".format( + current_version.replace(".", r"\.") + ), + "1. Install [`nextflow`](https://nf-co.re/usage/installation) (`>={}`)".format(new_version), + ), ], ) diff --git a/nf_core/pipeline-template/README.md b/nf_core/pipeline-template/README.md index 9adcfb0aac..311472a287 100644 --- a/nf_core/pipeline-template/README.md +++ b/nf_core/pipeline-template/README.md @@ -19,7 +19,7 @@ The pipeline is built using [Nextflow](https://www.nextflow.io), a workflow tool ## Quick Start -1. Install [`nextflow`](https://nf-co.re/usage/installation) +1. Install [`nextflow`](https://nf-co.re/usage/installation) (`>=21.04.0`) 2. Install any of [`Docker`](https://docs.docker.com/engine/installation/), [`Singularity`](https://www.sylabs.io/guides/3.0/user-guide/), [`Podman`](https://podman.io/), [`Shifter`](https://nersc.gitlab.io/development/shifter/how-to-use/) or [`Charliecloud`](https://hpc.github.io/charliecloud/) for full pipeline reproducibility _(please only use [`Conda`](https://conda.io/miniconda.html) as a last resort; see [docs](https://nf-co.re/usage/configuration#basic-configuration-profiles))_ From 60840fc46db877b3157d331f64cbf83fa8bd9e4f Mon Sep 17 00:00:00 2001 From: kevinmenden Date: Mon, 10 May 2021 14:11:05 +0200 Subject: [PATCH 02/11] fixed ci.yml nxf version --- nf_core/bump_version.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nf_core/bump_version.py b/nf_core/bump_version.py index ef2068a65f..31aa4ed79e 100644 --- a/nf_core/bump_version.py +++ b/nf_core/bump_version.py @@ -145,7 +145,7 @@ def bump_nextflow_version(pipeline_obj, new_version): pipeline_obj, [ ( - r"nxf_ver: \[[\'\"]?{}[\'\"]?, ''\]".format(current_version.replace(".", r"\.")), + r"nxf_ver: \[[\'\"]?{}[\'\"]?, [\'\"]?[\'\"]?\]".format(current_version.replace(".", r"\.")), "nxf_ver: ['{}', '']".format(new_version), ) ], @@ -161,7 +161,7 @@ def bump_nextflow_version(pipeline_obj, new_version): "nextflow-%E2%89%A5{}-brightgreen.svg".format(new_version), ), ( - r"1. Install [`nextflow`](https://nf-co.re/usage/installation) (`>={}`)".format( + r"1.\s*Install\s*\[[\'\"]?nextflow[\'\"]?\]\(https://nf-co.re/usage/installation\)\s*\([\'\"]?>={}[\'\"]?\)".format( current_version.replace(".", r"\.") ), "1. Install [`nextflow`](https://nf-co.re/usage/installation) (`>={}`)".format(new_version), From 9b4f716bf62aba615922e88dc9487b97de25976a Mon Sep 17 00:00:00 2001 From: Phil Ewels Date: Mon, 10 May 2021 14:36:40 +0200 Subject: [PATCH 03/11] Bump version - refactor matching into loop --- nf_core/bump_version.py | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/nf_core/bump_version.py b/nf_core/bump_version.py index 31aa4ed79e..55332563fe 100644 --- a/nf_core/bump_version.py +++ b/nf_core/bump_version.py @@ -196,18 +196,31 @@ def update_file_version(filename, pipeline_obj, patterns): replacements = [] for pattern in patterns: - # Check that we have a match - matches_pattern = re.findall("^.*{}.*$".format(pattern[0]), content, re.MULTILINE) - if len(matches_pattern) == 0: - log.error("Could not find version number in {}: '{}'".format(filename, pattern)) - continue + found_match = False + + newcontent = [] + for line in content.splitlines(): + + # Match the pattern + matches_pattern = re.findall("^.*{}.*$".format(pattern[0]), line) + if matches_pattern: + found_match = True - # Replace the match - content = re.sub(pattern[0], pattern[1], content) - matches_newstr = re.findall("^.*{}.*$".format(pattern[1]), content, re.MULTILINE) + # Replace the match + newline = re.sub(pattern[0], pattern[1], line) + newcontent.append(newline) - # Save for logging - replacements.append((matches_pattern, matches_newstr)) + # Save for logging + replacements.append((line, newline)) + + # No match, keep line as it is + else: + newcontent.append(line) + + if found_match: + content = "\n".join(newcontent) + else: + log.error("Could not find version number in {}: '{}'".format(filename, pattern)) log.info("Updated version in '{}'".format(filename)) for replacement in replacements: From ce1c2c93eab6543eef8f21dd7855dfc351f4bc8d Mon Sep 17 00:00:00 2001 From: Phil Ewels Date: Mon, 10 May 2021 14:40:40 +0200 Subject: [PATCH 04/11] Attempt to fix without testing locally --- nf_core/bump_version.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/nf_core/bump_version.py b/nf_core/bump_version.py index 55332563fe..89ff062d85 100644 --- a/nf_core/bump_version.py +++ b/nf_core/bump_version.py @@ -224,9 +224,8 @@ def update_file_version(filename, pipeline_obj, patterns): log.info("Updated version in '{}'".format(filename)) for replacement in replacements: - for idx, matched in enumerate(replacement[0]): - stderr.print(" [red] - {}".format(matched.strip()), highlight=False) - stderr.print(" [green] + {}".format(replacement[1][idx].strip()), highlight=False) + stderr.print(" [red] - {}".format(replacement[0].strip()), highlight=False) + stderr.print(" [green] + {}".format(replacement[1].strip()), highlight=False) stderr.print("\n") with open(fn, "w") as fh: From 2f7be42c6b957e5cc26934078cda382fbb8710ae Mon Sep 17 00:00:00 2001 From: kevinmenden Date: Mon, 10 May 2021 14:49:16 +0200 Subject: [PATCH 05/11] fix readme regex --- nf_core/bump_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nf_core/bump_version.py b/nf_core/bump_version.py index 89ff062d85..d570090845 100644 --- a/nf_core/bump_version.py +++ b/nf_core/bump_version.py @@ -161,7 +161,7 @@ def bump_nextflow_version(pipeline_obj, new_version): "nextflow-%E2%89%A5{}-brightgreen.svg".format(new_version), ), ( - r"1.\s*Install\s*\[[\'\"]?nextflow[\'\"]?\]\(https://nf-co.re/usage/installation\)\s*\([\'\"]?>={}[\'\"]?\)".format( + r"1.\s*Install\s*\[`nextflow`\]\(https://nf-co.re/usage/installation\)\s*\(`>={}`\)".format( current_version.replace(".", r"\.") ), "1. Install [`nextflow`](https://nf-co.re/usage/installation) (`>={}`)".format(new_version), From ced197d3f818b6626b8cf692946094d94b2fb32d Mon Sep 17 00:00:00 2001 From: kevinmenden Date: Mon, 10 May 2021 14:57:32 +0200 Subject: [PATCH 06/11] updated changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a250b2d626..b6dd3642c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ * Fix overly strict `--max_time` formatting regex in template schema [[#973](https://github.com/nf-core/tools/issues/973)] * Added `tool_name_underscore` to the module template to allow TOOL_SUBTOOL in `main.nf` [[#1011](https://github.com/nf-core/tools/issues/1011)] * Convert `d` to `day` in the `cleanParameters` function to make Duration objects like `2d` pass the validation [[#858](https://github.com/nf-core/tools/issues/858)] +* Added nextflow version to quick start section and adjusted `nf-core bump-version` [[#1032](https://github.com/nf-core/tools/issues/1032)] ## [v1.13.3 - Copper Crocodile Resurrection :crocodile:](https://github.com/nf-core/tools/releases/tag/1.13.2) - [2021-03-24] From 2fa026512b6cf06eb029c9a9bfaac3a2b1741082 Mon Sep 17 00:00:00 2001 From: kevinmenden Date: Mon, 10 May 2021 14:57:45 +0200 Subject: [PATCH 07/11] markdown --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b6dd3642c6..24b6732e2d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,7 +31,7 @@ * Fix overly strict `--max_time` formatting regex in template schema [[#973](https://github.com/nf-core/tools/issues/973)] * Added `tool_name_underscore` to the module template to allow TOOL_SUBTOOL in `main.nf` [[#1011](https://github.com/nf-core/tools/issues/1011)] * Convert `d` to `day` in the `cleanParameters` function to make Duration objects like `2d` pass the validation [[#858](https://github.com/nf-core/tools/issues/858)] -* Added nextflow version to quick start section and adjusted `nf-core bump-version` [[#1032](https://github.com/nf-core/tools/issues/1032)] +* Added nextflow version to quick start section and adjusted `nf-core bump-version` [[#1032](https://github.com/nf-core/tools/issues/1032)] ## [v1.13.3 - Copper Crocodile Resurrection :crocodile:](https://github.com/nf-core/tools/releases/tag/1.13.2) - [2021-03-24] From a82eaecb80ed7c2d28883e99fd8090d997e2f36c Mon Sep 17 00:00:00 2001 From: kevinmenden Date: Mon, 10 May 2021 15:10:35 +0200 Subject: [PATCH 08/11] added regex example comments --- nf_core/bump_version.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nf_core/bump_version.py b/nf_core/bump_version.py index d570090845..2ac3fd4c0d 100644 --- a/nf_core/bump_version.py +++ b/nf_core/bump_version.py @@ -145,6 +145,7 @@ def bump_nextflow_version(pipeline_obj, new_version): pipeline_obj, [ ( + # example: nxf_ver: ['20.04.0', ''] r"nxf_ver: \[[\'\"]?{}[\'\"]?, [\'\"]?[\'\"]?\]".format(current_version.replace(".", r"\.")), "nxf_ver: ['{}', '']".format(new_version), ) @@ -161,6 +162,7 @@ def bump_nextflow_version(pipeline_obj, new_version): "nextflow-%E2%89%A5{}-brightgreen.svg".format(new_version), ), ( + # example: 1. Install [`nextflow`](https://nf-co.re/usage/installation) (`>=20.04.0`) r"1.\s*Install\s*\[`nextflow`\]\(https://nf-co.re/usage/installation\)\s*\(`>={}`\)".format( current_version.replace(".", r"\.") ), From 14e2e117bd7f64c6dfed46f6e259aa99f8f7cb32 Mon Sep 17 00:00:00 2001 From: kevinmenden Date: Mon, 10 May 2021 15:31:09 +0200 Subject: [PATCH 09/11] remove question marks --- nf_core/bump_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nf_core/bump_version.py b/nf_core/bump_version.py index 2ac3fd4c0d..9a15ace594 100644 --- a/nf_core/bump_version.py +++ b/nf_core/bump_version.py @@ -146,7 +146,7 @@ def bump_nextflow_version(pipeline_obj, new_version): [ ( # example: nxf_ver: ['20.04.0', ''] - r"nxf_ver: \[[\'\"]?{}[\'\"]?, [\'\"]?[\'\"]?\]".format(current_version.replace(".", r"\.")), + r"nxf_ver: \[[\'\"]{}[\'\"], [\'\"][\'\"]\]".format(current_version.replace(".", r"\.")), "nxf_ver: ['{}', '']".format(new_version), ) ], From 91962e1d7f58d9a801334181f3ce5f71ce1fb361 Mon Sep 17 00:00:00 2001 From: Kevin Menden Date: Mon, 10 May 2021 16:04:42 +0200 Subject: [PATCH 10/11] Update nf_core/bump_version.py Co-authored-by: Phil Ewels --- nf_core/bump_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nf_core/bump_version.py b/nf_core/bump_version.py index 9a15ace594..f566215111 100644 --- a/nf_core/bump_version.py +++ b/nf_core/bump_version.py @@ -163,7 +163,7 @@ def bump_nextflow_version(pipeline_obj, new_version): ), ( # example: 1. Install [`nextflow`](https://nf-co.re/usage/installation) (`>=20.04.0`) - r"1.\s*Install\s*\[`nextflow`\]\(https://nf-co.re/usage/installation\)\s*\(`>={}`\)".format( + r"1.\s*Install\s*\[`nextflow`\]\(https://nf-co\.re/usage/installation\)\s*\(`>={}`\)".format( current_version.replace(".", r"\.") ), "1. Install [`nextflow`](https://nf-co.re/usage/installation) (`>={}`)".format(new_version), From 26b4d613ba7d56b8ec3d447a57a24fea596eca48 Mon Sep 17 00:00:00 2001 From: kevinmenden Date: Mon, 10 May 2021 16:05:10 +0200 Subject: [PATCH 11/11] escape dot --- nf_core/bump_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nf_core/bump_version.py b/nf_core/bump_version.py index f566215111..70ac2312c2 100644 --- a/nf_core/bump_version.py +++ b/nf_core/bump_version.py @@ -163,7 +163,7 @@ def bump_nextflow_version(pipeline_obj, new_version): ), ( # example: 1. Install [`nextflow`](https://nf-co.re/usage/installation) (`>=20.04.0`) - r"1.\s*Install\s*\[`nextflow`\]\(https://nf-co\.re/usage/installation\)\s*\(`>={}`\)".format( + r"1\.\s*Install\s*\[`nextflow`\]\(https://nf-co\.re/usage/installation\)\s*\(`>={}`\)".format( current_version.replace(".", r"\.") ), "1. Install [`nextflow`](https://nf-co.re/usage/installation) (`>={}`)".format(new_version),