Commit Graph

45 Commits

Author SHA1 Message Date
Dun L
d2ca658a69 Fix missed type hints in docker containers.pyi (#13136)
Previously, `Container.exec_run` and `Container.get_archive` missed type hints on `cmd` and `path` arguments, respectively.
Added type hints based on docstring.
2024-12-27 21:14:27 -08:00
Károly Szabó
257691b5c5 [docker-py] Fix 'volumes' argument type hint for 'run' and 'create' functions in containers.pyi (#12594) 2024-08-26 15:20:02 +02:00
kasium
225145cde5 chunk_size parameter of get_image accepts None (#12560) 2024-08-20 13:22:59 +02:00
sobolevn
6f248dfa37 Bump mypy to 1.11.1 (#12463) 2024-08-04 23:19:28 -07:00
Nelson Yeung
389b318691 [docker] Add restart_policy type annotation to Container model (#12366) 2024-07-19 18:39:29 +02:00
Oguzhan Mete Ozturk
6db5f35f4d [docker] Update ports type annotation (#12284) 2024-07-10 11:57:27 +02:00
Adam Dangoor
02d2f5f09e Specify stream type of Docker logs (#12214)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-07-02 18:47:47 +01:00
Adam Dangoor
712e4146ef Allow users of docker run, create to not give name/version (#12234) 2024-06-28 13:29:20 +02:00
Adam Dangoor
ea869e2959 Add kwarg types to Docker container run and create (#12216) 2024-06-27 10:11:47 +02:00
Adam Dangoor
2d9b0fd2a0 Add Container wait return type at Docker model layer (#12217)
Also, improve type for the API layer. Previously, the type accounted for a 404 response. However, in the 404 case, a `docker.errors.NotFound` exception is raised.
2024-06-27 09:58:43 +02:00
Adam Dangoor
60443ca258 Add more keyword argument types for Docker pull (#12210) 2024-06-25 15:23:03 +02:00
Adam Dangoor
ff35709167 Add parameter types to docker.models.images.ImageCollection.build (#12196)
Introduce stubs-only module `docker._types`.
2024-06-25 14:18:21 +02:00
Adam Dangoor
1535e93674 Add return types to docker container run (#12206) 2024-06-25 14:04:48 +02:00
Adam Dangoor
da443145bc Add more specific types to Docker network inspect/get equivalent methods (#12188) 2024-06-24 12:38:32 +02:00
Adam Dangoor
f66d687b08 Add types for container and net_id parameters in docker/api/network (#12042) 2024-06-24 11:31:02 +02:00
Adam Dangoor
c8898742e0 Add parameter types to docker's NetworkCollection create (#12190) 2024-06-24 11:28:24 +02:00
Adam Dangoor
8cdda79ae3 Add more precise types in docker.types.containers (#12191) 2024-06-24 11:27:57 +02:00
Adam Dangoor
5c3401a545 Use more specific types for Docker create_network (#12187) 2024-06-23 10:04:20 +02:00
Adam Dangoor
820447c57b Add some types for Docker.api.network.NetworkApiMixing.create_network parameters (#12156)
See implementation at
a3652028b1/docker/api/network.py (L40)
2024-06-20 00:15:54 -07:00
Adam Dangoor
1af9de664f [docker] Add a number of types to docker.models.containers.Container (#12077) 2024-06-16 12:05:42 +02:00
Adam Dangoor
64af79f98b [docker] Annotate Container.stop() (#12052) 2024-05-31 10:30:02 +02:00
Nikita Sobolev
66c640ece9 Update docker to 7.1.x (#12068) 2024-05-31 08:56:49 +02:00
Adam Dangoor
b2f6e5221b Add types to docker.models.containers.Container.logs (#12044) 2024-05-28 13:55:18 +02:00
Adam Dangoor
41cc4f9ede Add keyword argument types to docker.models.containers.Container.wait() (#12037) 2024-05-27 20:19:29 +03:00
Adam Dangoor
a9a52a0e10 Add return type for Docker Container wait (#12036) 2024-05-26 11:43:31 +02:00
Adam Dangoor
933444d1a8 Add types to parameters for Docker Network.disconnect (#12007) 2024-05-23 10:10:13 +02:00
Adam Dangoor
e1bb4edfe4 Add types for Docker client from_env kwargs (#11989) 2024-05-23 00:25:36 +02:00
Adam Dangoor
55b552121b Fix type of Docker BuildError.build_log (#11917)
In working this out I also had a go at changing the json_stream
functions used to create every BuildError in docker-py.

There are two `BuildError`s raised in docker-py, both in
b6464dbed9/docker/models/images.py (L304-L315)

```python
result_stream, internal_stream = itertools.tee(json_stream(resp))
for chunk in internal_stream:
    if 'error' in chunk:
	raise BuildError(chunk['error'], result_stream)
    if 'stream' in chunk:
	match = re.search(
	    r'(^Successfully built |sha256:)([0-9a-f]+)$',
	    chunk['stream']
	)
	if match:
	    image_id = match.group(2)
    last_event = chunk
if image_id:
    return (self.get(image_id), result_stream)
raise BuildError(last_event or 'Unknown', result_stream)
```
2024-05-18 08:26:17 -04:00
Adam Dangoor
a9d7e861f7 Add a number of types to docker.models.containers (#11912) 2024-05-14 11:15:32 +02:00
Adam Dangoor
0382803c4c Add many types to docker.api.container (#11911) 2024-05-12 13:58:56 -07:00
Adam Dangoor
a4c4076b61 Add types to all "container" parameters in docker.api.container (#11908) 2024-05-12 18:07:48 +02:00
Adam Dangoor
96697a835b Add remaining parameter types to docker.api.container logs (#11907) 2024-05-12 17:12:32 +02:00
Adam Dangoor
932311d441 Add return type to Docker Container.logs (#11888) 2024-05-12 13:39:18 +02:00
Adam Dangoor
488bc24c43 Add return type for Docker container start (#11905) 2024-05-12 13:37:00 +02:00
Adam Dangoor
bbad7f2f24 Fix "tail" parameter type for Docker container logs (#11906) 2024-05-12 13:09:47 +02:00
Adam Dangoor
f75211b801 Allow Image type for docker container run image parameter (#11900) 2024-05-12 12:14:06 +02:00
Adam Dangoor
9174db0d7d Add some types to Docker ContainerCollection parameters (#11857) 2024-05-10 10:08:47 +02:00
Adam Dangoor
727f3c4320 Add return type to Docker Container.stop (#11869)
We can see at
b6464dbed9/docker/models/containers.py (L452)
that this returns the return value of `self.client.api.stop`.

We can see at
b6464dbed9/docker/api/container.py (L1187)
that this returns None.
2024-05-06 11:05:43 +02:00
Adam Dangoor
113b2ccd42 Add return type to Docker Container.remove (#11868) 2024-05-06 11:01:55 +02:00
kasium
4005c2f214 Improve types in docker models (#11859) 2024-05-05 12:32:37 +02:00
Adam Dangoor
5883898b0a [docker-py] Add return type for building a Docker image (#11851) 2024-05-02 10:08:32 +02:00
kasium
f244be921e Improve docker api types (#11846) 2024-04-30 13:43:08 +02:00
kasium
78a86de5d9 Add types to docker/context (#11818) 2024-04-29 14:27:55 +02:00
kasium
312dfe5791 Fully type docker/api/build (#11789) 2024-04-23 08:34:19 +02:00
kasium
bc8fc36739 Add docker-py stubs (#11749) 2024-04-12 15:30:36 +02:00