Skip to content

Commit c4eaaca

Browse files
authored
[docker] Update to 7.2.* (#16029)
1 parent 6fb14c9 commit c4eaaca

6 files changed

Lines changed: 60 additions & 11 deletions

File tree

stubs/docker/@tests/stubtest_allowlist.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,9 @@ docker.models.resource.Collection.model
99
# keyword arguments are now unsupported
1010
docker.api.container.ContainerApiMixin.start
1111

12+
# implementation has *args and **kwargs params that can't be used
13+
docker.client.DockerClient.info
14+
docker.client.DockerClient.ping
15+
1216
# Internal-use module for types shared by multiple modules.
1317
docker._types

stubs/docker/METADATA.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
version = "7.1.*"
1+
version = "7.2.*"
22
upstream-repository = "https://github.com/docker/docker-py"
33
dependencies = ["types-paramiko", "types-requests", "urllib3>=2"]

stubs/docker/docker/__init__.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from typing import Final
22

33
from .api import APIClient as APIClient
4-
from .client import DockerClient as DockerClient, from_env as from_env
4+
from .client import DockerClient as DockerClient, from_context as from_context, from_env as from_env
55
from .context import Context as Context, ContextAPI as ContextAPI
66
from .tls import TLSConfig as TLSConfig
77
from .version import __version__ as __version__

stubs/docker/docker/client.pyi

Lines changed: 47 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from collections.abc import Iterable
1+
from _typeshed import Incomplete
2+
from collections.abc import Iterable, Mapping
23
from typing import Any, Literal, NoReturn, Protocol, overload, type_check_only
34

45
from docker import APIClient
@@ -12,6 +13,7 @@ from docker.models.secrets import SecretCollection
1213
from docker.models.services import ServiceCollection
1314
from docker.models.swarm import Swarm
1415
from docker.models.volumes import VolumeCollection
16+
from docker.tls import TLSConfig
1517
from docker.types import CancellableStream
1618

1719
@type_check_only
@@ -21,17 +23,45 @@ class _Environ(Protocol):
2123

2224
class DockerClient:
2325
api: APIClient
24-
def __init__(self, *args, **kwargs) -> None: ...
26+
# Please keep in sync with docker.APIClient
27+
def __init__(
28+
self,
29+
base_url: str | None = None,
30+
version: str | None = None,
31+
timeout: int = 60,
32+
tls: bool | TLSConfig = False,
33+
user_agent: str = ...,
34+
num_pools: int | None = None,
35+
credstore_env: Mapping[Incomplete, Incomplete] | None = None,
36+
use_ssh_client: bool = False,
37+
max_pool_size: int = 10,
38+
) -> None: ...
2539
@classmethod
2640
def from_env(
2741
cls,
2842
*,
2943
version: str | None = None,
30-
timeout: int = ...,
31-
max_pool_size: int = ...,
44+
timeout: int = 60,
45+
max_pool_size: int = 10,
3246
environment: _Environ | None = None,
3347
use_ssh_client: bool = False,
48+
use_context: bool = True,
3449
) -> DockerClient: ...
50+
@classmethod
51+
def from_context(
52+
cls,
53+
name=None,
54+
*,
55+
version: str | None = None,
56+
timeout: int = 60,
57+
max_pool_size: int = 10,
58+
use_ssh_client: bool = False,
59+
base_url: str | None = None,
60+
tls: bool | TLSConfig = False,
61+
user_agent: str = ...,
62+
num_pools: int | None = None,
63+
credstore_env: Mapping[Incomplete, Incomplete] | None = None,
64+
): ...
3565
@property
3666
def configs(self) -> ConfigCollection: ...
3767
@property
@@ -59,11 +89,20 @@ class DockerClient:
5989
def events(self, *args, decode: Literal[True] = ..., **kwargs) -> CancellableStream[dict[str, Any]]: ...
6090

6191
def df(self) -> dict[str, Any]: ...
62-
def info(self, *args, **kwargs) -> dict[str, Any]: ...
63-
def login(self, *args, **kwargs) -> dict[str, Any]: ...
64-
def ping(self, *args, **kwargs) -> bool: ...
65-
def version(self, *args, **kwargs) -> dict[str, Any]: ...
92+
def info(self) -> dict[str, Any]: ...
93+
def login(
94+
self,
95+
username: str,
96+
password: str | None = None,
97+
email: str | None = None,
98+
registry: str | None = None,
99+
reauth: bool = False,
100+
dockercfg_path: str | None = None,
101+
) -> dict[str, Any]: ...
102+
def ping(self) -> bool: ...
103+
def version(self, api_version: bool = True) -> dict[str, Any]: ...
66104
def close(self) -> None: ...
67105
def __getattr__(self, name: str) -> NoReturn: ...
68106

69107
from_env = DockerClient.from_env
108+
from_context = DockerClient.from_context

stubs/docker/docker/context/api.pyi

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from collections.abc import Sequence
1+
from _typeshed import Incomplete
2+
from collections.abc import Mapping, Sequence
23

34
from docker.context.context import Context
45
from docker.tls import TLSConfig
@@ -22,6 +23,10 @@ class ContextAPI:
2223
@classmethod
2324
def get_current_context(cls) -> Context: ...
2425
@classmethod
26+
def kwargs_from_context(
27+
cls, name: str | None = None, environment: Mapping[str, str | None] | None = None
28+
) -> dict[str, Incomplete]: ... # TODO: Use TypedDict, use SupportsGet
29+
@classmethod
2530
def set_current_context(cls, name: str = "default") -> None: ...
2631
@classmethod
2732
def remove_context(cls, name: str) -> None: ...

stubs/docker/docker/types/services.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ class Mount(dict[str, Any]):
7070
driver_config: DriverConfig | None = None,
7171
tmpfs_size: int | str | None = None,
7272
tmpfs_mode: int | None = None,
73+
subpath: str | None = None,
7374
) -> None: ...
7475
@classmethod
7576
def parse_mount_string(cls, string: str) -> Mount: ...

0 commit comments

Comments
 (0)