Skip to content

Commit

Permalink
Merge branch 'dev' into vs-code-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mirpedrol authored Dec 3, 2024
2 parents 35eb958 + a7351a2 commit a39ed59
Show file tree
Hide file tree
Showing 67 changed files with 2,211 additions and 737 deletions.
6 changes: 6 additions & 0 deletions .github/actions/create-lint-wf/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ runs:
run: find nf-core-testpipeline -type f -exec sed -i 's/zenodo.XXXXXX/zenodo.123456/g' {} \;
working-directory: create-lint-wf

# Add empty ro-crate file
- name: add empty ro-crate file
shell: bash
run: touch nf-core-testpipeline/ro-crate-metadata.json
working-directory: create-lint-wf

# Run nf-core pipelines linting
- name: nf-core pipelines lint
shell: bash
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/create-test-lint-wf-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,11 @@ jobs:
run: find my-prefix-testpipeline -type f -exec sed -i 's/zenodo.XXXXXX/zenodo.123456/g' {} \;
working-directory: create-test-lint-wf

# Add empty ro-crate file
- name: add empty ro-crate file
run: touch my-prefix-testpipeline/ro-crate-metadata.json
working-directory: create-test-lint-wf

# Run nf-core linting
- name: nf-core pipelines lint
run: nf-core --log-file log.txt --hide-progress pipelines lint --dir my-prefix-testpipeline --fail-warned
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ jobs:
- name: Test with pytest
run: |
python3 -m pytest tests/${{matrix.test}} --color=yes --cov --durations=0 && exit_code=0|| exit_code=$?
python3 -m pytest tests/${{matrix.test}} --color=yes --cov --cov-config=.coveragerc --durations=0 && exit_code=0|| exit_code=$?
# don't fail if no tests were collected, e.g. for test_licence.py
if [ "${exit_code}" -eq 5 ]; then
echo "No tests were collected"
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.4
rev: v0.8.1
hooks:
- id: ruff # linter
args: [--fix, --exit-non-zero-on-fix] # sort imports and fix
Expand Down
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,30 @@
- fix workflow_dispatch trigger and parse more review comments in awsfulltest ([#3235](https://github.com/nf-core/tools/pull/3235))
- Add resource limits to Gitpod profile([#3255](https://github.com/nf-core/tools/pull/3255))
- Fix a typo ([#3268](https://github.com/nf-core/tools/pull/3268))
- Remove `def` from `nextflow.config` and add `trace_report_suffix` param ([#3296](https://github.com/nf-core/tools/pull/3296))
- Move `includeConfig 'conf/modules.config'` next to `includeConfig 'conf/base.config'` to not overwrite tests profiles configurations ([#3301](https://github.com/nf-core/tools/pull/3301))
- Use `params.monochrome_logs` in the template and update nf-core components ([#3310](https://github.com/nf-core/tools/pull/3310))
- Fix some typos and improve writing in `usage.md` and `CONTRIBUTING.md` ([#3302](https://github.com/nf-core/tools/pull/3302))
- Add `manifest.contributors` to `nextflow.config` ([#3311](https://github.com/nf-core/tools/pull/3311))

### Download

- First steps towards fixing [#3179](https://github.com/nf-core/tools/issues/3179): Modify `prioritize_direct_download()` to retain Seqera Singularity https:// Container URIs and hardcode Seqera Containers into `gather_registries()` ([#3244](https://github.com/nf-core/tools/pull/3244)).
- Further steps towards fixing [#3179](https://github.com/nf-core/tools/issues/3179): Enable limited support for `oras://` container paths (_only absolute URIs, no flexible registries like with Docker_) and prevent unnecessary image downloads for Seqera Container modules with `reconcile_seqera_container_uris()` ([#3293](https://github.com/nf-core/tools/pull/3293)).
- Update dawidd6/action-download-artifact action to v7 ([#3306](https://github.com/nf-core/tools/pull/3306))

### Linting

- General: Run pre-commit when testing linting the template pipeline ([#3280](https://github.com/nf-core/tools/pull/3280))
- allow mixed `str` and `dict` entries in lint config ([#3228](https://github.com/nf-core/tools/pull/3228))

### Modules

- add a panel around diff previews when updating ([#3246](https://github.com/nf-core/tools/pull/3246))

### Subworkflows

- Add `nf-core subworkflows patch` command ([#2861](https://github.com/nf-core/tools/pull/2861))

### General

- Include .nf-core.yml in `nf-core pipelines bump-version` ([#3220](https://github.com/nf-core/tools/pull/3220))
Expand All @@ -44,6 +53,9 @@
- Update pre-commit hook astral-sh/ruff-pre-commit to v0.7.4 ([#3282](https://github.com/nf-core/tools/pull/3282))
- Update codecov/codecov-action action to v5 ([#3283](https://github.com/nf-core/tools/pull/3283))
- Update python:3.12-slim Docker digest to 2a6386a ([#3284](https://github.com/nf-core/tools/pull/3284))
- Update pre-commit hook astral-sh/ruff-pre-commit to v0.8.0 ([#3299](https://github.com/nf-core/tools/pull/3299))
- Update gitpod/workspace-base Docker digest to 12853f7 ([#3309](https://github.com/nf-core/tools/pull/3309))
- Run pre-commit when testing linting the template pipeline ([#3280](https://github.com/nf-core/tools/pull/3280))
- build: Setup VS Code tests ([#3292](https://github.com/nf-core/tools/pull/3292))

## [v3.0.2 - Titanium Tapir Patch](https://github.com/nf-core/tools/releases/tag/3.0.2) - [2024-10-11]
Expand Down
82 changes: 79 additions & 3 deletions nf_core/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
pipelines_launch,
pipelines_lint,
pipelines_list,
pipelines_rocrate,
pipelines_schema_build,
pipelines_schema_docs,
pipelines_schema_lint,
Expand Down Expand Up @@ -86,7 +87,7 @@
},
{
"name": "For developers",
"commands": ["create", "lint", "bump-version", "sync", "schema", "create-logo"],
"commands": ["create", "lint", "bump-version", "sync", "schema", "rocrate", "create-logo"],
},
],
"nf-core modules": [
Expand Down Expand Up @@ -570,6 +571,44 @@ def command_pipelines_list(ctx, keywords, sort, json, show_archived):
pipelines_list(ctx, keywords, sort, json, show_archived)


# nf-core pipelines rocrate
@pipelines.command("rocrate")
@click.argument(
"pipeline_dir",
type=click.Path(exists=True),
default=Path.cwd(),
required=True,
metavar="<pipeline directory>",
)
@click.option(
"-j",
"--json_path",
default=Path.cwd(),
type=str,
help="Path to save RO Crate metadata json file to",
)
@click.option("-z", "--zip_path", type=str, help="Path to save RO Crate zip file to")
@click.option(
"-pv",
"--pipeline_version",
type=str,
help="Version of pipeline to use for RO Crate",
default="",
)
@click.pass_context
def rocrate(
ctx,
pipeline_dir: str,
json_path: str,
zip_path: str,
pipeline_version: str,
):
"""
Make an Research Object Crate
"""
pipelines_rocrate(ctx, pipeline_dir, json_path, zip_path, pipeline_version)


# nf-core pipelines sync
@pipelines.command("sync")
@click.pass_context
Expand Down Expand Up @@ -1024,7 +1063,7 @@ def command_modules_update(
default=".",
help=r"Pipeline directory. [dim]\[default: current working directory][/]",
)
@click.option("-r", "--remove", is_flag=True, default=False)
@click.option("-r", "--remove", is_flag=True, default=False, help="Remove an existent patch file and regenerate it.")
def command_modules_patch(ctx, tool, directory, remove):
"""
Create a patch file for minor changes in a module
Expand Down Expand Up @@ -1567,6 +1606,43 @@ def command_subworkflows_install(ctx, subworkflow, directory, prompt, force, sha
subworkflows_install(ctx, subworkflow, directory, prompt, force, sha)


# nf-core subworkflows patch
@subworkflows.command("patch")
@click.pass_context
@click.argument("tool", type=str, required=False, metavar="<tool> or <tool/subtool>")
@click.option(
"-d",
"--dir",
type=click.Path(exists=True),
default=".",
help=r"Pipeline directory. [dim]\[default: current working directory][/]",
)
@click.option("-r", "--remove", is_flag=True, default=False, help="Remove an existent patch file and regenerate it.")
def subworkflows_patch(ctx, tool, dir, remove):
"""
Create a patch file for minor changes in a subworkflow
Checks if a subworkflow has been modified locally and creates a patch file
describing how the module has changed from the remote version
"""
from nf_core.subworkflows import SubworkflowPatch

try:
subworkflow_patch = SubworkflowPatch(
dir,
ctx.obj["modules_repo_url"],
ctx.obj["modules_repo_branch"],
ctx.obj["modules_repo_no_pull"],
)
if remove:
subworkflow_patch.remove(tool)
else:
subworkflow_patch.patch(tool)
except (UserWarning, LookupError) as e:
log.error(e)
sys.exit(1)


# nf-core subworkflows remove
@subworkflows.command("remove")
@click.pass_context
Expand Down Expand Up @@ -1721,7 +1797,7 @@ def command_schema_validate(pipeline, params):
@click.option(
"--url",
type=str,
default="https://nf-co.re/pipeline_schema_builder",
default="https://oldsite.nf-co.re/pipeline_schema_builder",
help="Customise the builder URL (for development work)",
)
def command_schema_build(directory, no_prompts, web_only, url):
Expand Down
28 changes: 28 additions & 0 deletions nf_core/commands_pipelines.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import os
import sys
from pathlib import Path
from typing import Optional, Union

import rich

Expand Down Expand Up @@ -277,6 +278,33 @@ def pipelines_list(ctx, keywords, sort, json, show_archived):
stdout.print(list_workflows(keywords, sort, json, show_archived))


# nf-core pipelines rocrate
def pipelines_rocrate(
ctx,
pipeline_dir: Union[str, Path],
json_path: Optional[Union[str, Path]],
zip_path: Optional[Union[str, Path]],
pipeline_version: str,
) -> None:
from nf_core.pipelines.rocrate import ROCrate

if json_path is None and zip_path is None:
log.error("Either `--json_path` or `--zip_path` must be specified.")
sys.exit(1)
else:
pipeline_dir = Path(pipeline_dir)
if json_path is not None:
json_path = Path(json_path)
if zip_path is not None:
zip_path = Path(zip_path)
try:
rocrate_obj = ROCrate(pipeline_dir, pipeline_version)
rocrate_obj.create_rocrate(json_path=json_path, zip_path=zip_path)
except (UserWarning, LookupError, FileNotFoundError) as e:
log.error(e)
sys.exit(1)


# nf-core pipelines sync
def pipelines_sync(ctx, directory, from_branch, pull_request, github_repository, username, template_yaml, force_pr):
"""
Expand Down
Loading

0 comments on commit a39ed59

Please sign in to comment.