Skip to content
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

"task" is not exported from module "invoke" #1013

Open
rr326 opened this issue Nov 12, 2024 · 2 comments
Open

"task" is not exported from module "invoke" #1013

rr326 opened this issue Nov 12, 2024 · 2 comments

Comments

@rr326
Copy link

rr326 commented Nov 12, 2024

I am using vscode. I get a pylance warning:
"task" is not exported from module "invoke"

This is from this line:
from invoke import task

It all works, but is a little annoying.

I'm not sure the sophisticated way to do it in a library, but you could add a complete __all__= in your main __init__.py.

For instace:

# At bottom of __init__.py

__all__ = (
    "__version_info__",
    "__version__",
    "AmbiguousEnvVar",
    "Argument",
    "AuthFailure",
    "Call",
    "Collection",
    "CollectionNotFound",
    "CommandTimedOut",
    "Config",
    "Context",
    "Exit",
    "Executor",
    "FailingResponder",
    "Failure",
    "FilesystemLoader",
    "Local",
    "MockContext",
    "ParseError",
    "Parser",
    "ParserContext",
    "ParseResult",
    "PlatformError",
    "Program",
    "Promise",
    "pty_size",
    "Responder",
    "ResponseNotAccepted",
    "Result",
    "Runner",
    "run",
    "StreamWatcher",
    "SubprocessPipeError",
    "sudo",
    "task",
    "Task",
    "call",
    "ThreadException",
    "UncastableEnvVar",
    "UnexpectedExit",
    "UnknownFileType",
    "UnpicklableConfigMember",
    "WatcherError",
)

This is also covered in #814, but I think the solution mentioned there is not ideal.

@vlcinsky
Copy link

Installing types-invoke resolves that problem for me.

Of course, it would be nicer, if I would not have to install this additional dependency.

@rr326
Copy link
Author

rr326 commented Nov 18, 2024

This note from types-invoke makes me think I would be losing something

Note: The invoke package includes type annotations or type stubs since version 2.1.2. Please uninstall the types-invoke package if you use this or a newer version.

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

No branches or pull requests

2 participants