You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: split into Python package, concat for release
Single-file helmfile2compose.py is now a build artifact produced by
build.py. Source lives in src/helmfile2compose/ (pacts/, core/, io/).
CI builds and uploads the single file on tag push.
Lint often: run `pylint helmfile2compose.py` and `pyflakes helmfile2compose.py` after any change. Fix real issues (unused imports, actual bugs, f-strings without placeholders). Pylint style warnings (too-many-locals, line-too-long, etc.) are acceptable.
12
+
Python package under `src/helmfile2compose/` with three layers:
13
13
14
-
Complexity: run `radon cc helmfile2compose.py -a -s -n C` to check cyclomatic complexity. Target: no D/E/F ratings. Current: 14 C-rated functions, average C (~14).
14
+
-**`pacts/`** — public contracts for extensions (`ConvertContext`, `ConvertResult`, `IngressRewriter`, helpers). Stable API — extensions import from here (or from `helmfile2compose` directly via re-exports).
15
+
-**`core/`** — internal conversion engine (`constants`, `env`, `volumes`, `services`, `workloads`, `ingress`, `extensions`, `convert`). Not public API.
16
+
-**`io/`** — input/output (`parsing`, `config`, `output`). Not public API.
17
+
-**`cli.py`** — CLI entry point.
15
18
16
-
**Null-safe YAML access:**`.get("key", {})` returns `None` when the key exists with an explicit `null` value (Helm conditional blocks). Always use `.get("key") or {}` / `.get("key") or []` for fields that Helm may render as null (`annotations`, `ports`, `initContainers`, `data`, `rules`, `selector`, etc.).
19
+
The single-file `helmfile2compose.py` is a **build artifact** produced by `build.py` (concat script). It is not committed — CI builds it on tag push and uploads as a release asset. Users and h2c-manager see no change.
cd ../h2c-testsuite && ./run-tests.sh --local-core ../h2c-core/helmfile2compose.py
31
+
```
19
32
20
-
Single script `helmfile2compose.py` (~1860 lines). No packages, no setup.py. Dependency: `pyyaml`.
33
+
Dependency: `pyyaml`.
34
+
35
+
## Workflow
36
+
37
+
Lint often: run `pylint src/helmfile2compose/` and `pyflakes src/helmfile2compose/` after any change. Fix real issues (unused imports, actual bugs, f-strings without placeholders). Pylint style warnings (too-many-locals, line-too-long, etc.) are acceptable.
38
+
39
+
**Null-safe YAML access:**`.get("key", {})` returns `None` when the key exists with an explicit `null` value (Helm conditional blocks). Always use `.get("key") or {}` / `.get("key") or []` for fields that Helm may render as null (`annotations`, `ports`, `initContainers`, `data`, `rules`, `selector`, etc.).
21
40
22
41
### CLI
23
42
@@ -70,10 +89,10 @@ Three extension types, loaded from the same `--extensions-dir`:
70
89
71
90
Extensions import `ConvertContext`/`ConvertResult`/`IngressRewriter` from `helmfile2compose`. `get_ingress_class(manifest, ingress_types)` and `resolve_backend(path_entry, manifest, ctx)` are public helpers for rewriters. `apply_replacements(text, replacements)` and `resolve_env(container, configmaps, secrets, workload_name, warnings, replacements=None, service_port_map=None)` are also public — available to extensions that need string replacement or env resolution. Available extensions:
-`configmaps/` / `secrets/` — generated files from volume mounts
58
58
59
+
## Development
60
+
61
+
The codebase is a Python package under `src/helmfile2compose/`. The single-file `helmfile2compose.py` is a build artifact produced by `build.py` — it concatenates the package into one file for distribution.
62
+
63
+
```bash
64
+
# Run from the package
65
+
PYTHONPATH=src python -m helmfile2compose --help
66
+
67
+
# Build the single-file distribution
68
+
python build.py
69
+
```
70
+
71
+
See the [core architecture docs](https://helmfile2compose.github.io/developer/core-architecture/) for the full package structure.
72
+
59
73
## Documentation
60
74
61
75
Full docs at [helmfile2compose.github.io](https://helmfile2compose.github.io).
0 commit comments