pyinvoke / invoke

Pythonic task management & command execution.
http://pyinvoke.org
BSD 2-Clause "Simplified" License
4.32k stars 365 forks source link

Small change to hide "private task" imported from another collection #623

Open FabriceSalvaire opened 5 years ago

FabriceSalvaire commented 5 years ago

Use case (Maybe I missed something ...)

# doc.py
from .clean import flycheck as _clean_flycheck

@task(_clean_flycheck, clean_api)
def make_api(ctx):
    ....

So as to don't register doc.flycheck which are available as clean.flycheck

I propose this change in collection.py Collection.from_module

# tasks = filter(lambda x: isinstance(x, Task), vars(module).values())
tasks = [obj for name, obj in vars(module).items() if isinstance(obj, Task) and not name.startswith('_')]
haydenflinner commented 5 years ago

I just merged this into my fork, you can try it out by doing pip install magicinvoke and (hopefully) without changing any of your code.