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

Remove nf-core licences command #3012

Merged
merged 4 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
- return directory if base_dir is the root directory ([#3003](https://github.com/nf-core/tools/pull/3003))
- Update pre-commit hook astral-sh/ruff-pre-commit to v0.4.6 ([#3006](https://github.com/nf-core/tools/pull/3006))
- Create: allow more special characters on the pipeline name for non-nf-core pipelines ([#3008](https://github.com/nf-core/tools/pull/3008))
- Remove nf-core licences command ([#3012](https://github.com/nf-core/tools/pull/3012))

## [v2.14.1 - Tantalum Toad - Patch](https://github.com/nf-core/tools/releases/tag/2.14.1) - [2024-05-09]

Expand Down
24 changes: 0 additions & 24 deletions nf_core/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
"launch",
"create-params-file",
"download",
"licences",
"tui",
],
},
Expand Down Expand Up @@ -463,29 +462,6 @@ def download(
dl.download_workflow()


# nf-core licences
@nf_core_cli.command()
@click.argument("pipeline", required=True, metavar="<pipeline name>")
@click.option("--json", is_flag=True, default=False, help="Print output in JSON")
def licences(pipeline, json):
"""
List software licences for a given workflow (DSL1 only).

Checks the pipeline environment.yml file which lists all conda software packages, which is not available for DSL2 workflows. Therefore, this command only supports DSL1 workflows (for now).
Each of these is queried against the anaconda.org API to find the licence.
Package name, version and licence is printed to the command line.
"""
from nf_core.licences import WorkflowLicences

lic = WorkflowLicences(pipeline)
lic.as_json = json
try:
stdout.print(lic.run_licences())
except LookupError as e:
log.error(e)
sys.exit(1)


# nf-core lint
@nf_core_cli.command()
@click.option(
Expand Down
115 changes: 0 additions & 115 deletions nf_core/licences.py

This file was deleted.

32 changes: 0 additions & 32 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,38 +199,6 @@ def test_cli_download(self, mock_dl):

mock_dl.return_value.download_workflow.assert_called_once()

@mock.patch("nf_core.licences.WorkflowLicences")
def test_licences(self, mock_lic):
"""Test nf-core pipeline licence is printed out and cli parameters are passed on."""
licence_text = "dummy licence text"
mock_lic.return_value.run_licences.return_value = licence_text

params = {
"json": None,
}

cmd = ["licences"] + self.assemble_params(params) + ["pipeline_name"]
result = self.invoke_cli(cmd)

assert result.exit_code == 0
assert licence_text in result.output

mock_lic.assert_called_once_with(cmd[-1])

@mock.patch("nf_core.licences.WorkflowLicences")
def test_licences_log_error(self, mock_lic):
"""Test LookupError is logged"""
error_txt = "LookupError has been raised"
mock_lic.return_value.run_licences.side_effect = LookupError(error_txt)

cmd = ["licences", "pipeline_name"]
with self.assertLogs() as captured_logs:
result = self.invoke_cli(cmd)

assert result.exit_code == 1
assert error_txt in captured_logs.output[-1]
assert captured_logs.records[-1].levelname == "ERROR"

@mock.patch("nf_core.pipelines.create.create.PipelineCreate")
def test_create(self, mock_create):
"""Test nf-core pipeline is created and cli parameters are passed on."""
Expand Down
57 changes: 0 additions & 57 deletions tests/test_licenses.py

This file was deleted.

Loading