-
Notifications
You must be signed in to change notification settings - Fork 215
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Description of the bug
The test-dataset search
command fails if a query is not supplied. This bug was introduced when changing to having an optional query
parameter and is caused because the questionary.autocomplete
default cannot be None.
Command used and terminal output
$ nf-core test-datasets search -b modules
nf-core test-datasets search -b mag
,--./,-.
___ __ __ __ ___ /,-._.--~\
|\ | |__ __ / ` / \ |__) |__ } {
| \| | \__, \__/ | \ |___ \`-._,-`-,
`._,._,'
nf-core/tools version 3.3.2.dev0 - https://nf-co.re
Searching files on branch: mag
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /opt/homebrew/Caskroom/miniconda/base/envs/nfct-dev/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/julian-qbic/Desktop/Projects/nf-core-tools/fork/nf_core/__main__.py:183 in run_nf_core │
│ │
│ 180 │ │ │ log.debug(f"Could not check latest version: {e}") │
│ 181 │ │ stderr.print("\n") │
│ 182 │ # Launch the click cli │
│ ❱ 183 │ nf_core_cli(auto_envvar_prefix="NFCORE") │
│ 184 │
│ 185 │
│ 186 @tui( │
│ │
│ /opt/homebrew/Caskroom/miniconda/base/envs/nfct-dev/lib/python3.13/site-packages/rich_click/rich │
│ _command.py:378 in __call__ │
│ │
│ 375 │ │ # Include this here because I run into a false warning │
│ 376 │ │ # in the PyCharm IDE otherwise; for some reason PyCharm doesn't │
│ 377 │ │ # seem to think RichGroups are callable. (No issues with Mypy, though.) │
│ ❱ 378 │ │ return super().__call__(*args, **kwargs) │
│ 379 │
│ 380 │
│ 381 class RichCommandCollection(CommandCollection, RichGroup): │
│ │
│ /opt/homebrew/Caskroom/miniconda/base/envs/nfct-dev/lib/python3.13/site-packages/click/core.py:1 │
│ 161 in __call__ │
│ │
│ 1158 │ │
│ 1159 │ def __call__(self, *args: t.Any, **kwargs: t.Any) -> t.Any: │
│ 1160 │ │ """Alias for :meth:`main`.""" │
│ ❱ 1161 │ │ return self.main(*args, **kwargs) │
│ 1162 │
│ 1163 │
│ 1164 class Command(BaseCommand): │
│ │
│ /opt/homebrew/Caskroom/miniconda/base/envs/nfct-dev/lib/python3.13/site-packages/rich_click/rich │
│ _command.py:166 in main │
│ │
│ 163 │ │ try: │
│ 164 │ │ │ try: │
│ 165 │ │ │ │ with self.make_context(prog_name, args, **extra) as ctx: │
│ ❱ 166 │ │ │ │ │ rv = self.invoke(ctx) │
│ 167 │ │ │ │ │ if not standalone_mode: │
│ 168 │ │ │ │ │ │ return rv │
│ 169 │ │ │ │ │ # it's not safe to `ctx.exit(rv)` here! │
│ │
│ /opt/homebrew/Caskroom/miniconda/base/envs/nfct-dev/lib/python3.13/site-packages/click/core.py:1 │
│ 697 in invoke │
│ │
│ 1694 │ │ │ │ super().invoke(ctx) │
│ 1695 │ │ │ │ sub_ctx = cmd.make_context(cmd_name, args, parent=ctx) │
│ 1696 │ │ │ │ with sub_ctx: │
│ ❱ 1697 │ │ │ │ │ return _process_result(sub_ctx.command.invoke(sub_ctx)) │
│ 1698 │ │ │
│ 1699 │ │ # In chain mode we create the contexts step by step, but after the │
│ 1700 │ │ # base command has been invoked. Because at that point we do not │
│ │
│ /opt/homebrew/Caskroom/miniconda/base/envs/nfct-dev/lib/python3.13/site-packages/click/core.py:1 │
│ 697 in invoke │
│ │
│ 1694 │ │ │ │ super().invoke(ctx) │
│ 1695 │ │ │ │ sub_ctx = cmd.make_context(cmd_name, args, parent=ctx) │
│ 1696 │ │ │ │ with sub_ctx: │
│ ❱ 1697 │ │ │ │ │ return _process_result(sub_ctx.command.invoke(sub_ctx)) │
│ 1698 │ │ │
│ 1699 │ │ # In chain mode we create the contexts step by step, but after the │
│ 1700 │ │ # base command has been invoked. Because at that point we do not │
│ │
│ /opt/homebrew/Caskroom/miniconda/base/envs/nfct-dev/lib/python3.13/site-packages/click/core.py:1 │
│ 443 in invoke │
│ │
│ 1440 │ │ │ echo(style(message, fg="red"), err=True) │
│ 1441 │ │ │
│ 1442 │ │ if self.callback is not None: │
│ ❱ 1443 │ │ │ return ctx.invoke(self.callback, **ctx.params) │
│ 1444 │ │
│ 1445 │ def shell_complete(self, ctx: Context, incomplete: str) -> t.List["CompletionItem"]: │
│ 1446 │ │ """Return a list of completions for the incomplete value. Looks │
│ │
│ /opt/homebrew/Caskroom/miniconda/base/envs/nfct-dev/lib/python3.13/site-packages/click/core.py:7 │
│ 88 in invoke │
│ │
│ 785 │ │ │
│ 786 │ │ with augment_usage_errors(__self): │
│ 787 │ │ │ with ctx: │
│ ❱ 788 │ │ │ │ return __callback(*args, **kwargs) │
│ 789 │ │
│ 790 │ def forward(__self, __cmd: "Command", *args: t.Any, **kwargs: t.Any) -> t.Any: │
│ 791 │ │ """Similar to :meth:`invoke` but fills in default keyword │
│ │
│ /opt/homebrew/Caskroom/miniconda/base/envs/nfct-dev/lib/python3.13/site-packages/click/decorator │
│ s.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/julian-qbic/Desktop/Projects/nf-core-tools/fork/nf_core/__main__.py:1788 in │
│ command_test_dataset_search │
│ │
│ 1785 │ Search files filtered by QUERY on a specified branch in the nf-core/test-datasets re │
│ 1786 │ If no QUERY is given or QUERY is ambiguous, an auto-completion form is shown. │
│ 1787 │ """ │
│ ❱ 1788 │ test_datasets_search(ctx, branch, generate_nf_path, generate_dl_url, query) │
│ 1789 │
│ 1790 │
│ 1791 # nf-core test-dataset search │
│ │
│ /Users/julian-qbic/Desktop/Projects/nf-core-tools/fork/nf_core/commands_test_datasets.py:40 in │
│ test_datasets_search │
│ │
│ 37 │ Specifying a branch is required. │
│ 38 │ The resulting file can optionally be parsed as a nextflow path or a url for download │
│ 39 │ """ │
│ ❱ 40 │ search_datasets(branch, generate_nf_path=generate_nf_path, generate_dl_url=generate_ │
│ 41 │
│ │
│ /Users/julian-qbic/Desktop/Projects/nf-core-tools/fork/nf_core/test_datasets/search.py:52 in │
│ search_datasets │
│ │
│ 49 │ │ │ file_selected = True │
│ 50 │ │
│ 51 │ while not file_selected: │
│ ❱ 52 │ │ selection = questionary.autocomplete( │
│ 53 │ │ │ "File:", choices=files, style=nfcore_question_style, default=query │
│ 54 │ │ ).unsafe_ask() │
│ 55 │
│ │
│ /opt/homebrew/Caskroom/miniconda/base/envs/nfct-dev/lib/python3.13/site-packages/questionary/pro │
│ mpts/autocomplete.py:212 in autocomplete │
│ │
│ 209 │ │ complete_style=complete_style, │
│ 210 │ │ **kwargs, │
│ 211 │ ) │
│ ❱ 212 │ p.default_buffer.reset(Document(default)) │
│ 213 │ │
│ 214 │ return Question(p.app) │
│ 215 │
│ │
│ /opt/homebrew/Caskroom/miniconda/base/envs/nfct-dev/lib/python3.13/site-packages/prompt_toolkit/ │
│ document.py:108 in __init__ │
│ │
│ 105 │ │ # cursor position is at the end of the document. This is what makes │
│ 106 │ │ # sense in most places. │
│ 107 │ │ if cursor_position is None: │
│ ❱ 108 │ │ │ cursor_position = len(text) │
│ 109 │ │ │
│ 110 │ │ # Keep these attributes private. A `Document` really has to be │
│ 111 │ │ # considered to be immutable, because otherwise the caching will break │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
TypeError: object of type 'NoneType' has no len()
System information
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working