Extract compose defs to own submodule

main
Felix Stupp 2 years ago
parent e18332cd40
commit 32c46686f6
Signed by: zocker
GPG Key ID: 93E1BD26F6B02FB7

@ -44,6 +44,16 @@ from attrs import define, field
from podman_compose import normalize, rec_merge, rec_subs
import yaml
from podman_compose_tools.defs.compose import (
ComposeDef,
ComposeVersion,
ServiceName,
ContainerName,
ComposeServiceDef,
VolumeName,
PublicVolumeName,
ComposeVolumeDef,
)
from podman_compose_tools.executor import (
ArgCommand,
BinaryExecutor,
@ -62,35 +72,10 @@ from podman_compose_tools.executor.base import (
ProjectName = NewType("ProjectName", str)
ComposeVersion = NewType("ComposeVersion", str)
ContainerName = NewType("ContainerName", str)
PublicVolumeName = NewType("PublicVolumeName", str)
ServiceName = NewType("ServiceName", str)
VolumeName = NewType("VolumeName", str)
LabelDict: TypeAlias = Mapping[str, str]
class _ComposeDefRequired(TypedDict):
_dirname: Path
version: ComposeVersion
class ComposeDef(_ComposeDefRequired, total=False):
services: Mapping[ServiceName, ComposeServiceDef]
volumes: Mapping[VolumeName, Optional[ComposeVolumeDef]]
class ComposeServiceDef(TypedDict, total=False):
container_name: ContainerName
depends_on: Sequence[ServiceName]
class ComposeVolumeDef(TypedDict, total=False):
name: PublicVolumeName
class VolumeInspectDef(TypedDict):
Name: PublicVolumeName
Driver: str

@ -0,0 +1,14 @@
from .compose import (
ComposeDef,
ComposeVersion,
)
from .service import (
ServiceName,
ContainerName,
ServiceDef as ComposeServiceDef,
)
from .volume import (
VolumeName,
PublicVolumeName,
VolumeDef as ComposeVolumeDef,
)

@ -0,0 +1,20 @@
from __future__ import annotations
from pathlib import Path
from typing import Mapping, NewType, Optional, TypedDict
from .service import ServiceName, ServiceDef
from .volume import VolumeName, VolumeDef
ComposeVersion = NewType("ComposeVersion", str)
class _ComposeDefRequired(TypedDict):
_dirname: Path
version: ComposeVersion
class ComposeDef(_ComposeDefRequired, total=False):
services: Mapping[ServiceName, ServiceDef]
volumes: Mapping[VolumeName, Optional[VolumeDef]]

@ -0,0 +1,12 @@
from __future__ import annotations
from typing import Literal, NewType, Sequence, TypeAlias, TypedDict
ServiceName = NewType("ServiceName", str)
ContainerName = NewType("ContainerName", str)
class ServiceDef(TypedDict, total=False):
container_name: ContainerName
depends_on: Sequence[ServiceName]

@ -0,0 +1,11 @@
from __future__ import annotations
from typing import NewType, TypedDict
VolumeName = NewType("VolumeName", str)
PublicVolumeName = NewType("PublicVolumeName", str)
class VolumeDef(TypedDict, total=False):
name: PublicVolumeName
Loading…
Cancel
Save