Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -54,6 +54,7 @@
- impr devcontainer: Add hostRequirements to run with 4CPUs and 16GB ram by default ([#3746](https://github.com/nf-core/tools/pull/3746))
- Add .nf-test/ to prettier ignore list ([#3776](https://github.com/nf-core/tools/pull/3776))
- Update dependency textual to v5.3.0 ([#3785](https://github.com/nf-core/tools/pull/3785))
- update rich-click to 1.9 and use new styling options ([#3787](https://github.com/nf-core/tools/pull/3787))

## [v3.3.2 - Tungsten Tamarin Patch 2](https://github.com/nf-core/tools/releases/tag/3.3.2) - [2025-07-08]

Expand Down
90 changes: 25 additions & 65 deletions nf_core/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import rich.logging
import rich.traceback
import rich_click as click
import rich_click.rich_click as rc
from trogon import tui

from nf_core import __version__
Expand Down Expand Up @@ -73,51 +74,10 @@
setup_nfcore_dir()

# Set up nicer formatting of click cli help messages
click.rich_click.MAX_WIDTH = 100
click.rich_click.USE_RICH_MARKUP = True
click.rich_click.COMMAND_GROUPS = {
"nf-core": [
{
"name": "Commands",
"commands": ["pipelines", "modules", "subworkflows", "test-datasets", "interface"],
},
],
"nf-core pipelines": [
{
"name": "For users",
"commands": ["list", "launch", "download", "create-params-file"],
},
{
"name": "For developers",
"commands": ["create", "lint", "bump-version", "sync", "schema", "rocrate", "create-logo"],
},
],
"nf-core modules": [
{
"name": "For pipelines",
"commands": ["list", "info", "install", "update", "remove", "patch"],
},
{
"name": "Developing new modules",
"commands": ["create", "lint", "test", "bump-versions"],
},
],
"nf-core subworkflows": [
{
"name": "For pipelines",
"commands": ["list", "info", "install", "update", "remove"],
},
{
"name": "Developing new subworkflows",
"commands": ["create", "lint", "test"],
},
],
"nf-core pipelines schema": [{"name": "Schema commands", "commands": ["validate", "build", "lint", "docs"]}],
"nf-core test-datasets": [{"name": "For developers", "commands": ["search", "list", "list-branches"]}],
}
click.rich_click.OPTION_GROUPS = {
"nf-core modules list local": [{"options": ["--dir", "--json", "--help"]}],
}
rc.MAX_WIDTH = 100
rc.USE_RICH_MARKUP = True
rc.COMMANDS_BEFORE_OPTIONS = True


# Set up rich stderr console
stderr = rich.console.Console(stderr=True, force_terminal=rich_force_colors())
Expand Down Expand Up @@ -149,17 +109,6 @@ def normalize_case(ctx, param, component_name):
return component_name.casefold()


# Define a custom click group class to sort options and commands in the help message
# TODO: Remove this class and use COMMANDS_BEFORE_OPTIONS when rich-click is updated
# See https://github.com/ewels/rich-click/issues/200 for more information
class CustomRichGroup(click.RichGroup):
def format_options(self, ctx, formatter) -> None:
from rich_click.rich_help_rendering import get_rich_options

self.format_commands(ctx, formatter)
get_rich_options(self, ctx, formatter)


def run_nf_core():
# print nf-core header if environment variable is not set
if os.environ.get("_NF_CORE_COMPLETE") is None:
Expand All @@ -185,11 +134,8 @@ def run_nf_core():
nf_core_cli(auto_envvar_prefix="NFCORE")


@tui(
command="interface",
help="Launch the nf-core interface",
)
@click.group(context_settings=dict(help_option_names=["-h", "--help"]), cls=CustomRichGroup)
@tui(command="interface", help="Launch the nf-core interface")
@click.group(context_settings=dict(help_option_names=["-h", "--help"]))
@click.version_option(__version__)
@click.option(
"-v",
Expand All @@ -201,6 +147,12 @@ def run_nf_core():
@click.option("--hide-progress", is_flag=True, default=False, help="Don't show progress bars.")
@click.option("-l", "--log-file", help="Save a verbose log to a file.", metavar="<filename>")
@click.pass_context
@click.rich_config(
{
"theme": "default-nu",
"options_table_column_types": ["opt_long", "opt_short", "help"],
}
)
def nf_core_cli(ctx, verbose, hide_progress, log_file):
"""
nf-core/tools provides a set of helper tools for use with nf-core Nextflow pipelines.
Expand Down Expand Up @@ -239,7 +191,11 @@ def nf_core_cli(ctx, verbose, hide_progress, log_file):


# nf-core pipelines subcommands
@nf_core_cli.group()
@nf_core_cli.group(aliases=["p", "pipeline"])
@click.command_panel("For users", commands=["download", "create-params-file", "launch", "list"])
@click.command_panel(
"For developers", commands=["bump-version", "create", "create-logo", "lint", "rocrate", "schema", "sync"]
)
@click.pass_context
def pipelines(ctx):
"""
Expand Down Expand Up @@ -884,7 +840,7 @@ def command_pipelines_schema_docs(directory, schema_file, output, format, force,


# nf-core modules subcommands
@nf_core_cli.group()
@nf_core_cli.group(aliases=["m", "module"])
@click.option(
"-g",
"--git-remote",
Expand All @@ -906,6 +862,8 @@ def command_pipelines_schema_docs(directory, schema_file, output, format, force,
default=False,
help="Do not pull in latest changes to local clone of modules repository.",
)
@click.command_panel("For pipeline development", commands=["list", "info", "install", "update", "remove", "patch"])
@click.command_panel("For module development", commands=["create", "lint", "test", "bump-versions"])
@click.pass_context
def modules(ctx, git_remote, branch, no_pull):
"""
Expand Down Expand Up @@ -1421,7 +1379,7 @@ def command_modules_bump_versions(ctx, tool, directory, all, show_all, dry_run):


# nf-core subworkflows click command
@nf_core_cli.group()
@nf_core_cli.group(aliases=["s", "swf", "subworkflow"])
@click.option(
"-g",
"--git-remote",
Expand All @@ -1443,6 +1401,8 @@ def command_modules_bump_versions(ctx, tool, directory, all, show_all, dry_run):
default=False,
help="Do not pull in latest changes to local clone of modules repository.",
)
@click.command_panel("For pipeline development", commands=["list", "info", "install", "update", "remove", "patch"])
@click.command_panel("For module development", commands=["create", "lint", "test", "bump-versions"])
@click.pass_context
def subworkflows(ctx, git_remote, branch, no_pull):
"""
Expand Down Expand Up @@ -1878,7 +1838,7 @@ def command_subworkflows_update(


# nf-core test-dataset subcommands
@nf_core_cli.group()
@nf_core_cli.group(aliases=["tds"])
@click.pass_context
def test_datasets(ctx):
"""
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ questionary>=2.0.1
refgenie
requests
requests_cache
rich-click==1.8.*
rich-click==1.9.*
rich>=13.3.1
rocrate
repo2rocrate
Expand Down