Skip to content

Allow invoke to run tasks with type hinting #372

Closed

Description

@rsxm

Issue #248 mentions type hinting, but I think that is for Invoke to use type hinting internally. This issue is to allow Invoke to run tasks with type hinting annotations.

With current master, when defining a task like this:

@task
def hello(name: str = 'Anonymous'):
    print('Hello, {name}!'.format(name=name))

I get the following error message when trying to run this task:

ValueError: Function has keyword-only arguments or annotations, use getfullargspec() API which can support them

I followed the advice and replaced getargspec() in tasks.py with getfullargspec() and everything seems to work.

I don''t know the full implications of this change, but I'll create a fork and run the tests and see if something breaks.

Activity

  1. bitprophet commented on Jul 6, 2016

    @bitprophet
    Member

    See #357 :)

  2. rsxm commented on Jul 7, 2016

    @rsxm
    Author

    Thank you! Don't know how I missed that one, I thought I was thorough with my search of existing issues :-)

  3. deleted a comment from FranklinChen on May 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions