Skip to content

Consider making contextualization the default #114

@bitprophet

Description

@bitprophet

Occasionally catch myself doing the following:

from invoke import Collection, task

# stuff

@task
def foo(ctx, blah, otherblah):
    ctx.run("whatever")

ns = Collection(foo)

Which leads to a nice 'test' did not receive all required positional arguments! error, because task != ctask. Also I think part of an FAQ mentions this (!)

If it's something I do myself cuz I haven't written a new Invoke task in a month...it's gonna bite users. The un-contextualized use case is and should be the minority; therefore I really should:

  • Update docs to describe a "contextualized by default" setup, including removing mention of @ctask.
    • Maybe be hardcore and just don't even bother with uncontextualized tasks? Eh. Leaving the flag in allows people to rebind the name to an inverted-ctask if they really care about not using the context.
  • Update tests to match
  • Add new tests enforcing a useful "Did you forget a leading context argument?" add-on to the above error message, probably.
  • Implement.
  • Update all my stuff (whee! Good thing most of it is in Invocations...)
  • Add big honkin' backwards incompatibility note to teh changelog (maybe a good new Releases feature?)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions