Skip to content

Added support for decorated tasks - #399

Closed
frol wants to merge 1 commit into
pyinvoke:masterfrom
frol:patch-3
Closed

frol wants to merge 1 commit into
pyinvoke:masterfrom
frol:patch-3

Conversation

@frol

@frol frol commented Oct 20, 2016

Copy link
Copy Markdown

Currently, there is no way to use decorators with Invoke tasks:

import functools

def my_decorator(func):
    @functools.wraps(func)
    def wrapper(*args, **kwargs):
        print("Decorated call")
        return func(*args, **kwargs)
    return wrapper

@task
@my_decorator
def my_task(context, name, option1=1):
    print("Hello, %s!" % name)

This code will complain about missing context positional argument due to the fact that the wrapper defines *args, **kwargs.

Adding this small patch, argspec will respect __wrapped__ field pointing to the decorated function.

@bitprophet

Copy link
Copy Markdown
Member

Possible dupe of #246, and linking to possibly related #313

@frol

frol commented Oct 20, 2016

Copy link
Copy Markdown
Author

This PR doesn't address #313. However, it is indeed covers the #246, though I find my implementation much simpler.

@frol

frol commented Oct 27, 2016

Copy link
Copy Markdown
Author

So?...

@bitprophet

Copy link
Copy Markdown
Member

Please don't bump tickets, it's rude & wastes the maintainers' time :(

@frol

frol commented Oct 29, 2016

Copy link
Copy Markdown
Author

Please, don't ignore at least pull requests (i.e. others time to read your code and make a patch), it is rude and doesn't make any good for a project.

You haven't got back to #189, #190 (just a few examples of PRs) with any response at all after TWO YEARS, so I will bump the tickets unless I give up on this unmaintainable heap of buggy code.

@bitprophet

Copy link
Copy Markdown
Member

I seriously don't have time for that sort of nonsense. Blocked :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants