Skip to content

Commit

Permalink
Merge pull request #1191 from drpatelh/release
Browse files Browse the repository at this point in the history
Help message tweaks for nf-core modules commands
  • Loading branch information
KevinMenden authored Jul 13, 2021
2 parents 5761b5f + d70ba7e commit fffa05a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 25 deletions.
12 changes: 5 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
# nf-core/tools: Changelog

## [v2.0 - Palladium Platypus](https://github.com/nf-core/tools/releases/tag/2.0) - [2021-07-12]
## [v2.0 - Palladium Platypus](https://github.com/nf-core/tools/releases/tag/2.0) - [2021-07-13]

### :warning: Major enhancements & breaking changes

This marks the first DSL2-centric release of `tools`, which means that some commands won't work in full with DSL1 pipelines anymore.
Please use a `v1.x` pipeline of `tools` for such pipeline or, better yet, make the transition to DSL2. Here are the most important changes:
This marks the first Nextflow DSL2-centric release of `tools` which means that some commands won't work in full with DSL1 pipelines anymore. Please use a `v1.x` version of `tools` for such pipelines or better yet join us to improve our DSL2 efforts! Here are the most important changes:

* The pipeline template has been re-written for DSL2 pipelines
* Linting has been adapted to DSL2 pipelines
* Version tracking of modules installed from `nf-core/modules` via an additional `modules.json` file and `git_sha` sums
* Pipeline commands must now be run either from within a pipeline directory or by specifying the path to a pipeline with `-d`/`--directory`
* The pipeline template has been completely re-written in DSL2
* A module template has been added to auto-create best-practice DSL2 modules to speed up development
* A whole suite of commands have been added to streamline the creation, installation, removal, linting and version bumping of DSL2 modules either installed within pipelines or the nf-core/modules repo

### Template

Expand Down
28 changes: 13 additions & 15 deletions nf_core/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ def modules(ctx, repository, branch):
@click.pass_context
def list(ctx):
"""
List modules available locally in a pipeline or in a remote repo like nf-core/modules.
List modules in a local pipeline or remote repo e.g nf-core/modules.
"""
pass

Expand All @@ -388,7 +388,7 @@ def list(ctx):
@click.option("-j", "--json", is_flag=True, help="Print as JSON to stdout")
def remote(ctx, keywords, json):
"""
List all modules available in a remote GitHub repo like on nf-core/modules
List all modules in a remote GitHub repo e.g. nf-core/modules
"""
try:
module_list = nf_core.modules.ModuleList(None, remote=True)
Expand Down Expand Up @@ -422,17 +422,14 @@ def local(ctx, keywords, json, dir):
@click.argument("tool", type=str, required=False, metavar="<tool> or <tool/subtool>")
@click.option("-d", "--dir", type=click.Path(exists=True), default=".", help="Pipeline directory. Defaults to CWD")
@click.option("-l", "--latest", is_flag=True, default=False, help="Install the latest version of the module")
@click.option(
"-f", "--force", is_flag=True, default=False, help="Force installation of module if module already exists"
)
@click.option("-f", "--force", is_flag=True, default=False, help="Force installation of module if it already exists")
@click.option("-s", "--sha", type=str, metavar="<commit sha>", help="Install module at commit SHA")
@click.option("-a", "--all", is_flag=True, default=False, help="Update all modules installed in pipeline")
def install(ctx, tool, dir, latest, force, sha, all):
"""
Add a DSL2 software wrapper module to a pipeline.
Install/update DSL2 modules within a pipeline.
Finds the relevant files in nf-core/modules and copies to the pipeline,
along with associated metadata.
Fetches and installs module files from a remote repo e.g. nf-core/modules.
"""
try:
module_install = nf_core.modules.ModuleInstall(dir, force=force, latest=latest, sha=sha, update_all=all)
Expand All @@ -451,7 +448,7 @@ def install(ctx, tool, dir, latest, force, sha, all):
@click.option("-d", "--dir", type=click.Path(exists=True), default=".", help="Pipeline directory. Defaults to CWD")
def remove(ctx, dir, tool):
"""
Remove a software wrapper from a pipeline.
Remove a module from a pipeline.
"""
try:
module_remove = nf_core.modules.ModuleRemove(dir)
Expand Down Expand Up @@ -480,7 +477,7 @@ def create_module(ctx, tool, dir, author, label, meta, no_meta, force, conda_nam
'modules/local/tool_subtool.nf'
If <directory> is a clone of nf-core/modules, it creates or modifies files
in 'modules/software', 'modules/tests' and 'tests/config/pytest_software.yml'
in 'modules/', 'tests/modules' and 'tests/config/pytest_modules.yml'
"""
# Combine two bool flags into one variable
has_meta = None
Expand Down Expand Up @@ -527,7 +524,7 @@ def create_test_yml(ctx, tool, run_tests, output, force, no_prompts):
@click.argument("tool", type=str, required=False, metavar="<tool> or <tool/subtool>")
@click.option("-d", "--dir", type=click.Path(exists=True), default=".", metavar="<pipeline/modules directory>")
@click.option("-k", "--key", type=str, metavar="<test>", multiple=True, help="Run only these lint tests")
@click.option("-a", "--all", is_flag=True, metavar="Run on all discovered tools")
@click.option("-a", "--all", is_flag=True, help="Run on all modules")
@click.option("--local", is_flag=True, help="Run additional lint tests for local modules")
@click.option("--passed", is_flag=True, help="Show passed tests")
def lint(ctx, tool, dir, key, all, local, passed):
Expand All @@ -537,7 +534,7 @@ def lint(ctx, tool, dir, key, all, local, passed):
Checks DSL2 module code against nf-core guidelines to ensure
that all modules follow the same standards.
Test modules within a pipeline or with your clone of the
Test modules within a pipeline or a clone of the
nf-core/modules repository.
"""
try:
Expand All @@ -558,11 +555,12 @@ def lint(ctx, tool, dir, key, all, local, passed):
@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=".", metavar="<nf-core/modules directory>")
@click.option("-a", "--all", is_flag=True, metavar="Run on all discovered tools")
@click.option("-s", "--show-all", is_flag=True, metavar="Show up-to-date modules in results")
@click.option("-a", "--all", is_flag=True, help="Run on all modules")
@click.option("-s", "--show-all", is_flag=True, help="Show up-to-date modules in results too")
def bump_versions(ctx, tool, dir, all, show_all):
"""
Bump versions for one or more modules in a directory.
Bump versions for one or more modules in a clone of
the nf-core/modules repo.
"""
try:
version_bumper = ModuleVersionBumper(pipeline_dir=dir)
Expand Down
6 changes: 3 additions & 3 deletions nf_core/modules/modules_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@ def verify_modules_repo(self):
if self.branch not in branches:
raise LookupError(f"Branch '{self.branch}' not found in '{self.name}'")
else:
raise LookupError(f"Repository '{self.name}' is not available from GitHub")
raise LookupError(f"Repository '{self.name}' is not available on GitHub")

api_url = f"https://api.github.com/repos/{self.name}/contents?ref={self.branch}"
response = requests.get(api_url)
if response.status_code == 200:
dir_names = [entry["name"] for entry in response.json() if entry["type"] == "dir"]
if "modules" not in dir_names:
err_str = f"Repository '{self.name}' ({self.branch}) does not contain a 'modules' directory"
err_str = f"Repository '{self.name}' ({self.branch}) does not contain a 'modules/' directory"
if "software" in dir_names:
err_str += ".\nAs of version 2.0, the 'software' directory should be renamed to 'modules'"
err_str += ".\nAs of version 2.0, the 'software/' directory should be renamed to 'modules/'"
raise LookupError(err_str)
else:
raise LookupError(f"Unable to fetch repository information from '{self.name}' ({self.branch})")
Expand Down

0 comments on commit fffa05a

Please sign in to comment.