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

Dev -> Master for v2.7.2 #2136

Merged
merged 51 commits into from
Dec 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
51587c0
bump to v2.8dev
mirpedrol Dec 8, 2022
f8eab49
Merge pull request #2113 from mirpedrol/2.8dev
mirpedrol Dec 8, 2022
60e7cc5
Merge branch 'master' of https://github.com/nf-core/tools into dev
mirpedrol Dec 8, 2022
46317bd
fix github_output syntax
mirpedrol Dec 8, 2022
78d4a25
update changelog
mirpedrol Dec 8, 2022
67e3702
Merge pull request #2114 from mirpedrol/github-output
mirpedrol Dec 9, 2022
0d7925b
Return from get_username and make sure it is assigned back to self.au…
awgymer Dec 9, 2022
2cd002c
allow specifying only one container
mirpedrol Dec 9, 2022
96826eb
modify changelog
mirpedrol Dec 9, 2022
3dc4052
Merge pull request #2120 from awgymer/fix-component-author
awgymer Dec 9, 2022
a8cc7d9
Ensure call to load_tools_config expects tuple return
awgymer Dec 9, 2022
94a03a1
Merge pull request #2122 from awgymer/fix-lint-pipeline-name
awgymer Dec 12, 2022
a85b896
check only one container per line
mirpedrol Dec 12, 2022
2b96d32
Merge branch 'dev' of https://github.com/nf-core/tools into dev
mirpedrol Dec 12, 2022
6a7da79
only check pipeline name without dashes if the name is provided by pr…
mirpedrol Dec 12, 2022
bc44d2e
Merge pull request #2121 from mirpedrol/dev
mirpedrol Dec 12, 2022
ffc3bd3
Merge branch 'dev' of https://github.com/nf-core/tools into dev
mirpedrol Dec 12, 2022
d97e116
Merge branch 'dev' of https://github.com/mirpedrol/tools into dashed-…
mirpedrol Dec 12, 2022
f05b06e
run prettier after dumping a json schema file
mirpedrol Dec 12, 2022
a0f5d56
modify changelog
mirpedrol Dec 12, 2022
5ccbae8
update changelog
mirpedrol Dec 12, 2022
ed9cbb4
Merge pull request #2123 from mirpedrol/dashed-name
ewels Dec 13, 2022
e9e039a
add newline before table 🤞🏻
mashehu Dec 13, 2022
e3d987e
Update README.md
mashehu Dec 13, 2022
5338afb
[automated] Fix code linting
nf-core-bot Dec 13, 2022
6e7f87a
Update README.md
mashehu Dec 13, 2022
e178898
Merge pull request #2128 from mashehu/fix-table-in-readme
mashehu Dec 13, 2022
47b4252
Apply suggestions from code review
mirpedrol Dec 13, 2022
8d083d4
merge branch dev
mirpedrol Dec 14, 2022
6eb4664
add json.dump into a helper function
mirpedrol Dec 14, 2022
10b2b7f
Merge pull request #2124 from mirpedrol/prettier-json-schema
mirpedrol Dec 15, 2022
433e5b2
remove params.enable_conda
mirpedrol Dec 15, 2022
547076b
add params.enable_conda to deprecated vars
mirpedrol Dec 15, 2022
d9be489
update CHANGELOG
mirpedrol Dec 15, 2022
4cf1fdc
update pipeline template modules
mirpedrol Dec 15, 2022
c83965d
fix test
mirpedrol Dec 15, 2022
3b2f53d
fix test
mirpedrol Dec 15, 2022
8acc9d6
Revert unique() syntax change. Closes #2132
ewels Dec 15, 2022
ee6725a
Merge pull request #2133 from ewels/revert-unique-change
ewels Dec 16, 2022
ccdd515
Merge branch 'dev' of https://github.com/nf-core/tools into handle-js…
mirpedrol Dec 16, 2022
8ce4d17
handle json exception
mirpedrol Dec 16, 2022
67c3656
handle all json-load exceptions
mirpedrol Dec 16, 2022
1625014
update CHANGELOG
mirpedrol Dec 16, 2022
632b675
remove handling from linting as it's already handled later
mirpedrol Dec 16, 2022
32bf4aa
Merge branch 'dev' of https://github.com/nf-core/tools into conda-enable
mirpedrol Dec 16, 2022
0cb35e6
check conda channels as it's done in rnaseq
mirpedrol Dec 16, 2022
81fc966
remove params.enable_conda from modules template
mirpedrol Dec 16, 2022
b33d0c7
Merge pull request #2131 from mirpedrol/conda-enable
drpatelh Dec 16, 2022
d45b8e3
Merge pull request #2134 from mirpedrol/handle-json-exception
mirpedrol Dec 17, 2022
02acf65
bump to 2.7.2 for patch release
mirpedrol Dec 19, 2022
9e6b67f
Merge pull request #2135 from mirpedrol/bump-2.7.2
mirpedrol Dec 19, 2022
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
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# nf-core/tools: Changelog

## [v2.7.2 - Mercury Eagle Patch](https://github.com/nf-core/tools/releases/tag/2.7.2) - [2022-12-19]

### Template

- Fix the syntax of github_output in GitHub actions ([#2114](https://github.com/nf-core/tools/pull/2114))
- Fix a bug introduced in 2.7 that made pipelines hang ([#2132](https://github.com/nf-core/tools/issues/2132))

### Linting

- Allow specifying containers in less than three lines ([#2121](https://github.com/nf-core/tools/pull/2121))
- Run prettier after dumping a json schema file ([#2124](https://github.com/nf-core/tools/pull/2124))
mashehu marked this conversation as resolved.
Show resolved Hide resolved

### General

- Only check that a pipeline name doesn't contain dashes if the name is provided by prompt of `--name`. Don't check if a template file is used. ([#2123](https://github.com/nf-core/tools/pull/2123))
- Deprecate `--enable_conda` parameter. Use `conda.enable` instead ([#2131](https://github.com/nf-core/tools/pull/2131))
- Handle `json.load()` exceptions ([#2134](https://github.com/nf-core/tools/pull/2134))

## [v2.7.1 - Mercury Eagle Patch](https://github.com/nf-core/tools/releases/tag/2.7.1) - [2022-12-08]

- Patch release to fix pipeline sync ([#2110](https://github.com/nf-core/tools/pull/2110))
Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,12 @@ Please refer to the respective documentation for further details to manage packa
### Activate shell completions for nf-core/tools

Auto-completion for the `nf-core` command is available for bash, zsh and fish. To activate it, add the following lines to the respective shell config files.
shell | shell config file | command
--- | --- | ---
bash | ~/.bashrc | `eval "$(_NF_CORE_COMPLETE=bash_source nf-core)"`
Zsh | ~/.zshrc | `eval "$(_NF_CORE_COMPLETE=zsh_source nf-core)"`
fish | ~/.config/fish/completions/nf-core.fish | `eval (env _NF_CORE_COMPLETE=fish_source nf-core)`

| shell | shell config file | command |
| ----- | ----------------------------------------- | -------------------------------------------------- |
| bash | `~/.bashrc` | `eval "$(_NF_CORE_COMPLETE=bash_source nf-core)"` |
| zsh | `~/.zshrc` | `eval "$(_NF_CORE_COMPLETE=zsh_source nf-core)"` |
| fish | `~/.config/fish/completions/nf-core.fish` | `eval (env _NF_CORE_COMPLETE=fish_source nf-core)` |

After a restart of the shell session you should have auto-completion for the `nf-core` command and all its sub-commands and options.

Expand Down
2 changes: 2 additions & 0 deletions nf_core/components/components_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,5 @@ def get_username(author):
f"[violet]GitHub Username:[/]{' (@author)' if author_default is None else ''}",
default=author_default,
)

return author
9 changes: 5 additions & 4 deletions nf_core/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,16 +166,17 @@ def create_param_dict(self, name, description, author, version, template_yaml_pa
param_dict["logo_dark"] = f"{param_dict['name_noslash']}_logo_dark.png"
param_dict["version"] = version

config_yml = nf_core.utils.load_tools_config()
_, config_yml = nf_core.utils.load_tools_config()
if (
"lint" in config_yml
and "nextflow_config" in config_yml["lint"]
and "manifest.name" in config_yml["lint"]["nextflow_config"]
):
return param_dict, skip_paths
# Check that the pipeline name matches the requirements
if not re.match(r"^[a-z]+$", param_dict["short_name"]):
raise UserWarning("[red]Invalid workflow name: must be lowercase without punctuation.")
if param_dict["prefix"] == "nf-core":
# Check that the pipeline name matches the requirements
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

Expand Down
5 changes: 2 additions & 3 deletions nf_core/launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import nf_core.schema
import nf_core.utils
from nf_core.lint_utils import dump_json_with_prettier

log = logging.getLogger(__name__)

Expand Down Expand Up @@ -700,9 +701,7 @@ def build_command(self):

# Write the user selection to a file and run nextflow with that
if self.use_params_file:
with open(self.params_out, "w") as fp:
json.dump(self.schema_obj.input_params, fp, indent=4)
fp.write("\n")
dump_json_with_prettier(self.params_out, self.schema_obj.input_params)
self.nextflow_cmd += f' -params-file "{os.path.relpath(self.params_out)}"'

# Call nextflow with a list of command line flags
Expand Down
1 change: 1 addition & 0 deletions nf_core/lint/nextflow_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ def nextflow_config(self):
"params.singleEnd",
"params.igenomesIgnore",
"params.name",
"params.enable_conda",
]

# Remove field that should be ignored according to the linting config
Expand Down
12 changes: 12 additions & 0 deletions nf_core/lint_utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import json
import logging
import subprocess
from pathlib import Path
Expand Down Expand Up @@ -82,3 +83,14 @@ def run_prettier_on_file(file):
"There was an error running the prettier pre-commit hook.\n"
f"STDOUT: {e.stdout.decode()}\nSTDERR: {e.stderr.decode()}"
)


def dump_json_with_prettier(file_name, file_content):
"""Dump a JSON file and run prettier on it.
Args:
file_name (Path | str): A file identifier as a string or pathlib.Path.
file_content (dict): Content to dump into the JSON file
"""
with open(file_name, "w") as fh:
json.dump(file_content, fh, indent=4)
run_prettier_on_file(file_name)
2 changes: 1 addition & 1 deletion nf_core/module-template/modules/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ process {{ tool_name_underscore|upper }} {
// Software MUST be pinned to channel (i.e. "bioconda"), version (i.e. "1.10").
// For Conda, the build (i.e. "h9402c20_2") must be EXCLUDED to support installation on different operating systems.
// TODO nf-core: See section in main README for further information regarding finding and adding container addresses to the section below.
conda (params.enable_conda ? "{{ bioconda if bioconda else 'YOUR-TOOL-HERE' }}" : null)
conda "{{ bioconda if bioconda else 'YOUR-TOOL-HERE' }}"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'{{ singularity_container if singularity_container else 'https://depot.galaxyproject.org/singularity/YOUR-TOOL-HERE' }}':
'{{ docker_container if docker_container else 'quay.io/biocontainers/YOUR-TOOL-HERE' }}' }"
Expand Down
2 changes: 1 addition & 1 deletion nf_core/modules/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def create(self):
self._get_bioconda_tool()

# Prompt for GitHub username
nf_core.components.components_create.get_username(self.author)
self.author = nf_core.components.components_create.get_username(self.author)

self._get_module_structure_components()

Expand Down
26 changes: 24 additions & 2 deletions nf_core/modules/lint/main_nf.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,15 @@ def check_process_section(self, lines, fix_version, progress_bar):
self.failed.append(("singularity_tag", "Unable to parse singularity tag", self.main_nf))
singularity_tag = None
url = urlparse(l.split("'")[0])
# lint double quotes
if l.count('"') > 2:
self.failed.append(
(
"container_links",
"Too many double quotes found when specifying singularity container",
self.main_nf,
)
)
if _container_type(l) == "docker":
# e.g. "quay.io/biocontainers/krona:2.7.1--pl526_5' }" -> 2.7.1--pl526_5
# e.g. "biocontainers/biocontainers:v1.2.0_cv1' }" -> v1.2.0_cv1
Expand All @@ -282,13 +291,26 @@ def check_process_section(self, lines, fix_version, progress_bar):
self.failed.append(("docker_tag", "Unable to parse docker tag", self.main_nf))
docker_tag = None
url = urlparse(l.split("'")[0])
# lint double quotes
if l.count('"') > 2:
self.failed.append(
("container_links", "Too many double quotes found when specifying docker container", self.main_nf)
)
# lint double quotes
if l.startswith("container"):
container_section = l + lines[i + 1] + lines[i + 2]
if container_section.count('"') > 2:
if l.count('"') > 2:
self.failed.append(
("container_links", "Too many double quotes found when specifying containers", self.main_nf)
)
# lint more than one container in the same line
if ("https://containers" in l or "https://depot" in l) and ("biocontainers/" in l or "quay.io/" in l):
self.warned.append(
(
"container_links",
"Docker and Singularity containers specified in the same line. Only first one checked.",
self.main_nf,
)
)
# Try to connect to container URLs
if url is None:
continue
Expand Down
13 changes: 7 additions & 6 deletions nf_core/modules/modules_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import nf_core.utils
from nf_core.components.components_utils import get_components_to_install
from nf_core.lint_utils import run_prettier_on_file
from nf_core.lint_utils import dump_json_with_prettier
from nf_core.modules.modules_repo import (
NF_CORE_MODULES_NAME,
NF_CORE_MODULES_REMOTE,
Expand Down Expand Up @@ -618,7 +618,11 @@ def load(self):
"""
try:
with open(self.modules_json_path, "r") as fh:
self.modules_json = json.load(fh)
try:
self.modules_json = json.load(fh)
except json.JSONDecodeError as e:
raise UserWarning(f"Unable to load JSON file '{self.modules_json_path}' due to error {e}")

except FileNotFoundError:
raise UserWarning("File 'modules.json' is missing")

Expand Down Expand Up @@ -1023,10 +1027,7 @@ def dump(self):
"""
# Sort the modules.json
self.modules_json["repos"] = nf_core.utils.sort_dictionary(self.modules_json["repos"])
with open(self.modules_json_path, "w") as fh:
json.dump(self.modules_json, fh, indent=4)
fh.write("\n")
run_prettier_on_file(self.modules_json_path)
dump_json_with_prettier(self.modules_json_path, self.modules_json)

def resolve_missing_installation(self, missing_installation, component_type):
missing_but_in_mod_json = [
Expand Down
4 changes: 2 additions & 2 deletions nf_core/pipeline-template/.github/workflows/fix-linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ jobs:
id: prettier_status
run: |
if prettier --check ${GITHUB_WORKSPACE}; then
echo "name=result::pass" >> $GITHUB_OUTPUT
echo "result=pass" >> $GITHUB_OUTPUT
else
echo "name=result::fail" >> $GITHUB_OUTPUT
echo "result=fail" >> $GITHUB_OUTPUT
fi

- name: Run 'prettier --write'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

- name: Get PR number
id: pr_number
run: echo "name=pr_number::$(cat linting-logs/PR_number.txt)" >> $GITHUB_OUTPUT
run: echo "pr_number=$(cat linting-logs/PR_number.txt)" >> $GITHUB_OUTPUT

- name: Post PR comment
uses: marocchino/sticky-pull-request-comment@v2
Expand Down
2 changes: 1 addition & 1 deletion nf_core/pipeline-template/lib/WorkflowMain.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class WorkflowMain {
NfcoreTemplate.checkConfigProvided(workflow, log)

// Check that conda channels are set-up correctly
if (params.enable_conda) {
if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) {
Utils.checkCondaChannels(log)
}

Expand Down
6 changes: 3 additions & 3 deletions nf_core/pipeline-template/modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
"nf-core": {
"custom/dumpsoftwareversions": {
"branch": "master",
"git_sha": "5e34754d42cd2d5d248ca8673c0a53cdf5624905",
"git_sha": "c8e35eb2055c099720a75538d1b8adb3fb5a464c",
"installed_by": ["modules"]
},
"fastqc": {
"branch": "master",
"git_sha": "5e34754d42cd2d5d248ca8673c0a53cdf5624905",
"git_sha": "c8e35eb2055c099720a75538d1b8adb3fb5a464c",
"installed_by": ["modules"]
},
"multiqc": {
"branch": "master",
"git_sha": "5e34754d42cd2d5d248ca8673c0a53cdf5624905",
"git_sha": "c8e35eb2055c099720a75538d1b8adb3fb5a464c",
"installed_by": ["modules"]
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ process SAMPLESHEET_CHECK {
tag "$samplesheet"
label 'process_single'

conda (params.enable_conda ? "conda-forge::python=3.8.3" : null)
conda "conda-forge::python=3.8.3"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/python:3.8.3' :
'quay.io/biocontainers/python:3.8.3' }"
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

99 changes: 55 additions & 44 deletions ...ne-template/modules/nf-core/custom/dumpsoftwareversions/templates/dumpsoftwareversions.py
100644 → 100755

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading