-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Add docker-py stubs #11749
Add docker-py stubs #11749
Conversation
This comment has been minimized.
This comment has been minimized.
So the mypy_primer errors seem justified. Some invalid imports (they work at runtime due to side-effects but are not allowed). In addition in |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There is already some precedent here: docker/docker-py#2796 |
I'm aware of this issue. There was no real progress since 3 years... |
Stubtest still has a few complaints. |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM after a casual scan. One optional suggestion below.
Diff from mypy_primer, showing the effect of this PR on open source code: prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/utilities/dockerutils.py:98: error: Cannot find implementation or library stub for module named "docker" [import-not-found]
+ src/prefect/utilities/dockerutils.py:431: error: Name "docker.Image" is not defined [name-defined]
- src/prefect/infrastructure/container.py:47: error: Cannot find implementation or library stub for module named "docker" [import-not-found]
- src/prefect/infrastructure/container.py:49: error: Cannot find implementation or library stub for module named "docker.models.containers" [import-not-found]
+ src/prefect/infrastructure/container.py:508: error: Argument 1 to "_build_container_settings" of "DockerContainer" has incompatible type "Coroutine[Any, Any, DockerClient]"; expected "DockerClient" [arg-type]
+ src/prefect/infrastructure/container.py:508: note: Maybe you forgot to use "await"?
+ src/prefect/infrastructure/container.py:510: error: Argument 1 to "_should_pull_image" of "DockerContainer" has incompatible type "Coroutine[Any, Any, DockerClient]"; expected "DockerClient" [arg-type]
+ src/prefect/infrastructure/container.py:510: note: Maybe you forgot to use "await"?
+ src/prefect/infrastructure/container.py:512: error: Argument 1 to "_pull_image" of "DockerContainer" has incompatible type "Coroutine[Any, Any, DockerClient]"; expected "DockerClient" [arg-type]
+ src/prefect/infrastructure/container.py:512: note: Maybe you forgot to use "await"?
+ src/prefect/infrastructure/container.py:514: error: Argument 1 to "_create_container" of "DockerContainer" has incompatible type "Coroutine[Any, Any, DockerClient]"; expected "DockerClient" [arg-type]
+ src/prefect/infrastructure/container.py:514: note: Maybe you forgot to use "await"?
- src/prefect/infrastructure/container.py:520: error: "Coroutine[Any, Any, Any]" has no attribute "networks" [attr-defined]
+ src/prefect/infrastructure/container.py:520: error: "Coroutine[Any, Any, DockerClient]" has no attribute "networks" [attr-defined]
- src/prefect/infrastructure/container.py:637: error: Cannot find implementation or library stub for module named "docker.errors" [import-not-found]
+ src/prefect/infrastructure/container.py:520: note: Maybe you forgot to use "await"?
+ src/prefect/infrastructure/container.py:666: error: Incompatible types in assignment (expression has type "None", variable has type "Container") [assignment]
+ src/prefect/infrastructure/container.py:678: error: Missing return statement [return]
+ src/prefect/infrastructure/container.py:687: error: Incompatible types in "yield" (actual type "Container", expected type "None") [misc]
+ src/prefect/infrastructure/container.py:713: error: Incompatible types in "yield" (actual type "Container", expected type "None") [misc]
+ src/prefect/infrastructure/container.py:719: error: Incompatible types in "yield" (actual type "Container", expected type "None") [misc]
- src/prefect/cli/dev.py:405: error: Cannot find implementation or library stub for module named "docker" [import-not-found]
- src/prefect/cli/dev.py:406: error: Cannot find implementation or library stub for module named "docker.models.containers" [import-not-found]
paasta (https://github.com/yelp/paasta)
+ paasta_tools/utils.py:76: error: Module "docker" has no attribute "Client"; maybe "APIClient"? [attr-defined]
+ paasta_tools/utils.py:3490: error: Unexpected keyword argument "assert_hostname" for "kwargs_from_env" [call-arg]
dragonchain (https://github.com/dragonchain/dragonchain)
+ dragonchain/job_processor/contract_job.py:251:16: error: Module has no attribute "errors" [attr-defined]
+ dragonchain/job_processor/contract_job.py:268:17: error: Module has no attribute "errors" [attr-defined]
+ dragonchain/job_processor/contract_job.py:280:16: error: Module has no attribute "errors" [attr-defined]
+ dragonchain/job_processor/contract_job_utest.py:251:13: error: "Callable[[Any, Optional[str], bool, KwArg(Any)], Any]" has no attribute "assert_called" [attr-defined]
|
No description provided.