tools icon indicating copy to clipboard operation
tools copied to clipboard

nf-core lint fails when there are no external modules

Open sgopalan98 opened this issue 1 year ago • 0 comments

Description of the bug

I'm trying to run nf-core linting in one of our nf-core template Nextflow pipeline that doesn't use any remote modules. Running nf-core lint throws an error - No modules from https://github.com/nf-core/modules.git installed in pipeline.

Code reference: https://github.com/nf-core/tools/blob/776089ac0e42f1fce9084182eba3b4ca0ed405e9/nf_core/components/lint/init.py#L130

This issue was raised previously in #2002 . The solution then was to use the "dev" version at that time (latest release then v2.6). To verify if the check was removed in the subsequent version, I checked version 2.7. However, it appears that version 2.7 also includes this check, as referenced below.

https://github.com/nf-core/tools/blob/5c4477b28581f8aa06dc0a49eec2c63dc88adfdd/nf_core/modules/lint/init.py#L105

Command used and terminal output

$ nf-core lint 

                                          ,--./,-.
          ___     __   __   __   ___     /,-._.--~\
    |\ | |__  __ /  ` /  \ |__) |__         }  {
    | \| |       \__, \__/ |  \ |___     \`-._,-`-,
                                          `._,._,'

    nf-core/tools version 2.12.1 - https://nf-co.re


╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /Users/santhanagopalan/Repos/cart/cart-env/bin/nf-core:8 in <module>                             │
│                                                                                                  │
│   5 from nf_core.__main__ import run_nf_core                                                     │
│   6 if __name__ == '__main__':                                                                   │
│   7 │   sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])                         │
│ ❱ 8 │   sys.exit(run_nf_core())                                                                  │
│   9                                                                                              │
│                                                                                                  │
│ /Users/santhanagopalan/Repos/cart/cart-env/lib/python3.11/site-packages/nf_core/__main__.py:141  │
│ in run_nf_core                                                                                   │
│                                                                                                  │
│    138 │   │   │   log.debug(f"Could not check latest version: {e}")                             │
│    139 │   │   stderr.print("\n")                                                                │
│    140 │   # Launch the click cli                                                                │
│ ❱  141 │   nf_core_cli(auto_envvar_prefix="NFCORE")                                              │
│    142                                                                                           │
│    143                                                                                           │
│    144 @tui()                                                                                    │
│                                                                                                  │
│ /Users/santhanagopalan/Repos/cart/cart-env/lib/python3.11/site-packages/click/core.py:1157 in    │
│ __call__                                                                                         │
│                                                                                                  │
│   1154 │                                                                                         │
│   1155 │   def __call__(self, *args: t.Any, **kwargs: t.Any) -> t.Any:                           │
│   1156 │   │   """Alias for :meth:`main`."""                                                     │
│ ❱ 1157 │   │   return self.main(*args, **kwargs)                                                 │
│   1158                                                                                           │
│   1159                                                                                           │
│   1160 class Command(BaseCommand):                                                               │
│                                                                                                  │
│ /Users/santhanagopalan/Repos/cart/cart-env/lib/python3.11/site-packages/rich_click/rich_command. │
│ py:126 in main                                                                                   │
│                                                                                                  │
│   123 │   │   try:                                                                               │
│   124 │   │   │   try:                                                                           │
│   125 │   │   │   │   with self.make_context(prog_name, args, **extra) as ctx:                   │
│ ❱ 126 │   │   │   │   │   rv = self.invoke(ctx)                                                  │
│   127 │   │   │   │   │   if not standalone_mode:                                                │
│   128 │   │   │   │   │   │   return rv                                                          │
│   129 │   │   │   │   │   # it's not safe to `ctx.exit(rv)` here!                                │
│                                                                                                  │
│ /Users/santhanagopalan/Repos/cart/cart-env/lib/python3.11/site-packages/click/core.py:1688 in    │
│ invoke                                                                                           │
│                                                                                                  │
│   1685 │   │   │   │   super().invoke(ctx)                                                       │
│   1686 │   │   │   │   sub_ctx = cmd.make_context(cmd_name, args, parent=ctx)                    │
│   1687 │   │   │   │   with sub_ctx:                                                             │
│ ❱ 1688 │   │   │   │   │   return _process_result(sub_ctx.command.invoke(sub_ctx))               │
│   1689 │   │                                                                                     │
│   1690 │   │   # In chain mode we create the contexts step by step, but after the                │
│   1691 │   │   # base command has been invoked.  Because at that point we do not                 │
│                                                                                                  │
│ /Users/santhanagopalan/Repos/cart/cart-env/lib/python3.11/site-packages/click/core.py:1434 in    │
│ invoke                                                                                           │
│                                                                                                  │
│   1431 │   │   │   echo(style(message, fg="red"), err=True)                                      │
│   1432 │   │                                                                                     │
│   1433 │   │   if self.callback is not None:                                                     │
│ ❱ 1434 │   │   │   return ctx.invoke(self.callback, **ctx.params)                                │
│   1435 │                                                                                         │
│   1436 │   def shell_complete(self, ctx: Context, incomplete: str) -> t.List["CompletionItem"]:  │
│   1437 │   │   """Return a list of completions for the incomplete value. Looks                   │
│                                                                                                  │
│ /Users/santhanagopalan/Repos/cart/cart-env/lib/python3.11/site-packages/click/core.py:783 in     │
│ invoke                                                                                           │
│                                                                                                  │
│    780 │   │                                                                                     │
│    781 │   │   with augment_usage_errors(__self):                                                │
│    782 │   │   │   with ctx:                                                                     │
│ ❱  783 │   │   │   │   return __callback(*args, **kwargs)                                        │
│    784 │                                                                                         │
│    785 │   def forward(                                                                          │
│    786 │   │   __self, __cmd: "Command", *args: t.Any, **kwargs: t.Any  # noqa: B902             │
│                                                                                                  │
│ /Users/santhanagopalan/Repos/cart/cart-env/lib/python3.11/site-packages/click/decorators.py:33   │
│ in new_func                                                                                      │
│                                                                                                  │
│    30 │   """                                                                                    │
│    31 │                                                                                          │
│    32 │   def new_func(*args: "P.args", **kwargs: "P.kwargs") -> "R":                            │
│ ❱  33 │   │   return f(get_current_context(), *args, **kwargs)                                   │
│    34 │                                                                                          │
│    35 │   return update_wrapper(new_func, f)                                                     │
│    36                                                                                            │
│                                                                                                  │
│ /Users/santhanagopalan/Repos/cart/cart-env/lib/python3.11/site-packages/nf_core/__main__.py:607  │
│ in lint                                                                                          │
│                                                                                                  │
│    604 │                                                                                         │
│    605 │   # Run the lint tests!                                                                 │
│    606 │   try:                                                                                  │
│ ❱  607 │   │   lint_obj, module_lint_obj, subworkflow_lint_obj = run_linting(                    │
│    608 │   │   │   dir,                                                                          │
│    609 │   │   │   release,                                                                      │
│    610 │   │   │   fix,                                                                          │
│                                                                                                  │
│ /Users/santhanagopalan/Repos/cart/cart-env/lib/python3.11/site-packages/nf_core/lint/__init__.py │
│ :94 in run_linting                                                                               │
│                                                                                                  │
│    91 │   lint_obj._list_files()                                                                 │
│    92 │                                                                                          │
│    93 │   # Create the modules lint object                                                       │
│ ❱  94 │   module_lint_obj = nf_core.modules.lint.ModuleLint(pipeline_dir, hide_progress=hide_p   │
│    95 │   # Create the subworkflows lint object                                                  │
│    96 │   try:                                                                                   │
│    97 │   │   subworkflow_lint_obj = nf_core.subworkflows.lint.SubworkflowLint(pipeline_dir, h   │
│                                                                                                  │
│ /Users/santhanagopalan/Repos/cart/cart-env/lib/python3.11/site-packages/nf_core/modules/lint/__i │
│ nit__.py:51 in __init__                                                                          │
│                                                                                                  │
│    48 │   │   registry=None,                                                                     │
│    49 │   │   hide_progress=False,                                                               │
│    50 │   ):                                                                                     │
│ ❱  51 │   │   super().__init__(                                                                  │
│    52 │   │   │   component_type="modules",                                                      │
│    53 │   │   │   dir=dir,                                                                       │
│    54 │   │   │   fail_warned=fail_warned,                                                       │
│                                                                                                  │
│ /Users/santhanagopalan/Repos/cart/cart-env/lib/python3.11/site-packages/nf_core/components/lint/ │
│ __init__.py:100 in __init__                                                                      │
│                                                                                                  │
│    97 │   │   │   │   │   │   )                                                                  │
│    98 │   │   │   │   │   )                                                                      │
│    99 │   │   │   if not self.all_remote_components:                                             │
│ ❱ 100 │   │   │   │   raise LookupError(                                                         │
│   101 │   │   │   │   │   f"No {self.component_type} from {self.modules_repo.remote_url} insta   │
│   102 │   │   │   │   )                                                                          │
│   103 │   │   │   local_component_dir = Path(self.dir, self.component_type, "local")             │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
LookupError: No modules from https://github.com/nf-core/modules.git installed in pipeline.

System information

Nextflow version: 23.10.0 Hardware: MacOS M1 Executor: Local OS: macOS Monterey nf-core/tools version: v2.12.1 Python version: 3.11

sgopalan98 avatar Feb 09 '24 23:02 sgopalan98