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

Apostrophes in nf-core create descriptions break things #1989

Closed
ewels opened this issue Oct 31, 2022 · 1 comment
Closed

Apostrophes in nf-core create descriptions break things #1989

ewels opened this issue Oct 31, 2022 · 1 comment
Labels
bug Something isn't working
Milestone

Comments

@ewels
Copy link
Member

ewels commented Oct 31, 2022

Description of the bug

When using nf-core create with a description and a customised template, things break.

For example, Phil's test demo here is a problem, Phils test demo is not.

Command used and terminal output

$ nf-core create

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

    nf-core/tools version 2.7.dev0 - https://nf-co.re


? Workflow name demo
? Description Phil's test demo
? Author Phil
? Do you want to customize which parts of the template are used? Yes
? Pipeline prefix
ERROR    Pipeline prefix cannot start with digit or hyphen and cannot contain punctuation.    create.py:188
? Please provide a new pipeline prefix myprefix
? Skip template areas? [iGenomes config]
INFO     Creating new nf-core pipeline: 'myprefix/demo'                                       create.py:246
╭─────────────────────────────────── Traceback (most recent call last) ───────────────────────────────────╮
│ /Users/ewels/GitHub/nf-core/tools/nf_core/utils.py:293 in nextflow_cmd                                  │
│                                                                                                         │
│    292 │   try:                                                                                         │
│ ❱  293 │   │   nf_proc = subprocess.run(shlex.split(cmd), stdout=subprocess.PIPE,                       │
│        stderr=subprocess.PIPE, check=True)                                                              │
│    294 │   │   return nf_proc.stdout                                                                    │
│                                                                                                         │
│ /Users/ewels/.miniconda3/miniconda3/envs/py3.10/lib/python3.10/subprocess.py:524 in run                 │
│                                                                                                         │
│    523 │   │   if check and retcode:                                                                    │
│ ❱  524 │   │   │   raise CalledProcessError(retcode, process.args,                                      │
│    525 │   │   │   │   │   │   │   │   │    output=stdout, stderr=stderr)                               │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯
CalledProcessError: Command '['nextflow', 'config', '-flat', '/Users/ewels/demo/myprefix-demo']' returned
non-zero exit status 1.

During handling of the above exception, another exception occurred:

╭─────────────────────────────────── Traceback (most recent call last) ───────────────────────────────────╮
│ /Users/ewels/.miniconda3/miniconda3/envs/py3.10/bin/nf-core:8 in <module>                               │
│                                                                                                         │
│   7 │   sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])                                │
│ ❱ 8 │   sys.exit(run_nf_core())                                                                         │
│   9                                                                                                     │
│                                                                                                         │
│ /Users/ewels/GitHub/nf-core/tools/nf_core/__main__.py:104 in run_nf_core                                │
│                                                                                                         │
│    103 │   # Launch the click cli                                                                       │
│ ❱  104 │   nf_core_cli(auto_envvar_prefix="NFCORE")                                                     │
│    105                                                                                                  │
│                                                                                                         │
│ /Users/ewels/.miniconda3/miniconda3/envs/py3.10/lib/python3.10/site-packages/click/core.py:1130 in      │
│ __call__                                                                                                │
│                                                                                                         │
│   1129 │   │   """Alias for :meth:`main`."""                                                            │
│ ❱ 1130 │   │   return self.main(*args, **kwargs)                                                        │
│   1131                                                                                                  │
│                                                                                                         │
│ /Users/ewels/.miniconda3/miniconda3/envs/py3.10/lib/python3.10/site-packages/rich_click/rich_group.py:2 │
│ 1 in main                                                                                               │
│                                                                                                         │
│   20 │   │   try:                                                                                       │
│ ❱ 21 │   │   │   rv = super().main(*args, standalone_mode=False, **kwargs)                              │
│   22 │   │   │   if not standalone_mode:                                                                │
│                                                                                                         │
│ /Users/ewels/.miniconda3/miniconda3/envs/py3.10/lib/python3.10/site-packages/click/core.py:1055 in main │
│                                                                                                         │
│   1054 │   │   │   │   with self.make_context(prog_name, args, **extra) as ctx:                         │
│ ❱ 1055 │   │   │   │   │   rv = self.invoke(ctx)                                                        │
│   1056 │   │   │   │   │   if not standalone_mode:                                                      │
│                                                                                                         │
│ /Users/ewels/.miniconda3/miniconda3/envs/py3.10/lib/python3.10/site-packages/click/core.py:1657 in      │
│ invoke                                                                                                  │
│                                                                                                         │
│   1656 │   │   │   │   with sub_ctx:                                                                    │
│ ❱ 1657 │   │   │   │   │   return _process_result(sub_ctx.command.invoke(sub_ctx))                      │
│   1658                                                                                                  │
│                                                                                                         │
│ /Users/ewels/.miniconda3/miniconda3/envs/py3.10/lib/python3.10/site-packages/click/core.py:1404 in      │
│ invoke                                                                                                  │
│                                                                                                         │
│   1403 │   │   if self.callback is not None:                                                            │
│ ❱ 1404 │   │   │   return ctx.invoke(self.callback, **ctx.params)                                       │
│   1405                                                                                                  │
│                                                                                                         │
│ /Users/ewels/.miniconda3/miniconda3/envs/py3.10/lib/python3.10/site-packages/click/core.py:760 in       │
│ invoke                                                                                                  │
│                                                                                                         │
│    759 │   │   │   with ctx:                                                                            │
│ ❱  760 │   │   │   │   return __callback(*args, **kwargs)                                               │
│    761                                                                                                  │
│                                                                                                         │
│ /Users/ewels/GitHub/nf-core/tools/nf_core/__main__.py:299 in create                                     │
│                                                                                                         │
│    298 │   │   )                                                                                        │
│ ❱  299 │   │   create_obj.init_pipeline()                                                               │
│    300 │   except UserWarning as e:                                                                     │
│                                                                                                         │
│ /Users/ewels/GitHub/nf-core/tools/nf_core/create.py:230 in init_pipeline                                │
│                                                                                                         │
│   229 │   │   # Make the new pipeline                                                                   │
│ ❱ 230 │   │   self.render_template()                                                                    │
│   231                                                                                                   │
│                                                                                                         │
│ /Users/ewels/GitHub/nf-core/tools/nf_core/create.py:330 in render_template                              │
│                                                                                                         │
│   329 │   │   if not self.template_params["igenomes"] or not                                            │
│       self.template_params["nf_core_configs"]:                                                          │
│ ❱ 330 │   │   │   self.update_nextflow_schema()                                                         │
│   331                                                                                                   │
│                                                                                                         │
│ /Users/ewels/GitHub/nf-core/tools/nf_core/create.py:354 in update_nextflow_schema                       │
│                                                                                                         │
│   353 │   │   schema.load_schema()                                                                      │
│ ❱ 354 │   │   schema.get_wf_params()                                                                    │
│   355 │   │   schema.remove_schema_notfound_configs()                                                   │
│                                                                                                         │
│ /Users/ewels/GitHub/nf-core/tools/nf_core/schema.py:631 in get_wf_params                                │
│                                                                                                         │
│   630 │   │   log.debug("Collecting pipeline parameter defaults\n")                                     │
│ ❱ 631 │   │   config = nf_core.utils.fetch_wf_config(os.path.dirname(self.schema_filename))             │
│   632 │   │   skipped_params = []                                                                       │
│                                                                                                         │
│ /Users/ewels/GitHub/nf-core/tools/nf_core/utils.py:256 in fetch_wf_config                               │
│                                                                                                         │
│    255 │   # Call `nextflow config`                                                                     │
│ ❱  256 │   nfconfig_raw = nextflow_cmd(f"nextflow config -flat {wf_path}")                              │
│    257 │   for l in nfconfig_raw.splitlines():                                                          │
│                                                                                                         │
│ /Users/ewels/GitHub/nf-core/tools/nf_core/utils.py:299 in nextflow_cmd                                  │
│                                                                                                         │
│    298 │   except subprocess.CalledProcessError as e:                                                   │
│ ❱  299 │   │   raise AssertionError(                                                                    │
│    300 │   │   │   f"Command '{cmd}' returned non-zero error code '{e.returncode}':\n[red]>             │
│        {e.stderr.decode()}{e.stdout.decode()}"                                                          │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯
AssertionError: Command 'nextflow config -flat /Users/ewels/demo/myprefix-demo' returned non-zero error
code '1':
[red]> Unable to parse config file: '/Users/ewels/demo/myprefix-demo/nextflow.config'

  Compile failed for sources
FixedSetSources[name='/groovy/script/Script004AAD2CD5730977755502F494F3DF30/_nf_config_da03c119']. Cause:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
  /groovy/script/Script004AAD2CD5730977755502F494F3DF30/_nf_config_da03c119: 180: Unexpected character:
'\'' @ line 180, column 40.
         description     = 'Phil's test demo'
                                            ^

  1 error

System information

No response

@ewels ewels added the bug Something isn't working label Oct 31, 2022
@ewels ewels changed the title Hyphens in nf-core create descriptions break things Apostrophes in nf-core create descriptions break things Nov 3, 2022
@ewels ewels added this to the 2.7 milestone Nov 3, 2022
@mirpedrol
Copy link
Member

Fixed in #2066

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants