Repository navigation
Add: python mixin kit for running the factory on Python projects - #12
Merged
Merged
Conversation
- python/ mixin (requires io.github.geut/pi-factory >= 1): uv, just and a preinstalled CPython in /usr/local/bin; gcc, libpq headers, psql and pg_isready, shipped with their dependency closure because the factory image removes the compiler - sandbox-services: one shared Postgres and Redis on the in-sandbox Docker daemon, started by a lifecycle hook that also adds sfw aliases for pip/uv - with-worktree-env: a stable WORKTREE_ID per worktree for test database names and key prefixes - python/example (Django, two aliases, Redis cache) and python/check - factory: allow api.linear.app; publish workflow builds the python tag - README: Python projects section, Linear key setup, mixin notes Refs #11 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Install build-essential, pkg-config, libpq-dev and postgresql-client with a lifecycle install hook (root, at sandbox creation) instead of copying a package closure into the image: dpkg-managed, no loader cache or library version skew. The mixin image goes from ~580 MB to ~54 MB. - uv and uvx in /usr/local/bin are wrappers that run the real binaries through sfw, so shell-less factory commands are covered; drop the bash aliases and the startup script that appended them. - uv uses only managed CPython (headers, follows .python-version); drop the preinstalled interpreter, just, and every arg but uv_version. - sandbox-services: fixed Postgres 18 + Redis 8, boot mode via --wait-for-docker. - Remove python/example, python/check and collect-packages; move the Python docs to python/README.md and keep the main README to pointers. - Validate kits workflow: build changed kits with the kit frontend and run kit-tck validate on the OCI layout. Refs #11 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Allow releases.astral.sh: uv downloads managed CPython from Astral's mirror, and only-managed has no fallback. - sandbox-services checks Postgres readiness over TCP, so the first-boot init server (socket only) no longer races the role setup. - with-worktree-env always derives WORKTREE_ID from the worktree. - uv run --no-sync/--offline (or UV_NO_SYNC/UV_OFFLINE) skips sfw; the starter validation commands use --no-sync. - Factory contract: sfw on PATH, the in-sandbox Docker daemon, Ubuntu 26.04 and its apt sources. - Validate kits: derive kits from <kit>/<kit>.yaml, and build both platforms for recipes that download on $BUILDPLATFORM. Refs #11 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #11. A slim
pythonmixin for the factory. It provides the Python dependencies; each project keeps its own setup. Some acceptance criteria still need a realsbxsandbox or a factory-skills release (see Not done yet).What's in it
python/mixin (requiresio.github.geut/pi-factory >= 1, providesio.github.geut/python@1), about 54 MB:uvanduvxin/usr/local/binare wrappers that run the real binaries throughsfw. Package downloads go through Socket Firewall for shell-less factory commands too, with no aliases./etc/uv/uv.toml:python-preference = "only-managed": uv-managed CPython with headers, following.python-version.link-mode = "copy": worktrees are on the host mount and the cache is in$HOME.apt-get install build-essential pkg-config libpq-dev postgresql-client. Theinstallnetwork phase allows the Ubuntu archives plus the Docker and GitHub CLI apt repositories thatapt-get updaterefreshes.sandbox-services: a shared Postgres 18 (dev/dev, CREATEDB) and Redis 8 on the in-sandbox daemon, started by a startup hook (start --wait-for-docker).with-worktree-env: sets a stableWORKTREE_IDper worktree.context.mdandREADME.md: a starterFACTORY.jsonand Django / SQLAlchemy / Celery isolation notes.Factory:
api.linear.appadded toruntime.allow.Workflows:
pythontag.kit-tck validate(pinnedv3.0.0-m.12, checksum-verified) on the OCI layout.README: pointers to the kit, the Linear key setup, and the Validate section.
Decisions worth a look
apt-get purge xz-utils && apt-get autoremoveremoves gcc. An install hook keeps the packages dpkg-managed and consistent with the image, at about 45 s per sandbox creation. This followsdocker/sbx-kits-contrib'spackages-through-sfw.uvcommand. A command underuv runinherits sfw's proxy and CA bundle while it runs./usr/local/lib/python-kit/bin/uvskips it.python33.14 has no headers);just, because it's a project choice;servicesand version args;python/exampleandpython/check.kit-tckfromdocker/sandbox-kit-specvalidates the built artifact instead.Tested (arm64, by hand)
The mixin was built with plain
docker build, composed onto the publishednode-24-factoryimage, and the hooks were run by hand:gcc,psqlandpkg-config libpqwork.sandbox-services start --wait-for-dockerbrings both services up, and a second start is a no-op (0.19 s).uv syncgoes through sfw (sfw's proxy and CA appear in the environment), downloads a managed 3.13, and buildspsycopg-cfrom source.uv sync --frozen --offlinesucceeds with no warnings.with-worktree-env, and both passed.uv runworks with no shell, anduvx ruffworks.docker buildx build ./python -f python/python.yamlwith the kit frontend: no errors or warnings.kit-tckhasn't run yet; the new workflow on this PR is its first run.Not done yet
factory_versionbump. factory-skills has the Linear adapter onmain, but the latest release is still v0.2.0.sbxsandbox:piandpi-docker;sbx's deny-by-default policy;sbx stop/sbx run;Authorizationheader through the proxy;🤖 Generated with Claude Code