compose2pod 0.1.2__tar.gz → 0.1.4__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: compose2pod
3
- Version: 0.1.2
3
+ Version: 0.1.4
4
4
  Summary: Convert a Docker Compose file into a script that runs its services as a single Podman pod
5
5
  Keywords: podman,docker-compose,compose,pod,ci,testing,containers
6
6
  Author: Artur Shiriev
@@ -26,6 +26,18 @@ Description-Content-Type: text/markdown
26
26
 
27
27
  # compose2pod
28
28
 
29
+ [![PyPI version](https://img.shields.io/pypi/v/compose2pod.svg)](https://pypi.org/project/compose2pod/)
30
+ [![Supported Python versions](https://img.shields.io/pypi/pyversions/compose2pod.svg)](https://pypi.org/project/compose2pod/)
31
+ [![Downloads](https://static.pepy.tech/badge/compose2pod/month)](https://pepy.tech/projects/compose2pod)
32
+ [![Coverage](https://img.shields.io/badge/coverage-100%25-brightgreen.svg)](https://github.com/modern-python/compose2pod/actions/workflows/ci.yml)
33
+ [![CI](https://github.com/modern-python/compose2pod/actions/workflows/ci.yml/badge.svg)](https://github.com/modern-python/compose2pod/actions/workflows/ci.yml)
34
+ [![License](https://img.shields.io/github/license/modern-python/compose2pod.svg)](https://github.com/modern-python/compose2pod/blob/main/LICENSE)
35
+ [![GitHub stars](https://img.shields.io/github/stars/modern-python/compose2pod)](https://github.com/modern-python/compose2pod/stargazers)
36
+ [![Context7](https://img.shields.io/badge/Context7-docs-blue)](https://context7.com/modern-python/compose2pod)
37
+ [![uv](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)](https://github.com/astral-sh/uv)
38
+ [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
39
+ [![ty](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ty/main/assets/badge/v0.json)](https://github.com/astral-sh/ty)
40
+
29
41
  Convert a Docker Compose file into a POSIX `sh` script that runs its services as a **single Podman pod**.
30
42
 
31
43
  Built for CI and test environments where you can't use `docker compose` or `podman kube play`:
@@ -1,5 +1,17 @@
1
1
  # compose2pod
2
2
 
3
+ [![PyPI version](https://img.shields.io/pypi/v/compose2pod.svg)](https://pypi.org/project/compose2pod/)
4
+ [![Supported Python versions](https://img.shields.io/pypi/pyversions/compose2pod.svg)](https://pypi.org/project/compose2pod/)
5
+ [![Downloads](https://static.pepy.tech/badge/compose2pod/month)](https://pepy.tech/projects/compose2pod)
6
+ [![Coverage](https://img.shields.io/badge/coverage-100%25-brightgreen.svg)](https://github.com/modern-python/compose2pod/actions/workflows/ci.yml)
7
+ [![CI](https://github.com/modern-python/compose2pod/actions/workflows/ci.yml/badge.svg)](https://github.com/modern-python/compose2pod/actions/workflows/ci.yml)
8
+ [![License](https://img.shields.io/github/license/modern-python/compose2pod.svg)](https://github.com/modern-python/compose2pod/blob/main/LICENSE)
9
+ [![GitHub stars](https://img.shields.io/github/stars/modern-python/compose2pod)](https://github.com/modern-python/compose2pod/stargazers)
10
+ [![Context7](https://img.shields.io/badge/Context7-docs-blue)](https://context7.com/modern-python/compose2pod)
11
+ [![uv](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)](https://github.com/astral-sh/uv)
12
+ [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
13
+ [![ty](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ty/main/assets/badge/v0.json)](https://github.com/astral-sh/ty)
14
+
3
15
  Convert a Docker Compose file into a POSIX `sh` script that runs its services as a **single Podman pod**.
4
16
 
5
17
  Built for CI and test environments where you can't use `docker compose` or `podman kube play`:
@@ -57,6 +57,10 @@ def run_flags(name: str, svc: dict[str, Any], pod: str, hosts: list[str], projec
57
57
  for env_file in env_files:
58
58
  flags += ["--env-file", str(Path(project_dir, env_file))]
59
59
  for volume in svc.get("volumes") or []:
60
+ if ":" not in volume:
61
+ # Anonymous volume: a bare container path, no host source to translate.
62
+ flags += ["-v", volume]
63
+ continue
60
64
  source, destination = volume.split(":", 1)
61
65
  if not source.startswith("/"):
62
66
  source = str(Path(project_dir, source))
@@ -14,12 +14,15 @@ def depends_on(svc: dict[str, Any]) -> dict[str, str]:
14
14
 
15
15
 
16
16
  def hostnames(services: dict[str, Any]) -> list[str]:
17
- """All names other services may use to reach a service: names, hostnames, then aliases."""
17
+ """All names other services may use to reach a service: names, hostnames/container names, then aliases."""
18
18
  names = list(services)
19
19
  for svc in services.values():
20
20
  hostname = svc.get("hostname")
21
21
  if hostname:
22
22
  names.append(hostname)
23
+ container_name = svc.get("container_name")
24
+ if container_name:
25
+ names.append(container_name)
23
26
  networks = svc.get("networks")
24
27
  if isinstance(networks, dict):
25
28
  for network in networks.values():
@@ -18,6 +18,7 @@ SUPPORTED_SERVICE_KEYS = {
18
18
  "depends_on",
19
19
  "networks",
20
20
  "hostname",
21
+ "container_name",
21
22
  }
22
23
  IGNORED_SERVICE_KEYS = {"ports", "restart", "stdin_open", "tty"}
23
24
  SUPPORTED_HEALTHCHECK_KEYS = {"test", "interval", "timeout", "retries", "start_period"}
@@ -41,6 +42,12 @@ def _validate_service_volumes(name: str, svc: dict[str, Any]) -> None:
41
42
  if not isinstance(volume, str):
42
43
  msg = f"service {name!r}: only short volume syntax is supported"
43
44
  raise UnsupportedComposeError(msg)
45
+ if ":" not in volume:
46
+ # Anonymous volume: must be an absolute container path.
47
+ if not volume.startswith("/"):
48
+ msg = f"service {name!r}: anonymous volume '{volume}' must be an absolute path"
49
+ raise UnsupportedComposeError(msg)
50
+ continue
44
51
  source = volume.split(":", 1)[0]
45
52
  if not source.startswith((".", "/")):
46
53
  msg = f"service {name!r}: named volume '{source}' is not supported (bind mounts only)"
@@ -18,7 +18,7 @@ classifiers = [
18
18
  "Topic :: Software Development :: Libraries",
19
19
  "Topic :: Software Development :: Testing",
20
20
  ]
21
- version = "0.1.2"
21
+ version = "0.1.4"
22
22
 
23
23
  [project.optional-dependencies]
24
24
  yaml = ["PyYAML>=6"]