-
Notifications
You must be signed in to change notification settings - Fork 367
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
TypeError: Tasks must have an initial Context argument! #362
Comments
I'm very new to Invoke (10 minutes experience), but for those like me running into this bug, a temporary workaround is to add a positional argument to the tasks, e.g.:
|
Thanks for your fresh eyes @kynikos. 👀 I also had to pass the context object along to child tasks. @task
def build(ctx):
foo(ctx)
@task
def foo(ctx):
print("Building!") It is not so much a temporary work around as it is using the 0.13 API for invoke. I will leave this issue open for now and suggest documenting breaking changes in a change log or upgrade notes. |
It is worth noting that the readme example shows calling It would be nice if the task implementation created a new context instance for you when initializing a task and when calling a subtask. |
Hi @deckar01 In the Changelog for 0.13.0 you can see that [Feature] #114 has a backwards incompatible change. Now, all tasks are contextualized and ctask is not needed anymore. It also broke my invoke program, thanks to unit testing, I could easily discover this change and fix it :) You can check the new documentation , you basically already fixed the problem |
Since i'ts in the change log and no backwards compatibility is being enforced pre 1.0.0, I will close this issue. I will have to be more strict with my version pinning in the future. |
It's really neccesary making ctx a required argument? I'm not using it in most on my methods so I get
lint error all the time. EDIT I've found this workaround to silence the linter error only for ctx.
|
Upgrading from v0.12.2 to v0.13.0 gives causes my task to error with
TypeError: Tasks must have an initial Context argument!
.0ce6220...7f8fdc3#diff-a2c23243533cad12946af2f1122bb4ebR144
The text was updated successfully, but these errors were encountered: