python-ship
A framework-agnostic, cross-platform Docker development environment for
Python web apps, with portable production releases. It is the Python member
of the Ship ecosystem, alongside PHP Ship:
the same commands, the same ship.json vocabulary and the same release
artifact, for any ASGI or WSGI app — a plain callable, Django, FastAPI or
Flask built in, anything else through a community adapter.
Status: beta, first public release. init/up/down/exec/shell/
logs/db/config:test/build/release/npm/uv/manage all work
end-to-end against a real Docker daemon, for a framework-free app, a Django,
a FastAPI and a Flask app alike, on Uvicorn, Hypercorn, Gunicorn or Granian: development stacks with a real database and
cache, production images, and releases booted on a machine with nothing but
Docker. CI runs the unit suite on Linux, macOS and Windows with Python
3.11–3.15, and the Docker suites on every push to main. See
docs/roadmap.md
for what's built and what's next.
Contents
- Why not just write a Compose file?
- Requirements
- Quick start
- Commands
- Services
- Configuration (
ship.json) - Dependencies and
ship uv - Web servers: ASGI and WSGI
- Background tasks (Celery)
- Production releases
- HTTPS / TLS
- Backing up data volumes
- Frontend dev server (Vite HMR)
- File ownership in dev
- Debugging (debugpy)
- Faster file sync on Windows/macOS (Mutagen)
- Running more than one project at once
- Customizing the stack
- Extending ship
- Architecture
- Contributing
- License
Why not just write a Compose file?
You can, and every project that uses Ship ends up with one — Ship generates it. What Ship adds is everything around that file that each project would otherwise rebuild by hand:
- One cross-platform CLI.
shipis a Python executable, soship up,ship execandship dbrun natively on Windows, macOS and Linux, with no shell scripts and no requirement to keep the project inside WSL. - A portable release artifact, not just a dev tool.
ship release --tagbuilds real production images (no bind mount, no uv or pip, a non-root user) from the sameship.jsonand packages them with a final Compose file,.env.production, and a deploy script intodist/ship/<tag>/. The server needs nothing but Docker — see Production releases. - A real database shell without a published port.
ship dbopenspsql/mysqlinside the database container, reading its credentials from that container's own environment. - Not tied to a framework. The core knows nothing about Django or
FastAPI; both are
FrameworkAdapterimplementations on the same public extension point a third party uses — the Starlette example is one. A plain ASGI callable needs no framework,requirements.txtorpyproject.tomlat all. - Postgres and MySQL, Redis, RabbitMQ and Celery, four S3-compatible
stores, Meilisearch, Mailpit, Selenium and Playwright, Node; Uvicorn,
Hypercorn, Gunicorn and Granian —
ship initpicks one option per group; nothing is hardcoded to one choice.
Requirements
- Python 3.11+ to run the
shipCLI itself — or just uv, which installsshipwith a Python it manages. - Docker Desktop (or Docker Engine with Compose v2). This is what actually
runs your project;
shipdrivesdocker compose. - uv on the host.
ship initoffers to install it with Astral's official installer if it's missing, and makes no changes to the project if you decline. - An ASGI app. Nothing else: no framework, no dependency manifest, no local database, no Node install.
Quick start
uv tool install python-ship # or: pipx install python-ship
cd your-project
ship init # pick your services interactively
ship up # build and start
ship manage migrate # Django only: registered when manage.py is detected
ship uv add httpx # add a dependency; `ship up` rebuilds the image
ship shell # drop into the app container
ship down
ship init detects Django (manage.py) and FastAPI (a FastAPI() app) and
suggests the ASGI target to serve. A framework-free app works too — save this
as main.py and run ship init:
async def app(scope, receive, send):
if scope["type"] != "http":
return
await send({"type": "http.response.start", "status": 200, "headers": []})
await send({"type": "http.response.body", "body": b"Hello from Ship"})
ship init writes ship.json and publishes a ship/ directory (the
Dockerfile and its security check) into your project root — both are meant to
be committed. In scripts and CI, pass everything as options and add
--no-interaction:
ship init -n --framework django --app project.asgi:application --database postgres --cache redis
Production is a separate pair of commands, not a flag on ship up — see
Production releases for ship build/ship release.
Commands
| Command | What it does |
|---|---|
ship init |
Interactive picker for the framework, ASGI target, server and services (database, cache, storage, ...); writes ship.json and publishes ship/. Every option has a flag for non-interactive use (ship init --help). Re-run it to change selections — see Adding a service later. |
ship up |
Regenerates ship/docker-compose.generated.yml from ship.json, runs docker compose up --build, then waits until every container is running, every healthcheck passes and the app answers HTTP. Development only. |
ship build |
Builds every project-owned production image, tagged locally. Needs .env.production as soon as a selected service has a required credential. See Production releases. |
ship release --tag <tag> |
Builds the same images (re-tagged) and assembles the portable release under dist/ship/<tag>/. |
ship down [--volumes] |
docker compose down. --volumes also deletes named volumes (database and storage data — use with care). |
ship exec <service> <cmd...> |
Runs a command inside a running service. The generic escape hatch every shortcut below wraps. |
ship shell [service] |
Opens a shell (sh) in a service; defaults to the app. |
ship logs [service] [-f] |
Shows logs for one service, or all of them. -f/--follow streams. |
ship db [instance] |
Opens the database's client (psql/mysql) with credentials from its own container. Name one of additionalServices' databases to open that instance instead. |
ship config:test |
Validates ship.json, ship/, both Compose models, and production credentials in .env.production — without Docker. Reports every problem it finds in one pass. |
ship doctor |
Shows the installed and published versions and the state and health of every container, with a recovery hint for anything that crashed. |
ship uv <args...> |
Runs uv dependency commands (add, remove, lock, tree, ...) in a temporary container with the project's Python. See Dependencies. |
ship npm <args...> |
Runs npm in the Node frontend service (e.g. ship npm install, ship npm run dev). |
ship manage <args...> |
Runs python manage.py in the app — only registered for Django projects. |
ship flask <args...> |
Runs the flask CLI in the app (FLASK_APP is set) — only registered for Flask projects. A community adapter registers its own commands the same way. |
ship --version |
Shows the installed python-ship version. |
Every proxied command forwards its arguments exactly as typed (including
flags such as ship manage migrate --database=other), and returns the inner
command's exit code. --project-directory PATH before any command runs it
against another project. Without a terminal (CI, piped input), exec-style
commands pass -T to Compose, so ship db < dump.sql works.
Services
ship init groups services (database, cache, storage, search, mail, testing,
frontend) and lets you pick one per group. "Wired" means the container runs,
is healthchecked where it can be, and the right variables are injected into
the app; it does not install the Python client library your app uses to
read them — that stays your app's decision.
| Service | Wired automatically | Still needed in the app |
|---|---|---|
PostgreSQL (postgres, or pgsql) |
DB_HOST/DB_PORT/DB_NAME/DB_USER/DB_PASSWORD, ship db |
A driver such as psycopg[binary], and settings that read DB_* |
MySQL (mysql) |
The same DB_* variables, a separate DB_ROOT_PASSWORD the app never receives, ship db |
A driver such as mysqlclient or PyMySQL |
Redis (redis) |
REDIS_URL; RDB snapshots plus an append-only log |
redis |
RabbitMQ (rabbitmq, broker group) |
AMQP_URL; management UI on 127.0.0.1:${RABBITMQ_MANAGEMENT_PORT:-15672} in development |
A client such as kombu or pika, or just Celery |
Celery (celery, tasks group) |
A worker and a beat container from the app's image; CELERY_BROKER_URL, CELERY_RESULT_BACKEND, CELERY_APP |
celery in your dependencies — see Background tasks |
Mailpit (mailpit) |
MAIL_HOST/MAIL_PORT (SMTP), web UI on 127.0.0.1:${MAILPIT_WEB_PORT:-8025}. Development only |
Nothing for smtplib; point your framework's mail settings at the variables |
Meilisearch (meilisearch) |
MEILISEARCH_URL/MEILISEARCH_KEY |
meilisearch (or plain HTTP) |
| Garage / SeaweedFS / RustFS / Silo | AWS_ENDPOINT/AWS_USE_PATH_STYLE_ENDPOINT/AWS_DEFAULT_REGION/AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY/AWS_BUCKET |
boto3 with path-style addressing. Garage creates its bucket; with the others, create AWS_BUCKET once. Silo has two image variants — see Silo on older CPUs |
Selenium (selenium) |
A Chrome grid, SELENIUM_REMOTE_URL, APP_URL. Development only |
selenium in your test dependencies |
Playwright (playwright) |
A browser server, PLAYWRIGHT_WS_URL, APP_URL. Development only |
playwright==1.64.1 — the client must match the server version |
Node.js (node) |
A Node container for ship npm, Vite's port published. Development only |
See Frontend dev server |
Connecting a Django app to the injected variables:
import os
DATABASES = {"default": {
"ENGINE": "django.db.backends.postgresql",
"HOST": os.environ["DB_HOST"], "PORT": os.environ["DB_PORT"],
"NAME": os.environ["DB_NAME"], "USER": os.environ["DB_USER"],
"PASSWORD": os.environ["DB_PASSWORD"],
}}
CACHES = {"default": {"BACKEND": "django.core.cache.backends.redis.RedisCache",
"LOCATION": os.environ["REDIS_URL"]}}
A FastAPI or framework-free app passes the same values to its own clients:
psycopg.connect(host=os.environ["DB_HOST"], ...),
redis.from_url(os.environ["REDIS_URL"]), or
boto3.client("s3", endpoint_url=os.environ["AWS_ENDPOINT"], ..., config=Config(s3={"addressing_style": "path"})). The
Django and
FastAPI
fixtures the test suite runs are complete working examples.
Browser tests reach the app at APP_URL (http://ship-app.test:8000):
browsers force a single-label host such as app to HTTPS, so the app gets a
dotted alias whenever a testing service is selected.
import os
from playwright.sync_api import sync_playwright
with sync_playwright() as playwright:
browser = playwright.chromium.connect(os.environ["PLAYWRIGHT_WS_URL"])
page = browser.new_page()
page.goto(os.environ["APP_URL"])
Every image carries an exact version tag, reviewed through Renovate:
| Service | Image |
|---|---|
| PostgreSQL | postgres:17.12-alpine3.24 |
| MySQL | mysql:9.7.4 |
| Redis | redis:8.10.3-alpine3.23 |
| Mailpit | axllent/mailpit:v1.31.1 |
| Meilisearch | getmeili/meilisearch:v1.56.2 |
| Garage | dxflrs/garage:v2.5.0 (built from ship/garage/) |
| SeaweedFS | chrislusf/seaweedfs:4.46 |
| RustFS | rustfs/rustfs:1.0.0 |
| Silo | pgsty/silo:RELEASE.2026-09-16T00-00-00Z |
| Selenium | selenium/standalone-chrome:4.52.0-20261101 |
| Playwright | mcr.microsoft.com/playwright:v1.64.1-noble |
| Node.js | node:24.18.0-alpine3.24 |
Silo on older CPUs
Silo publishes two images of every release, and they don't run on the same set of machines:
siloImage |
Image | What's in it |
|---|---|---|
standard (default) |
pgsty/silo:<release> |
The server on a RHEL 9 base, with a shell and the usual tools. |
distroless |
pgsty/silo:<release>-distroless |
The server binary only. No shell, so ship shell silo can't open one. |
RHEL 9 requires a CPU with the x86-64-v2 instruction set. On an older CPU —
or a virtual machine configured with a generic CPU model — the standard
image's container fails to start. ship init explains this and asks which
image to use whenever Silo is selected (--silo-image sets it
non-interactively), and records the answer in ship.json:
"siloImage": "distroless"
Pick distroless if any machine that will run the stack might be affected.
To check a Linux machine, run
/lib64/ld-linux-x86-64.so.2 --help | grep x86-64-v2; x86-64-v2 (supported, searched) means the standard image runs there. Both images are the same Silo
release on the same data volume, so you can switch later.
Configuration (ship.json)
ship init writes this file; you rarely need to edit it by hand. Its field
names match PHP Ship's ship.json, so a team using both reads one format:
{
"framework": "django",
"app": "project.asgi:application",
"python": "3.13",
"services": {
"database": "postgres",
"cache": "redis"
},
"additionalServices": [
{"group": "database", "service": "mysql", "name": "analytics"}
],
"extensions": []
}
$schema— the shared ship.json schema, written byship initso editors validate and complete the file. PHP Ship uses the same schema.framework— the adapter:generic(any ASGI or WSGI callable),django,fastapi,flask, or a community adapter's key.app— the ASGI or WSGI target to serve,module:callable. A module undersrc/works too.python— the Python branch built into the image (ARG PYTHON_VERSION). Keep it a bare branch ("3.13") so every build gets that branch's latest patch release. See Python security floor.server— the web server:uvicorn,hypercornorgranianfor an ASGI app;gunicornorgranianfor a WSGI app; or a community server's key. Omitted, Ship uses the one recommended for the app. See Web servers.services— one selected service per group; a group without an entry means "none". PostgreSQL ispostgres;pgsql, PHP Ship's original name, is accepted too (and inadditionalServicesandserviceNames), so aship.jsonwritten by either package reads the same in both.additionalServices— extra, named instances (a second database, a second Redis, ...). See Multiple instances of a service.extensions— entry point names of installed community adapters, services and servers to load. See Extending ship.serviceNames/externalNetwork— rename Compose services and attach the app to a pre-existing Docker network. See Custom service names and an external network.name— the Compose project name; defaults to the directory name. See Running more than one project at once.siloImage—"standard"(default, omitted) or"distroless". See Silo on older CPUs.publishPorts— defaults tofalse, so production publishes nothing to the host. A reverse proxy on the project's Docker network reaches the app on port 8000. Set it totrueonly when you intend to expose${APP_PORT:-8000}; a Docker-published port bypasses most host firewalls. Production only — development always publishes what it needs, on127.0.0.1.hostUser— defaults totrue. See File ownership in dev.deployCommands— commands that run exactly once per deploy, before the app starts — migrations, typically:"deployCommands": ["python manage.py migrate --noinput"]
ship releasewrites them into the release'sdeploy-commands.shrather than running them itself; that script starts the infrastructure services, waits for them to be healthy, runs each command in a one-off app container, and stops at the first failure. This is deliberately not where boot steps live: those run at every container start (see Production releases), which is exactly wrong for a migration — several containers would run it at once. Ship never runs migrations on its own.processes— extra long-running processes from the app's image: a worker, a scheduler. Name → command:"processes": { "worker": "celery -A project worker --loglevel=info", "beat": "celery -A project beat" }
Each becomes its own Compose service with the app's image, environment and networks, no published ports, and a 60s stop grace period so a worker can finish its job. They run in development too, against the same bind-mounted code. Write each as a shell command,$VARincluded — Ship escapes every$so Compose doesn't blank out a variable meant for the container — or as an argument list (["python", "worker.py"]) to skip the shell.nodeAssets— build npm assets into the production image. See Frontend dev server.djangoCollectstatic— runcollectstaticat every production boot (Django only). The files stay in the container, so serve them from the app (for example with WhiteNoise) or from a proxy that shares the volume.
Host-port collisions are handled with environment variables, not ship.json
— see Running more than one project at once.
Adding a service later
Add the entry to ship.json's services (e.g. "cache": "redis") and run
ship up — it reads ship.json fresh every time. The exception is Garage,
which needs build files in ship/garage/; add that one by re-running
ship init.
Re-running ship init works for everything. Every prompt defaults to the
current selection, so pressing Enter keeps it; existing additionalServices
are kept, and every field it doesn't prompt for (serviceNames,
externalNetwork, publishPorts, hostUser, processes, deployCommands,
name, extensions, ...) carries over unchanged. It reads the old file
leniently, so one invalid field doesn't discard the rest.
Unlike PHP Ship, re-running ship init keeps your ship/Dockerfile: it is
yours to edit. ship init --force replaces it with the version matching the
installed python-ship — commit or back up your edits first. Ship records the
version that published the Dockerfile in ship/.ship-version, and ship up,
ship init and ship config:test warn when it differs from what's installed.
Multiple instances of a service
services holds one selection per group. For a second database, a second
Redis kept apart from the default cache, or a second bucket store, add a
named instance:
"additionalServices": [
{"group": "database", "service": "postgres", "name": "analytics"}
]
ship init offers these interactively ("Add a named additional service
instance?") and validates the name. By hand, name must be lowercase
letters, digits and underscores, starting with a letter (analytics,
queue_2). It becomes two things:
- The variables' prefix:
ANALYTICS_DB_HOST,ANALYTICS_DB_PASSWORD, ... instead ofDB_HOST. Wire them into your settings like any second connection — for Django, a secondDATABASESentry. - The Compose service:
postgres-analytics, with its own volume (postgres-analytics_data), andship db analyticsopens its shell.
Only database, cache, storage, search and mail support this; a
second browser driver or frontend toolchain isn't a coherent idea.
Custom service names and an external network
Every Compose service has a fixed name by default: app, and each selected
service's key (postgres, redis, ...). Fine for one project on its own,
but projects that share a Docker network collide on those names. Hand-edit
ship.json when you need to:
{
"serviceNames": {"app": "client-app", "postgres": "client-db"},
"externalNetwork": "shared_infra"
}
serviceNamesrenames the app or a selected service. The hostname a service injects follows the rename (DB_HOST=client-db), as doship shellwith no argument,ship db,ship manageand Mutagen sync. Volumes keep their original names, so renaming never orphans data. Commands where you type the service (ship exec,ship logs,ship shell <service>) take the new name. Additional instances already have distinct names and aren't renamed.externalNetworkattaches the app (and everyprocessesentry) to a Docker network created outside Ship, next to the project's own network — for reaching a database or cache that another Compose project runs. Point your.envat that project's hostnames.
Dependencies and ship uv
The Dockerfile installs your dependencies with uv, in this order:
| Project has | Image runs |
|---|---|
uv.lock + pyproject.toml |
uv sync --locked --no-dev |
requirements.txt |
uv pip install -r requirements.txt |
pyproject.toml only |
uv sync --no-dev |
| none of them | nothing — only the web server |
Then it installs the selected web server, so a framework-free app with no
manifest still runs. Dependencies live in /opt/ship-venv, outside the
bind-mounted /app, so the mount can't hide them.
ship uv add httpx, ship uv lock and other dependency-metadata commands
run uv and the project's Python in a temporary container with the project
mounted: pyproject.toml and uv.lock change on the host, and neither host
Python nor a host .venv is involved. Run ship up afterwards to rebuild
the image. ship uv sync, run, pip, python, tool and venv are
refused, since their effects would vanish with the container — use ship up
to install and ship exec app ... to run.
Web servers: ASGI and WSGI
Each framework adapter knows whether the app is ASGI (async) or WSGI (sync),
and ship init only offers servers that can run it, recommended first:
| App | Interface | Servers (recommended first) |
|---|---|---|
| FastAPI, Starlette-style apps | ASGI | Uvicorn, Granian, Hypercorn |
Django with project.asgi:application |
ASGI | Uvicorn, Granian, Hypercorn |
Django with project.wsgi:application |
WSGI | Gunicorn, Granian |
| Flask | WSGI | Gunicorn, Granian |
| A plain callable | detected from its signature: async def app(scope, receive, send) is ASGI, def app(environ, start_response) WSGI |
as above |
Pick one with ship init --server granian or "server": "granian" in
ship.json; without one, Ship uses the recommended server. A server that
can't run the app (Gunicorn for FastAPI, Uvicorn for Flask) is a
configuration error naming the ones that can. Ship installs the selected
server into the image, with reload in development. Granian serves both
interfaces and runs with --interface asgi or --interface wsgi to match.
A community package can add another server (see Extending ship).
In production, every server reads its tuning from .env.production:
Uvicorn and Gunicorn take WEB_CONCURRENCY (worker processes) and
FORWARDED_ALLOW_IPS (which proxies to trust for X-Forwarded-*; set it to
your proxy's address); Granian takes GRANIAN_WORKERS and its other
GRANIAN_* settings. Uvicorn runs with --proxy-headers.
Background tasks (Celery)
Select Celery with a broker:
ship init --cache redis --tasks celery # Redis as broker and result backend
ship init --broker rabbitmq --cache redis --tasks celery # RabbitMQ broker, Redis results
Ship adds two containers built from the app's own image, with its
environment, dependencies and (in development) code: celery runs a worker,
celery-beat runs the beat scheduler. The app and both containers receive:
| Variable | Value |
|---|---|
CELERY_BROKER_URL |
RabbitMQ when it is selected, otherwise Redis (database 1) |
CELERY_RESULT_BACKEND |
Redis (database 2) when it is selected, otherwise rpc:// |
CELERY_APP |
What celery -A loads. Defaults to the Django project package (project) or the app's module (main); set it in .env when your Celery app lives elsewhere, such as CELERY_APP=tasks |
Your app declares celery (with celery[redis] for Redis) and builds its
Celery app from those variables:
import os
from celery import Celery
celery = Celery("tasks", broker=os.environ["CELERY_BROKER_URL"], backend=os.environ["CELERY_RESULT_BACKEND"])
Django projects follow Celery's own Django guide; with
app.config_from_object("django.conf:settings", namespace="CELERY"), the
injected CELERY_BROKER_URL and CELERY_RESULT_BACKEND are picked up as
settings. Canvas works as usual (chain, group, chord); chords need a
real result backend, so select Redis. Set CELERY_LOG_LEVEL to change the
log level. In development the worker restarts on code changes when
watchfiles is installed; otherwise run ship up after changing tasks. The
worker and beat run in production too, and a release's deploy-commands.sh
starts the broker and database but not them.
Production releases
Production is two commands, not a flag on ship up:
ship build # build every project-owned production image
ship release --tag 1.2.0 # build + assemble the portable release artifact
Both build a materially different image from ship up's development one:
- No bind mount. The code is copied into the image at build time, through
the
builder→productionstages ofship/Dockerfile. - No build tools, not root. The production stage carries the installed app and server only: no uv, no pip, and it runs as UID 10001.
- Framework boot steps run at container boot, not build time. Django
gets
manage.py check --deploy(andcollectstaticwithdjangoCollectstatic) before the server starts, because those steps need the real environment, which only exists once the container starts.FrameworkAdapter.release_commands()is the extension point for this. - Fresh base images. Production builds always pull the base image
(
build.pull), so a release never ships on a stale cached Python. - Development-only services disappear. Mailpit, Selenium, Playwright and Node are absent from the production model, along with their variables.
- No override file.
docker-compose.override.ymlis a development convenience and never reaches a production image.
Python security floor
Ship refuses to build on a Python release with known security vulnerabilities. The current floor comes from the October 2026 expedited security releases, which fixed the bundled pip certificate-chain problem, tarfile link handling (CVE-2026-114583), and bundled Expat vulnerabilities (CVE-2026-77214, CVE-2026-102633):
| Branch | Oldest release Ship builds on |
|---|---|
| 3.11 | 3.11.18 |
| 3.12 | 3.12.16 |
| 3.13 | 3.13.18 |
| 3.14 | 3.14.10 |
| 3.15 | 3.15.2 |
| 3.10 and older | none (end of life, no upstream fixes) |
It is enforced at three points:
ship init,ship config:testand every command that generates a Compose file reject an end-of-lifepythonbranch, or a pinned patch release below the floor ("3.13.4").- The Dockerfile's
basestage runsship/check-python-security-floor.pyagainst the Python actually in the image, and fails the build if it is below the floor. This catches a stalepython:3.13-slimthat Docker keeps reusing from its local cache; the fix is in the message:docker pullthat image. ship build/ship releasealways pull fresh base images.ship updoesn't force a pull, so development still works offline.
The floor lives in python_ship.security and is raised whenever python.org
ships a security release.
.env.production
A single project-level file, .env.production, is the one source of
production credentials and config — you create it; Ship never generates one.
ship init adds it to .gitignore. ship build/ship release make its
values available to docker compose build, and ship release copies the
whole file to the release's .env, read by the containers at boot.
ship release fails clearly if it doesn't exist.
Selected services' secrets (DB_PASSWORD, DB_ROOT_PASSWORD,
MEILISEARCH_KEY, AWS_SECRET_ACCESS_KEY, GARAGE_RPC_SECRET,
GARAGE_ADMIN_TOKEN, each with its instance prefix where one applies) are
required in production: Compose itself refuses to start without them, and
ship config:test/ship build/ship release check before Docker is invoked
— reporting a missing value, or one still set to a development default such
as ship. Non-secret settings (DB_NAME, DB_USER, AWS_BUCKET, ...) keep
their defaults unless you set them.
What ship release --tag produces
dist/ship/1.2.0/
├── docker-compose.yml # final images: tags, no build:, no source needed
├── .env # copied from .env.production (mode 0600)
├── images/
│ ├── app.tar # docker save — one per unique image, not per service
│ └── postgres.tar
├── release.json # tag, git commit, python-ship version, image digests — no secrets
├── deploy-commands.sh # only when deployCommands is set
└── README.md # the exact commands to deploy this release
dist/ship/ is git-ignored, and excluded from the Docker build context along
with .env/.env.*, .npmrc and auth.json, so no earlier release or
secret can end up in an image; ship build/ship release re-apply those
rules as the last lines of .dockerignore every time. On POSIX the release
directory is owner-only; on Windows, restrict it with filesystem ACLs before
sharing it. Services that build from identical definitions (the app and every
processes entry) share one image and one archive. Infrastructure images are
archived too, so the server never needs registry access.
A deploy, once the folder is on a machine with nothing but Docker:
docker load -i images/app.tar
docker load -i images/postgres.tar
sh deploy-commands.sh # only present when deployCommands is set
docker compose up -d
Ship deliberately stops there — there's no ship deploy that SSHes anywhere.
Getting the folder onto the server is up to you; what Ship guarantees is that
the artifact needs nothing else once it's there.
CI/CD
The same commands, the same artifact:
- run: uv tool install python-ship
- run: ship release --tag ${{ github.ref_name }}
- run: # upload dist/ship/${{ github.ref_name }} however your pipeline deploys
ship release fails immediately without --tag when it isn't attached to a
terminal, instead of prompting and hanging the pipeline.
HTTPS / TLS
The app listens on plain HTTP on port 8000; Ship doesn't terminate TLS. Put a
TLS-terminating reverse proxy in front — one you already run (a load
balancer, Cloudflare, Caddy, Traefik, nginx) or one you add through the
override file. A proxy on the host can use publishPorts: true; for example,
with APP_PORT=8000 in .env.production and DNS pointing at the host, this
Caddyfile serves the release over HTTPS:
example.com {
reverse_proxy 127.0.0.1:8000
}
Allow public traffic only to the proxy's ports, set FORWARDED_ALLOW_IPS so
the app trusts the proxy's forwarded scheme and client address, and configure
your framework's trusted hosts, secure cookies and HTTPS redirects. Serving
the bare published port to the internet means serving plain HTTP.
Backing up data volumes
Every stateful service (PostgreSQL, MySQL, Redis, Meilisearch, the S3 stores)
keeps its data in a named Docker volume; docker volume ls lists them. A
release contains images and configuration, not that data. Ship doesn't
back volumes up; use your database's own tools, from the release directory:
docker compose exec -T postgres sh -c 'exec pg_dump -U "$POSTGRES_USER" -d "$POSTGRES_DB" -Fc' > postgres.dump
docker compose exec -T postgres sh -c 'exec pg_restore -U "$POSTGRES_USER" -d "$POSTGRES_DB" --no-owner' < postgres.dump
docker compose exec -T mysql sh -c 'exec mysqldump -u"$MYSQL_USER" -p"$MYSQL_PASSWORD" "$MYSQL_DATABASE"' > mysql.sql
For Redis, Meilisearch and storage, use their snapshot procedures, or stop the service and archive its volumes together (Garage has a data and a metadata volume):
docker run --rm -v <project>_redis_data:/data -v "$PWD":/backup alpine tar czf /backup/redis-data.tar.gz -C /data .
Restore into fresh volumes with the same service version, and test a full
restore on a separate host. ship down --volumes deletes development volumes;
it is not a backup.
Frontend dev server (Vite HMR)
Select --frontend node, then ship npm install and ship npm run dev. The
Node container publishes ${VITE_PORT:-5173} on 127.0.0.1 — the same port
inside and outside — but Vite binds the container's loopback by default, which
the published port can't reach. Add this to vite.config.js (ship init
prints it whenever Vite is installed and the config doesn't bind a host yet):
const port = Number(process.env.VITE_PORT ?? 5173);
export default defineConfig({
server: {
host: '0.0.0.0', // bind inside the container, not just its loopback
port, // the port Ship publishes on the host
strictPort: true, // fail fast instead of silently picking an unpublished port
origin: `http://localhost:${port}`, // asset URLs for pages your Python app renders
},
});
That is all HMR needs. Vite's browser client opens its WebSocket to the host
and port it was loaded from, so open the dev server at
http://localhost:5173, or load http://localhost:5173/@vite/client and your
entry module from a template your app renders (as django-vite does). Vite allows localhost origins by default, so a page on
APP_PORT can load its modules cross-origin, and origin makes imported
assets resolve against Vite rather than your app. Leave out hmr.host: the
browser then reconnects to wherever the client came from.
File changes reach Vite's watcher directly on Linux and macOS. Docker Desktop
doesn't forward file events from Windows folders, so on Windows Ship sets
CHOKIDAR_USEPOLLING=true for the Node container. Under
Mutagen the Node container gets
its own sync session instead, so events are native and polling is off.
Set VITE_PORT in .env to move both sides at once. Node isn't part of the
production stack. To compile assets into the production image, set
nodeAssets (ship init --node-assets), commit package-lock.json, and give
package.json a build script that writes to dist/: the Dockerfile builds
them in a separate Node stage and copies dist/ into the Python image, so
Node never reaches the runtime.
File ownership in dev
On Linux, the development app runs as your own UID and GID (hostUser,
default true), so files the container writes into the bind-mounted project —
migrations, collected static files, a uv.lock — stay yours. Set
"hostUser": false to use the image's default user instead. On macOS and
Windows, Docker Desktop maps bind-mount ownership itself, and under
SHIP_MUTAGEN there's no bind mount, so the setting does nothing there.
Production is unaffected either way: it always runs as UID 10001.
Debugging (debugpy)
The development app can reach your IDE at host.docker.internal on every
platform. To attach a debugger to the app instead, add debugpy to your
development dependencies, publish its port with an override file, and start
the server under it:
# docker-compose.override.yml
services:
app:
ports:
- "127.0.0.1:5678:5678"
command: ["python", "-m", "debugpy", "--listen", "0.0.0.0:5678",
"-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
Then attach your IDE to localhost:5678. Remove the override to go back to
the plain server.
Faster file sync on Windows/macOS (Mutagen)
Docker Desktop's file-sharing layer makes bind mounts noticeably slower on
Windows and macOS than on Linux. Mutagen syncs the
project into the containers instead. It's opt-in and a per-machine choice —
pointless on Linux — so it's an environment variable, not a ship.json field:
SHIP_MUTAGEN=1 ship up
ship up creates a sync session for every container that mounts the project
(the app, each processes entry and Celery container, and the Node frontend)
after the stack starts, and waits for the first sync before reporting success;
ship down terminates them. Requires the Mutagen CLI
on PATH. Virtual environments, node_modules, caches, build output, .env
files and VCS data are excluded — dependencies are installed into the image,
so run ship up again after changing them. Never applies in production.
Running more than one project at once
Every generated Compose file carries a top-level name: (ship.json's
name, or the sanitized directory name), which scopes networks and volumes,
and production uses <name>-production. Set name explicitly when it must
stay the same wherever the project is checked out.
Every published port has a variable, read from your shell or the project's
.env:
| Port | Variable | Default |
|---|---|---|
| App | APP_PORT |
8000 |
| Vite dev server | VITE_PORT |
5173 |
| Mailpit web UI | MAILPIT_WEB_PORT |
8025 |
| Silo console | SILO_CONSOLE_PORT |
9001 |
APP_PORT=8001 VITE_PORT=5174 ship up
Every one binds to 127.0.0.1 in development. Production publishes nothing
unless publishPorts is set, and then only the app on ${APP_PORT:-8000}.
Customizing the stack
ship/docker-compose.generated.yml is regenerated from ship.json by every
command, so editing it doesn't stick. Add a docker-compose.override.yml
(compose.override.yaml works too) at the project root instead — Compose's
own merge rules
apply, and every development command picks it up:
# docker-compose.override.yml
services:
adminer:
image: adminer:5
ports:
- "127.0.0.1:8099:8080"
Key overrides by the renamed service when you use serviceNames. The
override never applies to ship build/ship release. For the image itself,
edit ship/Dockerfile directly — ship init keeps your edits unless you pass
--force.
Extending ship
Third-party packages add services, framework adapters and web servers without forking Ship. A package registers a Python entry point:
[project.entry-points."python_ship.services"]
rabbitmq = "ship_rabbitmq:RabbitMQService"
[project.entry-points."python_ship.adapters"]
flask = "ship_flask:FlaskAdapter"
[project.entry-points."python_ship.servers"]
granian = "ship_granian:GranianServer"
Install it next to the ship command (uv tool install python-ship --with ship-rabbitmq) and select it by entry point name:
{
"extensions": ["rabbitmq"],
"services": {"queue": "rabbitmq"}
}
Nothing loads unless extensions names it. A missing, duplicate or broken
extension is a configuration error naming the extension. The contracts —
ServiceDefinition, FrameworkAdapter, WebServer, and the optional
ProvidesDatabaseShell/ValidatesConfiguration — are typed protocols in
python_ship.contracts.
See docs/adding-a-service.md
for a worked example, and the installable
service and
adapter examples.
Architecture
contracts.py— the public extension points and theServiceContexteach service receives.compose.py— merges selected services' fragments into the development and production Compose models. Fragments merge rather than overwrite; a real conflict is an error, not a silent winner.config.py— reads and validatesship.json, reporting every problem at once.plugins.py— resolvesextensionsinto adapters, services and servers.release.py— plans unique images and assembles the release artifact.templates/Dockerfile— multi-stage:base(with the security check),builder,productionanddevelopment, plus anassetsstage withnodeAssets.
Contributing
See docs/adding-a-service.md
for adding a service or adapter, and
docs/roadmap.md
for what's built and what's planned.
python scripts/check_local.py # Ruff, mypy, unit tests, then build and smoke-test both distributions
SHIP_DOCKER_TEST=1 python -m unittest tests.test_docker_development tests.test_docker_services
SHIP_PRODUCTION_DOCKER_TEST=1 python -m unittest tests.test_docker_production
SHIP_RELEASE_DOCKER_TEST=1 python -m unittest tests.test_docker_release
The Docker suites create and remove their own containers, volumes, networks
and images. Maintainers publish with docs/releasing.md.
License
MIT. See LICENSE.md.
Metadata
Release files for python-ship 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| python_ship-0.1.0.tar.gz | 161.7 kB | With provenance | Details for python_ship-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| python_ship-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for python_ship-0.1.0-py3-none-any.whl |
Total release size: 237.0 kB
Release files / python_ship-0.1.0.tar.gz
| Download URL | python_ship-0.1.0.tar.gz |
|---|---|
| Size | 161.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
45aa8c1644fee9caeedb8167b408c4be20b037b01aa95892de0614fadb89dae0
|
|
BLAKE2b-256 checksum How to use checksums |
83693db96c4cc7d679dc0c6db296852a9bfe925cd8ba62a84032e7ca90573a83
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.
Transparency logRelease files / python_ship-0.1.0-py3-none-any.whl
| Download URL | python_ship-0.1.0-py3-none-any.whl |
|---|---|
| Size | 75.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
669c6cd986850c0a5de75860846058ec29f171cd84d571e242205e41767a8702
|
|
BLAKE2b-256 checksum How to use checksums |
fb44c042bf1b5fede921784edc40f25e19b5e005467dde297d6927a72314938b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.
Transparency logSecurity for python-ship 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for python_ship-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.