Extract compose defs to own submodule
parent
e18332cd40
commit
32c46686f6
@ -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…
Reference in New Issue