dycw-utilities 0.175.31__py3-none-any.whl → 0.175.33__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {dycw_utilities-0.175.31.dist-info → dycw_utilities-0.175.33.dist-info}/METADATA +1 -1
- {dycw_utilities-0.175.31.dist-info → dycw_utilities-0.175.33.dist-info}/RECORD +6 -6
- utilities/__init__.py +1 -1
- utilities/docker.py +29 -23
- {dycw_utilities-0.175.31.dist-info → dycw_utilities-0.175.33.dist-info}/WHEEL +0 -0
- {dycw_utilities-0.175.31.dist-info → dycw_utilities-0.175.33.dist-info}/entry_points.txt +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
utilities/__init__.py,sha256=
|
|
1
|
+
utilities/__init__.py,sha256=jL_ivCZ7rlDezKhNQ0JGInHxBEA6UFb4yN1d4M7P1p4,61
|
|
2
2
|
utilities/altair.py,sha256=TLfRFbG9HwG7SLXoJ-v0r-t49ZaGgTQZD82cpjVi4vs,9085
|
|
3
3
|
utilities/asyncio.py,sha256=aJySVxBY0gqsIYnoNmH7-1r8djKuf4vSsU69VCD08t8,16772
|
|
4
4
|
utilities/atomicwrites.py,sha256=tPo6r-Rypd9u99u66B9z86YBPpnLrlHtwox_8Z7T34Y,5790
|
|
@@ -11,7 +11,7 @@ utilities/contextvars.py,sha256=J8OhC7jqozAGYOCe2KUWysbPXNGe5JYz3HfaY_mIs08,883
|
|
|
11
11
|
utilities/cryptography.py,sha256=5PFrzsNUGHay91dFgYnDKwYprXxahrBqztmUqViRzBk,956
|
|
12
12
|
utilities/cvxpy.py,sha256=Rv1-fD-XYerosCavRF8Pohop2DBkU3AlFaGTfD8AEAA,13776
|
|
13
13
|
utilities/dataclasses.py,sha256=xbU3QN1GFy7RC6hIJRZIeUZm7YRlodrgEWmahWG6k2g,32465
|
|
14
|
-
utilities/docker.py,sha256=
|
|
14
|
+
utilities/docker.py,sha256=_cUgyU3207VH8e6IdQ88GNssvOVSkvEsUx95LiaayjY,10635
|
|
15
15
|
utilities/enum.py,sha256=5l6pwZD1cjSlVW4ss-zBPspWvrbrYrdtJWcg6f5_J5w,5781
|
|
16
16
|
utilities/errors.py,sha256=mFlDGSM0LI1jZ1pbqwLAH3ttLZ2JVIxyZLojw8tGVZU,1479
|
|
17
17
|
utilities/fastapi.py,sha256=TqyKvBjiMS594sXPjrz-KRTLMb3l3D3rZ1zAYV7GfOk,1454
|
|
@@ -97,7 +97,7 @@ utilities/warnings.py,sha256=un1LvHv70PU-LLv8RxPVmugTzDJkkGXRMZTE2-fTQHw,1771
|
|
|
97
97
|
utilities/whenever.py,sha256=F4ek0-OBWxHYrZdmoZt76N2RnNyKY5KrEHt7rqO4AQE,60183
|
|
98
98
|
utilities/zipfile.py,sha256=24lQc9ATcJxHXBPc_tBDiJk48pWyRrlxO2fIsFxU0A8,699
|
|
99
99
|
utilities/zoneinfo.py,sha256=tdIScrTB2-B-LH0ukb1HUXKooLknOfJNwHk10MuMYvA,3619
|
|
100
|
-
dycw_utilities-0.175.
|
|
101
|
-
dycw_utilities-0.175.
|
|
102
|
-
dycw_utilities-0.175.
|
|
103
|
-
dycw_utilities-0.175.
|
|
100
|
+
dycw_utilities-0.175.33.dist-info/WHEEL,sha256=RRVLqVugUmFOqBedBFAmA4bsgFcROUBiSUKlERi0Hcg,79
|
|
101
|
+
dycw_utilities-0.175.33.dist-info/entry_points.txt,sha256=cOGtKeJI0KXLSV7MJ8Dhc2G8jPgDcBDm53MVNJU4ycI,136
|
|
102
|
+
dycw_utilities-0.175.33.dist-info/METADATA,sha256=UbMzH_4ZM4Vd4DyXOwG1tJB23ThMqnLoerrDvGCm7N8,1443
|
|
103
|
+
dycw_utilities-0.175.33.dist-info/RECORD,,
|
utilities/__init__.py
CHANGED
utilities/docker.py
CHANGED
|
@@ -73,30 +73,36 @@ def docker_compose_pull_cmd(
|
|
|
73
73
|
def docker_compose_up(
|
|
74
74
|
*,
|
|
75
75
|
files: MaybeIterable[PathLike] | None = None,
|
|
76
|
+
detach: bool = True,
|
|
76
77
|
print: bool = False, # noqa: A002
|
|
77
78
|
print_stdout: bool = False,
|
|
78
79
|
print_stderr: bool = False,
|
|
79
80
|
) -> None:
|
|
80
81
|
"""Create and start containers."""
|
|
81
|
-
args = docker_compose_up_cmd(files=files) # pragma: no cover
|
|
82
|
+
args = docker_compose_up_cmd(files=files, detach=detach) # pragma: no cover
|
|
82
83
|
run( # pragma: no cover
|
|
83
84
|
*args, print=print, print_stdout=print_stdout, print_stderr=print_stderr
|
|
84
85
|
)
|
|
85
86
|
|
|
86
87
|
|
|
87
|
-
def docker_compose_up_cmd(
|
|
88
|
+
def docker_compose_up_cmd(
|
|
89
|
+
*, files: MaybeIterable[PathLike] | None = None, detach: bool = True
|
|
90
|
+
) -> list[str]:
|
|
88
91
|
"""Command to use 'docker compose up' to create and start containers."""
|
|
89
|
-
|
|
92
|
+
args: list[str] = []
|
|
93
|
+
if detach:
|
|
94
|
+
args.append("--detach")
|
|
95
|
+
return _docker_compose_cmd("up", *args, files=files)
|
|
90
96
|
|
|
91
97
|
|
|
92
98
|
def _docker_compose_cmd(
|
|
93
|
-
cmd: str, /,
|
|
99
|
+
cmd: str, /, *args: str, files: MaybeIterable[PathLike] | None = None
|
|
94
100
|
) -> list[str]:
|
|
95
|
-
|
|
101
|
+
all_args: list[str] = ["docker", "compose"]
|
|
96
102
|
if files is not None:
|
|
97
103
|
for file in always_iterable(files):
|
|
98
|
-
|
|
99
|
-
return [*
|
|
104
|
+
all_args.extend(["--file", str(file)])
|
|
105
|
+
return [*all_args, cmd, *args]
|
|
100
106
|
|
|
101
107
|
|
|
102
108
|
##
|
|
@@ -168,7 +174,7 @@ def docker_exec(
|
|
|
168
174
|
container: str,
|
|
169
175
|
cmd: str,
|
|
170
176
|
/,
|
|
171
|
-
*
|
|
177
|
+
*args: str,
|
|
172
178
|
env: StrStrMapping | None = None,
|
|
173
179
|
user: str | None = None,
|
|
174
180
|
workdir: PathLike | None = None,
|
|
@@ -188,7 +194,7 @@ def docker_exec(
|
|
|
188
194
|
container: str,
|
|
189
195
|
cmd: str,
|
|
190
196
|
/,
|
|
191
|
-
*
|
|
197
|
+
*args: str,
|
|
192
198
|
env: StrStrMapping | None = None,
|
|
193
199
|
user: str | None = None,
|
|
194
200
|
workdir: PathLike | None = None,
|
|
@@ -208,7 +214,7 @@ def docker_exec(
|
|
|
208
214
|
container: str,
|
|
209
215
|
cmd: str,
|
|
210
216
|
/,
|
|
211
|
-
*
|
|
217
|
+
*args: str,
|
|
212
218
|
env: StrStrMapping | None = None,
|
|
213
219
|
user: str | None = None,
|
|
214
220
|
workdir: PathLike | None = None,
|
|
@@ -228,7 +234,7 @@ def docker_exec(
|
|
|
228
234
|
container: str,
|
|
229
235
|
cmd: str,
|
|
230
236
|
/,
|
|
231
|
-
*
|
|
237
|
+
*args: str,
|
|
232
238
|
env: StrStrMapping | None = None,
|
|
233
239
|
user: str | None = None,
|
|
234
240
|
workdir: PathLike | None = None,
|
|
@@ -248,7 +254,7 @@ def docker_exec(
|
|
|
248
254
|
container: str,
|
|
249
255
|
cmd: str,
|
|
250
256
|
/,
|
|
251
|
-
*
|
|
257
|
+
*args: str,
|
|
252
258
|
env: StrStrMapping | None = None,
|
|
253
259
|
user: str | None = None,
|
|
254
260
|
workdir: PathLike | None = None,
|
|
@@ -267,7 +273,7 @@ def docker_exec(
|
|
|
267
273
|
container: str,
|
|
268
274
|
cmd: str,
|
|
269
275
|
/,
|
|
270
|
-
*
|
|
276
|
+
*args: str,
|
|
271
277
|
env: StrStrMapping | None = None,
|
|
272
278
|
user: str | None = None,
|
|
273
279
|
workdir: PathLike | None = None,
|
|
@@ -283,10 +289,10 @@ def docker_exec(
|
|
|
283
289
|
**env_kwargs: str,
|
|
284
290
|
) -> str | None:
|
|
285
291
|
"""Execute a command in a container."""
|
|
286
|
-
|
|
292
|
+
run_cmd_and_args = docker_exec_cmd( # skipif-ci
|
|
287
293
|
container,
|
|
288
294
|
cmd,
|
|
289
|
-
*
|
|
295
|
+
*args,
|
|
290
296
|
env=env,
|
|
291
297
|
interactive=input is not None,
|
|
292
298
|
user=user,
|
|
@@ -294,7 +300,7 @@ def docker_exec(
|
|
|
294
300
|
**env_kwargs,
|
|
295
301
|
)
|
|
296
302
|
return run( # skipif-ci
|
|
297
|
-
*
|
|
303
|
+
*run_cmd_and_args,
|
|
298
304
|
input=input,
|
|
299
305
|
print=print,
|
|
300
306
|
print_stdout=print_stdout,
|
|
@@ -311,7 +317,7 @@ def docker_exec_cmd(
|
|
|
311
317
|
container: str,
|
|
312
318
|
cmd: str,
|
|
313
319
|
/,
|
|
314
|
-
*
|
|
320
|
+
*args: str,
|
|
315
321
|
env: StrStrMapping | None = None,
|
|
316
322
|
interactive: bool = False,
|
|
317
323
|
user: str | None = None,
|
|
@@ -319,17 +325,17 @@ def docker_exec_cmd(
|
|
|
319
325
|
**env_kwargs: str,
|
|
320
326
|
) -> list[str]:
|
|
321
327
|
"""Command to use `docker exec` to execute a command in a container."""
|
|
322
|
-
|
|
328
|
+
all_args: list[str] = ["docker", "exec"]
|
|
323
329
|
mapping: dict[str, str] = ({} if env is None else dict(env)) | env_kwargs
|
|
324
330
|
for key, value in mapping.items():
|
|
325
|
-
|
|
331
|
+
all_args.extend(["--env", f"{key}={value}"])
|
|
326
332
|
if interactive:
|
|
327
|
-
|
|
333
|
+
all_args.append("--interactive")
|
|
328
334
|
if user is not None:
|
|
329
|
-
|
|
335
|
+
all_args.extend(["--user", user])
|
|
330
336
|
if workdir is not None:
|
|
331
|
-
|
|
332
|
-
return [*
|
|
337
|
+
all_args.extend(["--workdir", str(workdir)])
|
|
338
|
+
return [*all_args, container, cmd, *args]
|
|
333
339
|
|
|
334
340
|
|
|
335
341
|
##
|
|
File without changes
|
|
File without changes
|