Skip to content

Commit

Permalink
Merge branch 'dev' into fix-1595
Browse files Browse the repository at this point in the history
  • Loading branch information
fabianegli authored May 25, 2022
2 parents 0126c04 + 67b2b48 commit 5b76863
Show file tree
Hide file tree
Showing 46 changed files with 419 additions and 484 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

- Fix bug in pipeline readme logo URL ([#1589](https://github.com/nf-core/tools/issues/1589))

### Linting

- Check that the `.prettierignore` file exists and that starts with the same content.

### General

### Modules
Expand Down
2 changes: 1 addition & 1 deletion docs/api/make_lint_md.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def make_docs(docs_basedir, lint_tests, md_template):
existing_docs.append(os.path.join(docs_basedir, fn))

for test_name in lint_tests:
fn = os.path.join(docs_basedir, "{}.md".format(test_name))
fn = os.path.join(docs_basedir, f"{test_name}.md")
if os.path.exists(fn):
existing_docs.remove(fn)
else:
Expand Down
28 changes: 14 additions & 14 deletions nf_core/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ def run_nf_core():
rich.traceback.install(console=stderr, width=200, word_wrap=True, extra_lines=1)

# Print nf-core header
stderr.print("\n[green]{},--.[grey39]/[green],-.".format(" " * 42), highlight=False)
stderr.print(f"\n[green]{' ' * 42},--.[grey39]/[green],-.", highlight=False)
stderr.print("[blue] ___ __ __ __ ___ [green]/,-._.--~\\", highlight=False)
stderr.print("[blue] |\ | |__ __ / ` / \ |__) |__ [yellow] } {", highlight=False)
stderr.print("[blue] | \| | \__, \__/ | \ |___ [green]\`-._,-`-,", highlight=False)
stderr.print(r"[blue] |\ | |__ __ / ` / \ |__) |__ [yellow] } {", highlight=False)
stderr.print(r"[blue] | \| | \__, \__/ | \ |___ [green]\`-._,-`-,", highlight=False)
stderr.print("[green] `._,._,'\n", highlight=False)
stderr.print(
f"[grey39] nf-core/tools version {nf_core.__version__} - [link=https://nf-co.re]https://nf-co.re[/]",
Expand All @@ -78,11 +78,11 @@ def run_nf_core():
is_outdated, current_vers, remote_vers = nf_core.utils.check_if_outdated()
if is_outdated:
stderr.print(
"[bold bright_yellow] There is a new version of nf-core/tools available! ({})".format(remote_vers),
f"[bold bright_yellow] There is a new version of nf-core/tools available! ({remote_vers})",
highlight=False,
)
except Exception as e:
log.debug("Could not check latest version: {}".format(e))
log.debug(f"Could not check latest version: {e}")
stderr.print("\n")

# Lanch the click cli
Expand Down Expand Up @@ -284,7 +284,7 @@ def create(name, description, author, version, no_git, force, outdir):
"--dir",
type=click.Path(exists=True),
default=".",
help="Pipeline directory [dim]\[default: current working directory][/]",
help=r"Pipeline directory [dim]\[default: current working directory][/]",
)
@click.option(
"--release",
Expand Down Expand Up @@ -401,7 +401,7 @@ def remote(ctx, keywords, json):
"--dir",
type=click.Path(exists=True),
default=".",
help="Pipeline directory. [dim]\[default: Current working directory][/]",
help=r"Pipeline directory. [dim]\[default: Current working directory][/]",
)
def local(ctx, keywords, json, dir):
"""
Expand All @@ -425,7 +425,7 @@ def local(ctx, keywords, json, dir):
"--dir",
type=click.Path(exists=True),
default=".",
help="Pipeline directory. [dim]\[default: current working directory][/]",
help=r"Pipeline directory. [dim]\[default: current working directory][/]",
)
@click.option("-p", "--prompt", is_flag=True, default=False, help="Prompt for the version of the module")
@click.option("-f", "--force", is_flag=True, default=False, help="Force reinstallation of module if it already exists")
Expand Down Expand Up @@ -456,7 +456,7 @@ def install(ctx, tool, dir, prompt, force, sha):
"--dir",
type=click.Path(exists=True),
default=".",
help="Pipeline directory. [dim]\[default: current working directory][/]",
help=r"Pipeline directory. [dim]\[default: current working directory][/]",
)
@click.option("-f", "--force", is_flag=True, default=False, help="Force update of module")
@click.option("-p", "--prompt", is_flag=True, default=False, help="Prompt for the version of the module")
Expand Down Expand Up @@ -505,7 +505,7 @@ def update(ctx, tool, dir, force, prompt, sha, all, preview, save_diff):
"--dir",
type=click.Path(exists=True),
default=".",
help="Pipeline directory. [dim]\[default: current working directory][/]",
help=r"Pipeline directory. [dim]\[default: current working directory][/]",
)
def remove(ctx, dir, tool):
"""
Expand Down Expand Up @@ -627,7 +627,7 @@ def lint(ctx, tool, dir, key, all, local, passed):
"--dir",
type=click.Path(exists=True),
default=".",
help="Pipeline directory. [dim]\[default: Current working directory][/]",
help=r"Pipeline directory. [dim]\[default: Current working directory][/]",
)
def info(ctx, tool, dir):
"""
Expand Down Expand Up @@ -784,7 +784,7 @@ def validate(pipeline, params):
"--dir",
type=click.Path(exists=True),
default=".",
help="Pipeline directory. [dim]\[default: current working directory][/]",
help=r"Pipeline directory. [dim]\[default: current working directory][/]",
)
@click.option("--no-prompts", is_flag=True, help="Do not confirm changes, just update parameters and exit")
@click.option("--web-only", is_flag=True, help="Skip building using Nextflow config, just launch the web tool")
Expand Down Expand Up @@ -886,7 +886,7 @@ def docs(schema_path, output, format, force, columns):
"--dir",
type=click.Path(exists=True),
default=".",
help="Pipeline directory. [dim]\[default: current working directory][/]",
help=r"Pipeline directory. [dim]\[default: current working directory][/]",
)
@click.option(
"-n", "--nextflow", is_flag=True, default=False, help="Bump required nextflow version instead of pipeline version"
Expand Down Expand Up @@ -929,7 +929,7 @@ def bump_version(new_version, dir, nextflow):
"--dir",
type=click.Path(exists=True),
default=".",
help="Pipeline directory. [dim]\[default: current working directory][/]",
help=r"Pipeline directory. [dim]\[default: current working directory][/]",
)
@click.option("-b", "--from-branch", type=str, help="The git branch to use to fetch workflow variables.")
@click.option("-p", "--pull-request", is_flag=True, default=False, help="Make a GitHub pull-request with the changes.")
Expand Down
40 changes: 18 additions & 22 deletions nf_core/bump_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@ def bump_pipeline_version(pipeline_obj, new_version):
if not current_version:
raise UserWarning("Could not find config variable 'manifest.version'")

log.info("Changing version number from '{}' to '{}'".format(current_version, new_version))
log.info(f"Changing version number from '{current_version}' to '{new_version}'")

# nextflow.config - workflow manifest version
update_file_version(
"nextflow.config",
pipeline_obj,
[
(
r"version\s*=\s*[\'\"]?{}[\'\"]?".format(current_version.replace(".", r"\.")),
"version = '{}'".format(new_version),
rf"version\s*=\s*[\'\"]?{re.escape(current_version)}[\'\"]?",
f"version = '{new_version}'",
)
],
)
Expand All @@ -61,16 +61,16 @@ def bump_nextflow_version(pipeline_obj, new_version):
new_version = re.sub(r"^[^0-9\.]*", "", new_version)
if not current_version:
raise UserWarning("Could not find config variable 'manifest.nextflowVersion'")
log.info("Changing Nextlow version number from '{}' to '{}'".format(current_version, new_version))
log.info(f"Changing Nextlow version number from '{current_version}' to '{new_version}'")

# nextflow.config - manifest minimum nextflowVersion
update_file_version(
"nextflow.config",
pipeline_obj,
[
(
r"nextflowVersion\s*=\s*[\'\"]?!>={}[\'\"]?".format(current_version.replace(".", r"\.")),
"nextflowVersion = '!>={}'".format(new_version),
rf"nextflowVersion\s*=\s*[\'\"]?!>={re.escape(current_version)}[\'\"]?",
f"nextflowVersion = '!>={new_version}'",
)
],
)
Expand All @@ -82,8 +82,8 @@ def bump_nextflow_version(pipeline_obj, new_version):
[
(
# example: - NXF_VER: '20.04.0'
r"- NXF_VER: [\'\"]{}[\'\"]".format(current_version.replace(".", r"\.")),
"- NXF_VER: '{}'".format(new_version),
rf"- NXF_VER: [\'\"]{re.escape(current_version)}[\'\"]",
f"- NXF_VER: '{new_version}'",
)
],
)
Expand All @@ -94,17 +94,13 @@ def bump_nextflow_version(pipeline_obj, new_version):
pipeline_obj,
[
(
r"nextflow%20DSL2-%E2%89%A5{}-23aa62.svg".format(current_version.replace(".", r"\.")),
"nextflow%20DSL2-%E2%89%A5{}-23aa62.svg".format(new_version),
rf"nextflow%20DSL2-%E2%89%A5{re.escape(current_version)}-23aa62.svg",
f"nextflow%20DSL2-%E2%89%A5{new_version}-23aa62.svg",
),
(
# example: 1. Install [`Nextflow`](https://www.nextflow.io/docs/latest/getstarted.html#installation) (`>=20.04.0`)
r"1\.\s*Install\s*\[`Nextflow`\]\(https:\/\/www\.nextflow\.io\/docs\/latest\/getstarted\.html#installation\)\s*\(`>={}`\)".format(
current_version.replace(".", r"\.")
),
"1. Install [`Nextflow`](https://www.nextflow.io/docs/latest/getstarted.html#installation) (`>={}`)".format(
new_version
),
rf"1\.\s*Install\s*\[`Nextflow`\]\(https:\/\/www\.nextflow\.io\/docs\/latest\/getstarted\.html#installation\)\s*\(`>={re.escape(current_version)}`\)",
f"1. Install [`Nextflow`](https://www.nextflow.io/docs/latest/getstarted.html#installation) (`>={new_version}`)",
),
],
)
Expand All @@ -130,7 +126,7 @@ def update_file_version(filename, pipeline_obj, patterns):
with open(fn, "r") as fh:
content = fh.read()
except FileNotFoundError:
log.warning("File not found: '{}'".format(fn))
log.warning(f"File not found: '{fn}'")
return

replacements = []
Expand All @@ -142,7 +138,7 @@ def update_file_version(filename, pipeline_obj, patterns):
for line in content.splitlines():

# Match the pattern
matches_pattern = re.findall("^.*{}.*$".format(pattern[0]), line)
matches_pattern = re.findall(rf"^.*{pattern[0]}.*$", line)
if matches_pattern:
found_match = True

Expand All @@ -160,12 +156,12 @@ def update_file_version(filename, pipeline_obj, patterns):
if found_match:
content = "\n".join(newcontent) + "\n"
else:
log.error("Could not find version number in {}: '{}'".format(filename, pattern))
log.error(f"Could not find version number in {filename}: '{pattern}'")

log.info("Updated version in '{}'".format(filename))
log.info(f"Updated version in '{filename}'")
for replacement in replacements:
stderr.print(" [red] - {}".format(replacement[0].strip()), highlight=False)
stderr.print(" [green] + {}".format(replacement[1].strip()), highlight=False)
stderr.print(f" [red] - {replacement[0].strip()}", highlight=False)
stderr.print(f" [green] + {replacement[1].strip()}", highlight=False)
stderr.print("\n")

with open(fn, "w") as fh:
Expand Down
2 changes: 1 addition & 1 deletion nf_core/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def download_pipeline_logo(self, url, img_fn):
except (ConnectionError, UserWarning) as e:
# Something went wrong - try again
log.warning(e)
log.error(f"Connection error - retrying")
log.error("Connection error - retrying")
continue

# Write the new logo to the file
Expand Down
Loading

0 comments on commit 5b76863

Please sign in to comment.