docker-devkit 0.1.0__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.
- docker_devkit-0.1.0/.github/workflows/ci.yml +33 -0
- docker_devkit-0.1.0/.github/workflows/release.yml +25 -0
- docker_devkit-0.1.0/.gitignore +12 -0
- docker_devkit-0.1.0/.python-version +1 -0
- docker_devkit-0.1.0/AGENTS.md +59 -0
- docker_devkit-0.1.0/CLAUDE.md +1 -0
- docker_devkit-0.1.0/LICENSE +201 -0
- docker_devkit-0.1.0/NOTICE +1 -0
- docker_devkit-0.1.0/PKG-INFO +13 -0
- docker_devkit-0.1.0/README.md +47 -0
- docker_devkit-0.1.0/publish-config.json +11 -0
- docker_devkit-0.1.0/pyproject.toml +40 -0
- docker_devkit-0.1.0/ruff.toml +82 -0
- docker_devkit-0.1.0/src/docker_devkit/__init__.py +0 -0
- docker_devkit-0.1.0/src/docker_devkit/build_docker.py +302 -0
- docker_devkit-0.1.0/src/docker_devkit/context_sha.py +86 -0
- docker_devkit-0.1.0/src/docker_devkit/detect_gpu.py +15 -0
- docker_devkit-0.1.0/src/docker_devkit/down.py +88 -0
- docker_devkit-0.1.0/src/docker_devkit/image_refs.py +207 -0
- docker_devkit-0.1.0/src/docker_devkit/modes.py +39 -0
- docker_devkit-0.1.0/src/docker_devkit/py.typed +0 -0
- docker_devkit-0.1.0/src/docker_devkit/up.py +111 -0
- docker_devkit-0.1.0/tests/test_context_sha.py +109 -0
- docker_devkit-0.1.0/tests/test_default_targets.py +60 -0
- docker_devkit-0.1.0/tests/test_image_refs.py +258 -0
- docker_devkit-0.1.0/uv.lock +399 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
concurrency:
|
|
10
|
+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
11
|
+
cancel-in-progress: true
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
check:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v5
|
|
18
|
+
|
|
19
|
+
- uses: astral-sh/setup-uv@v7
|
|
20
|
+
with:
|
|
21
|
+
enable-cache: true
|
|
22
|
+
|
|
23
|
+
- name: Lint
|
|
24
|
+
run: uv run ruff check .
|
|
25
|
+
|
|
26
|
+
- name: Format
|
|
27
|
+
run: uv run ruff format --check .
|
|
28
|
+
|
|
29
|
+
- name: Type check
|
|
30
|
+
run: uv run basedpyright
|
|
31
|
+
|
|
32
|
+
- name: Test
|
|
33
|
+
run: uv run pytest
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_run:
|
|
5
|
+
workflows: [CI]
|
|
6
|
+
types: [completed]
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
publish:
|
|
11
|
+
if: github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push' && github.event.workflow_run.head_branch == 'main'
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
permissions:
|
|
14
|
+
contents: write
|
|
15
|
+
id-token: write
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v5
|
|
18
|
+
|
|
19
|
+
# Workaround: fetch-tags is broken with shallow clones
|
|
20
|
+
- run: git fetch --tags origin
|
|
21
|
+
|
|
22
|
+
- uses: astral-sh/setup-uv@v7
|
|
23
|
+
|
|
24
|
+
- name: Publish
|
|
25
|
+
run: uvx --from release-kit==0.1.0 publish-packages --config publish-config.json
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.13
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# docker-devkit
|
|
2
|
+
|
|
3
|
+
## What this is
|
|
4
|
+
|
|
5
|
+
`docker-devkit` owns the Docker-stack lifecycle commands — `up`, `down`, `build` — plus the helpers they share (`detect_gpu`, `modes`, `context_sha`). It is a small, generic package that any repo shipping a compose graph can depend on to get the same bring-up/tear-down / cross-build flow, with a native/consumer split so a repo that authors its own images and a repo that only OCI-includes an upstream artifact both work through the same commands.
|
|
6
|
+
|
|
7
|
+
The package is `docker_devkit` (src-layout under `src/docker_devkit/`); all dependencies resolve from PyPI (`bashrun>=0.1.0`; git-source pins only in scratch branches testing unreleased changes). The repo and package renamed twice on the way here — `stack-lifecycle` → `stack-toolkit` (2026-09-20, before any publish) and `stack-toolkit` → `docker-devkit` (2026-09-21, member of the `-devkit` family). The PyPI identity is fresh: `docker-devkit` starts its own tag ledger at `0.1.0`; the terminal `stack-toolkit` distributions (≤0.1.1) are deprecation signposts pointing here, not this package's history.
|
|
8
|
+
|
|
9
|
+
## Release flow
|
|
10
|
+
|
|
11
|
+
Publishing rides `release.yml`, triggered by a successful CI run on a `main` push: the machinery — release-kit, invoked uvx-isolated, never a project dependency (docker-devkit sits inside its own dependency graph; a project-level release-kit edge is a resolver cycle) — computes the plan from the tag ledger and path-diff, patches the version ephemerally, and publishes to PyPI under OIDC trusted publishing (publisher bound to `release.yml`, no environment). The committed `pyproject.toml` version is permanently the `0.0.0.dev0` sentinel; the `docker-devkit-v*` tags are the version ledger (first release `0.1.0`, patch-auto thereafter). API-breaking changes ship with a manually bumped version — patch-auto assumes additive changes.
|
|
12
|
+
|
|
13
|
+
## Shape
|
|
14
|
+
|
|
15
|
+
Entry points (`[project.scripts]`): `up` → `up.py:app`, `down` → `down.py:app`, `build` → `build_docker.py:app`. All accept `--help`.
|
|
16
|
+
|
|
17
|
+
| Module | Role |
|
|
18
|
+
|---|---|
|
|
19
|
+
| `up.py` | `docker compose up`. Flags: `--attached`/`-a`, `--quiet-pull`/`-q`, `--build`, `--gpu auto\|cuda\|rocm\|none`, `--no-dev`, `--compose-file`. |
|
|
20
|
+
| `down.py` | `docker compose down`. Flags: `--volumes`/`-v` (also removes named volumes), `--gpu`, `--compose-file`. |
|
|
21
|
+
| `build_docker.py` | `run_build()` + the `build` command — cross-builds all images per `compose.bake.yml`, writes `.env.lock` (third-party pulled digests) and `.env.shas` (locally-built `tree-<hash>` tags). |
|
|
22
|
+
| `detect_gpu.py` | `detect_gpu()` → `cuda`/`rocm`/`none` from host devices; the `Gpu` literal. |
|
|
23
|
+
| `modes.py` | `resolve_auth_mode()` — validates `PUBLIC_URL` + `AUTH_MODE` from `.env`, rejecting `keycloak` over cleartext `http://`. |
|
|
24
|
+
| `context_sha.py` | `compute_service_shas()` — per-service `tree-<hash>` image tags over the `.dockerignore`-allowlisted git tree. |
|
|
25
|
+
| `image_refs.py` | Image-reference collection — `collect_repo_references(root, …globs)` enumerates every reference across compose `x-image-ref` services, bake `x-base-images` (pydantic-validated), Dockerfile `FROM`, Dockerfile `COPY --from=` (slash-bearing captures only, so build-stage names are skipped), and yaml `image:` line scans; the Dockerfile and yaml globs are `None`-able to skip those sources (consumer mirroring scans declarations only, policing scans everything); plus build-arg stripping, `unpinned_references(root)` (every slash-bearing reference must carry a tag, a digest, or a trailing `${build-arg}` suffix — consumer CIs fail on its result), `version_coupling_violations(root, couplings)` (each `VersionCoupling` names a pyproject-declared version and the `VersionSite` regexes that must restate it — bake `x-base-images` values or raw file text — so non-derivable couplings like uv `required-version` ↔ uv-base-image tag can't drift silently; the mechanism lives here, the registry in consumer repos' preflight), and remote digest resolution via `imagetools inspect`. `run_build()` consumes the two structural collectors; consumer repos' mirroring tooling consumes the repo scan. |
|
|
26
|
+
|
|
27
|
+
## Constraints
|
|
28
|
+
|
|
29
|
+
### Native stack vs. consumer stack
|
|
30
|
+
|
|
31
|
+
**Context.** A repo that authors its own stack builds its own images and assembles a multi-file compose graph (`compose.yml` + `compose.postgres.yml` + a GPU layer + `compose.dev.yml`), injecting per-service `${*_SHA}` image tags and a `.env.lock` of third-party digests. A consumer repo has none of that: it ships a single self-contained compose file that OCI-includes the upstream artifact already baked (image digests and internal vars frozen as literals) or includes a sibling checkout (which supplies its own `.env.lock`/`.env.shas` through the include's `env_file`). Running `compute_service_shas` there is meaningless (no `compose.bake.yml`, no Dockerfiles) and requiring `.env.lock` is wrong (the consumer has no internal vars to resolve).
|
|
32
|
+
|
|
33
|
+
**Constraint.** `up`/`down` pick the mode by the marker `compose.bake.yml`. **Native** = the default `--compose-file compose.yml` *and* `compose.bake.yml` present → multi-file assembly, SHA injection, `.env.lock` required. **Consumer** = anything else → the single `--compose-file` is the whole graph, run with `--env-file .env` alone; SHA resolution is skipped and `.env.lock` is passed only if it happens to exist. `--build` is rejected outside native mode (a consumer has no local build graph).
|
|
34
|
+
|
|
35
|
+
**Consequences.** A consumer runs `uv run up` (default `compose.yml`) or `uv run up --compose-file compose.local.yml` from its own repo root, against its own `.env`, with no extra setup. A native stack's behavior is unchanged: default `compose.yml` stays native, and an explicit non-default `--compose-file` still falls through to the single-graph path.
|
|
36
|
+
|
|
37
|
+
### File and env conventions the commands assume
|
|
38
|
+
|
|
39
|
+
- `.env` (required) — carries `PUBLIC_URL` and `AUTH_MODE`; `modes.py` reads it and rejects `keycloak` over cleartext `http://`.
|
|
40
|
+
- `.env.lock` (native, required, checked in) — third-party and base-image digests, written by `build`. `up`/`down` refuse to run natively without it.
|
|
41
|
+
- `.env.shas` (native, gitignored, per-build) — `tree-<hash>` tags of locally-built images, written by `build`. `up` injects the `${*_SHA}` values into the environment directly (native mode only) and reads neither file; `.env.shas` exists so a consumer running the compose files through raw `docker compose` can resolve those holes via `--env-file .env.shas`.
|
|
42
|
+
- `compose.bake.yml` (native, required) — the buildx-bake description; its top-level `x-cross-compile-targets` list (optional) is the set of services excluded from the default target list because they need per-arch treatment, opt-in via `--targets`.
|
|
43
|
+
- `compose.yml` / `compose.postgres.yml` / `compose.<gpu>.yml` / `compose.dev.yml` — native's multi-file layers; the GPU one is picked by `detect_gpu()` (or the `--gpu` override).
|
|
44
|
+
- `.dockerignore` (native) — allowlist that `context_sha.py` hashes over to compute per-service `tree-<hash>` tags. See "Docker build context" in `AGENTS-SHARED.md` for the allowlist rationale.
|
|
45
|
+
|
|
46
|
+
The build command writes to two files rather than one because a CI invariant forbids built-image digests in `.env.lock` (which is committed and reviewed) and because `.env.shas` changes on every source edit, so it stays out of version control.
|
|
47
|
+
|
|
48
|
+
### Package split rationale
|
|
49
|
+
|
|
50
|
+
Lifecycle (`up`/`down`/`build`) and codegen (client generation, datamodel generation, workspace locking) have disjoint dependency surfaces. Bundling them would force a consumer that only brings a stack up to install `sqlacodegen`, `psycopg`, `datamodel-code-generator`. Keeping the lifecycle in its own small package lets consumers git-reference just this without dragging the codegen surface behind it.
|
|
51
|
+
|
|
52
|
+
### `--quiet-pull` logging and GPU auto-detection
|
|
53
|
+
|
|
54
|
+
`--quiet-pull` suppresses compose's per-layer progress (CUDA images carry hundreds of layers) while still surfacing pull totals. `--gpu auto` resolves to `cuda`/`rocm`/`none` from host devices and selects the matching `compose.<gpu>.yml`; override only to reproduce a CI environment or test the CPU-only path.
|
|
55
|
+
|
|
56
|
+
## See also
|
|
57
|
+
|
|
58
|
+
- `README.md` — human-facing setup and usage.
|
|
59
|
+
- [`bashrun`](https://github.com/outernet-foundation/bashrun) — the guardrailed subprocess wrapper the lifecycle commands shell out through.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@AGENTS.md
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Copyright 2026 Tyler Hatch
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: docker-devkit
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Docker-stack lifecycle commands (up/down/build) with a native/consumer split
|
|
5
|
+
License-File: LICENSE
|
|
6
|
+
License-File: NOTICE
|
|
7
|
+
Requires-Python: >=3.13
|
|
8
|
+
Requires-Dist: bashrun>=0.1.0
|
|
9
|
+
Requires-Dist: pathspec>=1.0.4
|
|
10
|
+
Requires-Dist: pydantic-settings>=2.9.1
|
|
11
|
+
Requires-Dist: pydantic>=2.11.7
|
|
12
|
+
Requires-Dist: pyyaml>=6.0
|
|
13
|
+
Requires-Dist: typer>=0.17.4
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# docker-devkit
|
|
2
|
+
|
|
3
|
+
Docker-stack lifecycle commands — `up`, `down`, `build` — with a native/consumer split. A repo that authors its own stack (Dockerfiles + `compose.bake.yml`) uses the native mode: multi-file compose assembly, per-service SHA injection, `.env.lock` resolution. A consumer repo that OCI-includes an already-baked upstream stack uses the same commands as a thin wrapper: single-graph, `.env`-only, no build path.
|
|
4
|
+
|
|
5
|
+
See [`AGENTS.md`](./AGENTS.md) for the file/layout conventions the commands assume (`compose.bake.yml`, `.env.lock`, `.env.shas`, `PUBLIC_URL` / `AUTH_MODE` in `.env`) and the mode-detection contract.
|
|
6
|
+
|
|
7
|
+
## Setup
|
|
8
|
+
|
|
9
|
+
Requires Python 3.13+ and [uv](https://docs.astral.sh/uv/).
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
uv sync
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
From a stack repo's root:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
uv run up # docker compose up (auto-detects GPU; native or consumer per compose.bake.yml)
|
|
21
|
+
uv run up --build # build images locally first (native only)
|
|
22
|
+
uv run up --gpu none # override GPU auto-detection
|
|
23
|
+
uv run down # docker compose down
|
|
24
|
+
uv run down -v # also remove named volumes
|
|
25
|
+
uv run build # cross-build all images per compose.bake.yml
|
|
26
|
+
uv run build --lock-only # refresh .env.lock without building
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Consuming from another repo
|
|
30
|
+
|
|
31
|
+
Install from PyPI and use its entry points:
|
|
32
|
+
|
|
33
|
+
```toml
|
|
34
|
+
[project]
|
|
35
|
+
dependencies = ["docker-devkit>=0.1.0"]
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
`bashrun` resolves transitively from PyPI. To test an unreleased change, pin the repo at a git ref in a scratch branch instead (`docker-devkit = { git = "…", rev = "<sha>" }` under `[tool.uv.sources]`) and drop the pin when the release lands.
|
|
39
|
+
|
|
40
|
+
## Development
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
uv run ruff check .
|
|
44
|
+
uv run ruff format --check .
|
|
45
|
+
uv run basedpyright
|
|
46
|
+
uv run pytest
|
|
47
|
+
```
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "docker-devkit"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Docker-stack lifecycle commands (up/down/build) with a native/consumer split"
|
|
5
|
+
requires-python = ">=3.13"
|
|
6
|
+
dependencies = [
|
|
7
|
+
"bashrun>=0.1.0",
|
|
8
|
+
"pydantic>=2.11.7",
|
|
9
|
+
"pydantic-settings>=2.9.1",
|
|
10
|
+
"typer>=0.17.4",
|
|
11
|
+
"pyyaml>=6.0",
|
|
12
|
+
"pathspec>=1.0.4",
|
|
13
|
+
]
|
|
14
|
+
|
|
15
|
+
[dependency-groups]
|
|
16
|
+
dev = ["basedpyright>=1.39.10", "ruff>=0.14.11", "pytest>=8.0.0"]
|
|
17
|
+
|
|
18
|
+
[build-system]
|
|
19
|
+
requires = ["hatchling"]
|
|
20
|
+
build-backend = "hatchling.build"
|
|
21
|
+
|
|
22
|
+
[project.scripts]
|
|
23
|
+
up = "docker_devkit.up:app"
|
|
24
|
+
down = "docker_devkit.down:app"
|
|
25
|
+
build = "docker_devkit.build_docker:app"
|
|
26
|
+
|
|
27
|
+
[tool.hatch.build.targets.wheel]
|
|
28
|
+
packages = ["src/docker_devkit"]
|
|
29
|
+
include = ["src/docker_devkit/py.typed"]
|
|
30
|
+
|
|
31
|
+
[tool.uv.sources]
|
|
32
|
+
|
|
33
|
+
[tool.basedpyright]
|
|
34
|
+
venvPath = "."
|
|
35
|
+
venv = ".venv"
|
|
36
|
+
typeCheckingMode = "strict"
|
|
37
|
+
include = ["src", "tests"]
|
|
38
|
+
|
|
39
|
+
[tool.pytest.ini_options]
|
|
40
|
+
testpaths = ["tests"]
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
target-version = "py313"
|
|
2
|
+
line-length = 120
|
|
3
|
+
preview = true
|
|
4
|
+
|
|
5
|
+
[lint]
|
|
6
|
+
select = ["ALL"]
|
|
7
|
+
ignore = [
|
|
8
|
+
# ── Permanent ─────────────────────────────────────────────────────────
|
|
9
|
+
# Type annotations — basedpyright strict mode handles this
|
|
10
|
+
"ANN",
|
|
11
|
+
# No docstrings, no copyright headers
|
|
12
|
+
"D",
|
|
13
|
+
"DOC",
|
|
14
|
+
"CPY",
|
|
15
|
+
# TODO/FIXME comment formatting
|
|
16
|
+
"TD",
|
|
17
|
+
"FIX",
|
|
18
|
+
# Exception message ergonomics — literal-indirection and custom-class churn without benefit
|
|
19
|
+
"EM101",
|
|
20
|
+
"EM102",
|
|
21
|
+
"TRY003",
|
|
22
|
+
# Class attribute names never conflict with builtins via self.x
|
|
23
|
+
"A003",
|
|
24
|
+
# Function-size counters — C901 already covers structural complexity
|
|
25
|
+
"PLR0911",
|
|
26
|
+
"PLR0912",
|
|
27
|
+
"PLR0913",
|
|
28
|
+
"PLR0914",
|
|
29
|
+
"PLR0915",
|
|
30
|
+
"PLR0917",
|
|
31
|
+
# Typer's Option/Argument in argument defaults is its standard API pattern
|
|
32
|
+
"B008",
|
|
33
|
+
# Boolean parameters read fine as keyword-only flags here
|
|
34
|
+
"FBT001",
|
|
35
|
+
"FBT002",
|
|
36
|
+
"FBT003",
|
|
37
|
+
# Relative imports are the intra-package convention
|
|
38
|
+
"TID252",
|
|
39
|
+
# Formatter-owned; enforced by `ruff format`
|
|
40
|
+
"COM812",
|
|
41
|
+
"I001",
|
|
42
|
+
# Magic values in comparisons are readable in this CLI
|
|
43
|
+
"PLR2004",
|
|
44
|
+
# The formatter owns wrapping; long string literals and URLs stay on one line
|
|
45
|
+
"E501",
|
|
46
|
+
# src-layout tests need no __init__.py
|
|
47
|
+
"INP001",
|
|
48
|
+
# Runtime-used typing imports stay at module level
|
|
49
|
+
"TC001",
|
|
50
|
+
"TC002",
|
|
51
|
+
"TC003",
|
|
52
|
+
# Small literal tuples read fine in membership tests
|
|
53
|
+
"PLR6201",
|
|
54
|
+
|
|
55
|
+
# ── Deferred to PLE-248 — Enforce the deferred ruff rules
|
|
56
|
+
# https://linear.app/plerionplatforms/issue/PLE-248
|
|
57
|
+
# Mirrors placeframe's root ruff.toml transitional Ticket-N blocks; lifting
|
|
58
|
+
# a rule here should happen alongside lifting it from placeframe's ruff.toml.
|
|
59
|
+
"TC006", # move import into TYPE_CHECKING block (quoted annotation) — Ticket 1
|
|
60
|
+
"FURB113", # use list.extend instead of repeated append — Ticket 2
|
|
61
|
+
"PLW1514", # open/read_text without explicit encoding — Ticket 2
|
|
62
|
+
"PT001", # @pytest.fixture over @pytest.fixture() — Ticket 2
|
|
63
|
+
"PTH111", # os.path.expanduser → Path.expanduser — Ticket 2
|
|
64
|
+
"RUF005", # consider spread operator instead of concatenation — Ticket 2
|
|
65
|
+
"B904", # raise ... from inside except — Ticket 8
|
|
66
|
+
"BLE001", # blind except Exception — Ticket 8
|
|
67
|
+
"C901", # function too complex — Ticket 9
|
|
68
|
+
"S110", # try/except/pass on broad exception — Ticket 9
|
|
69
|
+
"S404", # suspicious subprocess import — Ticket 9
|
|
70
|
+
"S603", # subprocess call with non-literal — Ticket 9
|
|
71
|
+
"S607", # start-process-with-partial-path — Ticket 9
|
|
72
|
+
|
|
73
|
+
# ── Deferred to PLE-336 — Replace print() with structured logging
|
|
74
|
+
# https://linear.app/plerionplatforms/issue/PLE-336
|
|
75
|
+
"T201", # print found
|
|
76
|
+
]
|
|
77
|
+
|
|
78
|
+
[lint.per-file-ignores]
|
|
79
|
+
"tests/**" = ["S101", "S404", "S607", "PLR6301"]
|
|
80
|
+
|
|
81
|
+
[lint.flake8-builtins]
|
|
82
|
+
ignorelist = ["id", "map"]
|
|
File without changes
|