`auto_dash_names` setting not working when using `Collection` with modules in `__init__`
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 48/100
Research direction
Reproduce the issue with invoke.yaml, tasks/init.py, tasks/module_a.py, and tasks/module_b.py, then run invoke --list. Trace how the Collection built in tasks/init.py applies auto_dash_names to imported modules. Done means the setting is respected and the listed task names match the configured underscore style.
Written by the indexing model from the issue text.
Description
We've found that auto_dash_names setting is not taking effect when setting up a collection from a module in the __init__.py file
Output
invoke --list
Available tasks:
module_a.a-task
module_b.b-task
The only issue I could find was closed a while back, not sure if this is a symptom of that described in this comment? https://github.com/pyinvoke/invoke/issues/465#issuecomment-319767461
Repro
invoke.yaml:
tasks:
auto_dash_names: false
tasks/__init__.py:
from invoke import Collection
from . import module_a, module_b
ns = Collection(module_a, module_b)
tasks/module_a.py:
from invoke import task
@task
def a_task(c):
c.run('echo foo')
tasks/module_b.py:
from invoke import task
@task
def b_task(c):
c.run('echo bar')
Versions
Python 3.12.2
Invoke 2.2.0
- Dominant language
- Python
- Stars
- 4.8k
- Forks
- 412
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from pyinvoke/invoke
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100