dockercomposefile 0.1.0__tar.gz → 0.1.1__tar.gz
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.
- {dockercomposefile-0.1.0 → dockercomposefile-0.1.1}/PKG-INFO +1 -1
- {dockercomposefile-0.1.0 → dockercomposefile-0.1.1}/dockercomposefile/models/service.py +10 -0
- {dockercomposefile-0.1.0 → dockercomposefile-0.1.1}/dockercomposefile.egg-info/PKG-INFO +1 -1
- {dockercomposefile-0.1.0 → dockercomposefile-0.1.1}/pyproject.toml +1 -1
- {dockercomposefile-0.1.0 → dockercomposefile-0.1.1}/tests/test_builder.py +61 -0
- {dockercomposefile-0.1.0 → dockercomposefile-0.1.1}/LICENSE +0 -0
- {dockercomposefile-0.1.0 → dockercomposefile-0.1.1}/README.md +0 -0
- {dockercomposefile-0.1.0 → dockercomposefile-0.1.1}/dockercomposefile/__init__.py +0 -0
- {dockercomposefile-0.1.0 → dockercomposefile-0.1.1}/dockercomposefile/builder.py +0 -0
- {dockercomposefile-0.1.0 → dockercomposefile-0.1.1}/dockercomposefile/exporter.py +0 -0
- {dockercomposefile-0.1.0 → dockercomposefile-0.1.1}/dockercomposefile/models/__init__.py +0 -0
- {dockercomposefile-0.1.0 → dockercomposefile-0.1.1}/dockercomposefile/models/build.py +0 -0
- {dockercomposefile-0.1.0 → dockercomposefile-0.1.1}/dockercomposefile/models/common.py +0 -0
- {dockercomposefile-0.1.0 → dockercomposefile-0.1.1}/dockercomposefile/models/compose.py +0 -0
- {dockercomposefile-0.1.0 → dockercomposefile-0.1.1}/dockercomposefile/models/config.py +0 -0
- {dockercomposefile-0.1.0 → dockercomposefile-0.1.1}/dockercomposefile/models/deploy.py +0 -0
- {dockercomposefile-0.1.0 → dockercomposefile-0.1.1}/dockercomposefile/models/develop.py +0 -0
- {dockercomposefile-0.1.0 → dockercomposefile-0.1.1}/dockercomposefile/models/model.py +0 -0
- {dockercomposefile-0.1.0 → dockercomposefile-0.1.1}/dockercomposefile/models/network.py +0 -0
- {dockercomposefile-0.1.0 → dockercomposefile-0.1.1}/dockercomposefile/models/secret.py +0 -0
- {dockercomposefile-0.1.0 → dockercomposefile-0.1.1}/dockercomposefile/models/volume.py +0 -0
- {dockercomposefile-0.1.0 → dockercomposefile-0.1.1}/dockercomposefile.egg-info/SOURCES.txt +0 -0
- {dockercomposefile-0.1.0 → dockercomposefile-0.1.1}/dockercomposefile.egg-info/dependency_links.txt +0 -0
- {dockercomposefile-0.1.0 → dockercomposefile-0.1.1}/dockercomposefile.egg-info/requires.txt +0 -0
- {dockercomposefile-0.1.0 → dockercomposefile-0.1.1}/dockercomposefile.egg-info/top_level.txt +0 -0
- {dockercomposefile-0.1.0 → dockercomposefile-0.1.1}/setup.cfg +0 -0
- {dockercomposefile-0.1.0 → dockercomposefile-0.1.1}/tests/test_exporter.py +0 -0
- {dockercomposefile-0.1.0 → dockercomposefile-0.1.1}/tests/test_roundtrip.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dockercomposefile
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.1
|
|
4
4
|
Summary: Pydantic models for Docker Compose files with YAML builder and exporter
|
|
5
5
|
License-Expression: Apache-2.0
|
|
6
6
|
Project-URL: Homepage, https://github.com/thewiw/py-docker-compose-file
|
|
@@ -380,6 +380,8 @@ class Service(ComposeBaseModel):
|
|
|
380
380
|
result.append(PortConfig.model_validate(item))
|
|
381
381
|
elif isinstance(item, int):
|
|
382
382
|
result.append(PortConfig.model_validate({"target": item}))
|
|
383
|
+
elif isinstance(item, PortConfig):
|
|
384
|
+
result.append(item)
|
|
383
385
|
return result
|
|
384
386
|
return None
|
|
385
387
|
|
|
@@ -411,6 +413,8 @@ class Service(ComposeBaseModel):
|
|
|
411
413
|
result.append(VolumeMount.model_validate(_parse_service_volume(item)))
|
|
412
414
|
elif isinstance(item, dict):
|
|
413
415
|
result.append(VolumeMount.model_validate(item))
|
|
416
|
+
elif isinstance(item, VolumeMount):
|
|
417
|
+
result.append(item)
|
|
414
418
|
return result
|
|
415
419
|
return None
|
|
416
420
|
|
|
@@ -511,6 +515,8 @@ class Service(ComposeBaseModel):
|
|
|
511
515
|
result.append(item)
|
|
512
516
|
elif isinstance(item, dict):
|
|
513
517
|
result.append(ServiceConfig.model_validate(item))
|
|
518
|
+
elif isinstance(item, ServiceConfig):
|
|
519
|
+
result.append(item)
|
|
514
520
|
return result
|
|
515
521
|
return None
|
|
516
522
|
|
|
@@ -527,6 +533,8 @@ class Service(ComposeBaseModel):
|
|
|
527
533
|
result.append(item)
|
|
528
534
|
elif isinstance(item, dict):
|
|
529
535
|
result.append(ServiceSecret.model_validate(item))
|
|
536
|
+
elif isinstance(item, ServiceSecret):
|
|
537
|
+
result.append(item)
|
|
530
538
|
return result
|
|
531
539
|
return None
|
|
532
540
|
|
|
@@ -566,6 +574,8 @@ class Service(ComposeBaseModel):
|
|
|
566
574
|
result[str(k)] = ServiceNetworkConfig()
|
|
567
575
|
elif isinstance(val, dict):
|
|
568
576
|
result[str(k)] = ServiceNetworkConfig.model_validate(val)
|
|
577
|
+
elif isinstance(val, ServiceNetworkConfig):
|
|
578
|
+
result[str(k)] = val
|
|
569
579
|
return result
|
|
570
580
|
return None
|
|
571
581
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dockercomposefile
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.1
|
|
4
4
|
Summary: Pydantic models for Docker Compose files with YAML builder and exporter
|
|
5
5
|
License-Expression: Apache-2.0
|
|
6
6
|
Project-URL: Homepage, https://github.com/thewiw/py-docker-compose-file
|
|
@@ -6,6 +6,9 @@ from dockercomposefile import ComposeBuilder
|
|
|
6
6
|
from dockercomposefile.models import (
|
|
7
7
|
DockerComposeFile,
|
|
8
8
|
PortConfig,
|
|
9
|
+
ServiceConfig,
|
|
10
|
+
ServiceNetworkConfig,
|
|
11
|
+
ServiceSecret,
|
|
9
12
|
VolumeMount,
|
|
10
13
|
)
|
|
11
14
|
|
|
@@ -445,3 +448,61 @@ class TestFromDict:
|
|
|
445
448
|
}
|
|
446
449
|
compose = ComposeBuilder.from_dict(data)
|
|
447
450
|
assert compose.services["web"].image == "nginx"
|
|
451
|
+
|
|
452
|
+
|
|
453
|
+
class TestPreInstantiatedModels:
|
|
454
|
+
"""Tests for passing pre-instantiated model instances to Service."""
|
|
455
|
+
|
|
456
|
+
def test_volumes_with_pre_instantiated_volume_mount(self):
|
|
457
|
+
from dockercomposefile.models.service import Service
|
|
458
|
+
vol1 = VolumeMount(source="foo", target="bar")
|
|
459
|
+
vol2 = VolumeMount(source="truc", target="muche")
|
|
460
|
+
service = Service(
|
|
461
|
+
image="caddy:latest",
|
|
462
|
+
volumes=[vol1, vol2],
|
|
463
|
+
)
|
|
464
|
+
assert len(service.volumes) == 2
|
|
465
|
+
assert service.volumes[0] == vol1
|
|
466
|
+
assert service.volumes[1] == vol2
|
|
467
|
+
|
|
468
|
+
def test_ports_with_pre_instantiated_port_config(self):
|
|
469
|
+
port1 = PortConfig(target=80, published="80")
|
|
470
|
+
port2 = PortConfig(target=443, published="443")
|
|
471
|
+
from dockercomposefile.models.service import Service
|
|
472
|
+
service = Service(
|
|
473
|
+
image="nginx",
|
|
474
|
+
ports=[port1, port2],
|
|
475
|
+
)
|
|
476
|
+
assert len(service.ports) == 2
|
|
477
|
+
assert service.ports[0] == port1
|
|
478
|
+
assert service.ports[1] == port2
|
|
479
|
+
|
|
480
|
+
def test_configs_with_pre_instantiated_service_config(self):
|
|
481
|
+
cfg = ServiceConfig(source="app_config", target="/app/config.yml")
|
|
482
|
+
from dockercomposefile.models.service import Service
|
|
483
|
+
service = Service(
|
|
484
|
+
image="api",
|
|
485
|
+
configs=[cfg],
|
|
486
|
+
)
|
|
487
|
+
assert len(service.configs) == 1
|
|
488
|
+
assert service.configs[0] == cfg
|
|
489
|
+
|
|
490
|
+
def test_secrets_with_pre_instantiated_service_secret(self):
|
|
491
|
+
sec = ServiceSecret(source="db_password")
|
|
492
|
+
from dockercomposefile.models.service import Service
|
|
493
|
+
service = Service(
|
|
494
|
+
image="api",
|
|
495
|
+
secrets=[sec],
|
|
496
|
+
)
|
|
497
|
+
assert len(service.secrets) == 1
|
|
498
|
+
assert service.secrets[0] == sec
|
|
499
|
+
|
|
500
|
+
def test_networks_with_pre_instantiated_service_network_config(self):
|
|
501
|
+
net = ServiceNetworkConfig(aliases=["api-service"])
|
|
502
|
+
from dockercomposefile.models.service import Service
|
|
503
|
+
service = Service(
|
|
504
|
+
image="api",
|
|
505
|
+
networks={"backend": net},
|
|
506
|
+
)
|
|
507
|
+
assert "backend" in service.networks
|
|
508
|
+
assert service.networks["backend"] == net
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dockercomposefile-0.1.0 → dockercomposefile-0.1.1}/dockercomposefile.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
{dockercomposefile-0.1.0 → dockercomposefile-0.1.1}/dockercomposefile.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|