python-ship 0.2.0__tar.gz → 0.3.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.
Files changed (117) hide show
  1. {python_ship-0.2.0/src/python_ship.egg-info → python_ship-0.3.0}/PKG-INFO +363 -178
  2. {python_ship-0.2.0 → python_ship-0.3.0}/README.md +361 -177
  3. {python_ship-0.2.0 → python_ship-0.3.0}/docs/adding-a-service.md +10 -8
  4. {python_ship-0.2.0 → python_ship-0.3.0}/docs/build-environment.md +4 -0
  5. python_ship-0.3.0/docs/standalone-runtimes.md +97 -0
  6. {python_ship-0.2.0 → python_ship-0.3.0}/docs/upgrading.md +25 -3
  7. {python_ship-0.2.0 → python_ship-0.3.0}/pyproject.toml +2 -1
  8. {python_ship-0.2.0 → python_ship-0.3.0}/schema/ship.schema.json +22 -0
  9. {python_ship-0.2.0 → python_ship-0.3.0}/src/python_ship/__init__.py +1 -1
  10. {python_ship-0.2.0 → python_ship-0.3.0}/src/python_ship/adapters.py +28 -3
  11. {python_ship-0.2.0 → python_ship-0.3.0}/src/python_ship/capabilities.py +26 -1
  12. {python_ship-0.2.0 → python_ship-0.3.0}/src/python_ship/cli.py +305 -90
  13. {python_ship-0.2.0 → python_ship-0.3.0}/src/python_ship/compose.py +40 -14
  14. {python_ship-0.2.0 → python_ship-0.3.0}/src/python_ship/config.py +26 -11
  15. {python_ship-0.2.0 → python_ship-0.3.0}/src/python_ship/contracts.py +13 -1
  16. python_ship-0.3.0/src/python_ship/environment.py +291 -0
  17. python_ship-0.3.0/src/python_ship/image_build.py +143 -0
  18. {python_ship-0.2.0 → python_ship-0.3.0}/src/python_ship/init.py +298 -76
  19. python_ship-0.3.0/src/python_ship/layout.py +50 -0
  20. {python_ship-0.2.0 → python_ship-0.3.0}/src/python_ship/mutagen.py +1 -1
  21. {python_ship-0.2.0 → python_ship-0.3.0}/src/python_ship/package_managers.py +1 -1
  22. {python_ship-0.2.0 → python_ship-0.3.0}/src/python_ship/plugins.py +22 -2
  23. {python_ship-0.2.0 → python_ship-0.3.0}/src/python_ship/portable.py +7 -0
  24. python_ship-0.3.0/src/python_ship/ports.py +120 -0
  25. {python_ship-0.2.0 → python_ship-0.3.0}/src/python_ship/production.py +1 -0
  26. {python_ship-0.2.0 → python_ship-0.3.0}/src/python_ship/release.py +4 -2
  27. {python_ship-0.2.0 → python_ship-0.3.0}/src/python_ship/runtime.py +9 -7
  28. {python_ship-0.2.0 → python_ship-0.3.0}/src/python_ship/schema/ship.schema.json +22 -0
  29. {python_ship-0.2.0 → python_ship-0.3.0}/src/python_ship/security.py +2 -1
  30. python_ship-0.3.0/src/python_ship/service_setup.py +80 -0
  31. {python_ship-0.2.0 → python_ship-0.3.0}/src/python_ship/services.py +63 -4
  32. {python_ship-0.2.0 → python_ship-0.3.0}/src/python_ship/storage.py +9 -3
  33. {python_ship-0.2.0 → python_ship-0.3.0}/src/python_ship/stubs.py +23 -21
  34. {python_ship-0.2.0 → python_ship-0.3.0}/src/python_ship/templates/Dockerfile +12 -2
  35. {python_ship-0.2.0 → python_ship-0.3.0}/src/python_ship/templates/check-python-security-floor.py +1 -1
  36. python_ship-0.3.0/src/python_ship/templates/launcher +49 -0
  37. python_ship-0.3.0/src/python_ship/terminal.py +77 -0
  38. {python_ship-0.2.0 → python_ship-0.3.0}/src/python_ship/wizard.py +52 -6
  39. {python_ship-0.2.0 → python_ship-0.3.0/src/python_ship.egg-info}/PKG-INFO +363 -178
  40. {python_ship-0.2.0 → python_ship-0.3.0}/src/python_ship.egg-info/SOURCES.txt +8 -0
  41. {python_ship-0.2.0 → python_ship-0.3.0}/src/python_ship.egg-info/requires.txt +1 -0
  42. {python_ship-0.2.0 → python_ship-0.3.0}/tests/test_build_environment.py +2 -2
  43. {python_ship-0.2.0 → python_ship-0.3.0}/tests/test_cli.py +78 -8
  44. {python_ship-0.2.0 → python_ship-0.3.0}/tests/test_compose.py +43 -2
  45. {python_ship-0.2.0 → python_ship-0.3.0}/tests/test_config.py +1 -1
  46. {python_ship-0.2.0 → python_ship-0.3.0}/tests/test_docker_development.py +16 -0
  47. {python_ship-0.2.0 → python_ship-0.3.0}/tests/test_docker_portable.py +11 -0
  48. {python_ship-0.2.0 → python_ship-0.3.0}/tests/test_docker_production.py +2 -1
  49. python_ship-0.3.0/tests/test_environment.py +99 -0
  50. python_ship-0.3.0/tests/test_image_build.py +84 -0
  51. {python_ship-0.2.0 → python_ship-0.3.0}/tests/test_init.py +170 -28
  52. {python_ship-0.2.0 → python_ship-0.3.0}/tests/test_mutagen.py +1 -1
  53. {python_ship-0.2.0 → python_ship-0.3.0}/tests/test_package_managers.py +1 -1
  54. {python_ship-0.2.0 → python_ship-0.3.0}/tests/test_plugins.py +12 -0
  55. {python_ship-0.2.0 → python_ship-0.3.0}/tests/test_portable_services.py +1 -1
  56. {python_ship-0.2.0 → python_ship-0.3.0}/tests/test_production.py +12 -10
  57. {python_ship-0.2.0 → python_ship-0.3.0}/tests/test_release_contract.py +1 -0
  58. {python_ship-0.2.0 → python_ship-0.3.0}/tests/test_runtime.py +7 -0
  59. {python_ship-0.2.0 → python_ship-0.3.0}/tests/test_security.py +2 -2
  60. {python_ship-0.2.0 → python_ship-0.3.0}/tests/test_services.py +18 -2
  61. python_ship-0.3.0/tests/test_wizard_terminal.py +89 -0
  62. python_ship-0.2.0/src/python_ship/environment.py +0 -77
  63. python_ship-0.2.0/tests/test_environment.py +0 -55
  64. python_ship-0.2.0/tests/test_wizard_terminal.py +0 -46
  65. {python_ship-0.2.0 → python_ship-0.3.0}/LICENSE.md +0 -0
  66. {python_ship-0.2.0 → python_ship-0.3.0}/MANIFEST.in +0 -0
  67. {python_ship-0.2.0 → python_ship-0.3.0}/docs/releasing.md +0 -0
  68. {python_ship-0.2.0 → python_ship-0.3.0}/examples/community-adapter/README.md +0 -0
  69. {python_ship-0.2.0 → python_ship-0.3.0}/examples/community-adapter/pyproject.toml +0 -0
  70. {python_ship-0.2.0 → python_ship-0.3.0}/examples/community-adapter/src/ship_example_starlette_adapter/__init__.py +0 -0
  71. {python_ship-0.2.0 → python_ship-0.3.0}/examples/community-service/README.md +0 -0
  72. {python_ship-0.2.0 → python_ship-0.3.0}/examples/community-service/pyproject.toml +0 -0
  73. {python_ship-0.2.0 → python_ship-0.3.0}/examples/community-service/src/ship_example_http_service/__init__.py +0 -0
  74. {python_ship-0.2.0 → python_ship-0.3.0}/schema/service-environment.json +0 -0
  75. {python_ship-0.2.0 → python_ship-0.3.0}/schema/ship-release.schema.json +0 -0
  76. {python_ship-0.2.0 → python_ship-0.3.0}/setup.cfg +0 -0
  77. {python_ship-0.2.0 → python_ship-0.3.0}/src/python_ship/__main__.py +0 -0
  78. {python_ship-0.2.0 → python_ship-0.3.0}/src/python_ship/build_environment.py +0 -0
  79. {python_ship-0.2.0 → python_ship-0.3.0}/src/python_ship/portable_data.py +0 -0
  80. {python_ship-0.2.0 → python_ship-0.3.0}/src/python_ship/py.typed +0 -0
  81. {python_ship-0.2.0 → python_ship-0.3.0}/src/python_ship/schema/service-environment.json +0 -0
  82. {python_ship-0.2.0 → python_ship-0.3.0}/src/python_ship/schema/ship-release.schema.json +0 -0
  83. {python_ship-0.2.0 → python_ship-0.3.0}/src/python_ship/servers.py +0 -0
  84. {python_ship-0.2.0 → python_ship-0.3.0}/src/python_ship/templates/app-entrypoint.py +0 -0
  85. {python_ship-0.2.0 → python_ship-0.3.0}/src/python_ship/templates/garage/Dockerfile +0 -0
  86. {python_ship-0.2.0 → python_ship-0.3.0}/src/python_ship/templates/garage/garage.toml +0 -0
  87. {python_ship-0.2.0 → python_ship-0.3.0}/src/python_ship/uv.py +0 -0
  88. {python_ship-0.2.0 → python_ship-0.3.0}/src/python_ship.egg-info/dependency_links.txt +0 -0
  89. {python_ship-0.2.0 → python_ship-0.3.0}/src/python_ship.egg-info/entry_points.txt +0 -0
  90. {python_ship-0.2.0 → python_ship-0.3.0}/src/python_ship.egg-info/top_level.txt +0 -0
  91. {python_ship-0.2.0 → python_ship-0.3.0}/tests/__init__.py +0 -0
  92. {python_ship-0.2.0 → python_ship-0.3.0}/tests/fixtures/django_app/manage.py +0 -0
  93. {python_ship-0.2.0 → python_ship-0.3.0}/tests/fixtures/django_app/project/__init__.py +0 -0
  94. {python_ship-0.2.0 → python_ship-0.3.0}/tests/fixtures/django_app/project/asgi.py +0 -0
  95. {python_ship-0.2.0 → python_ship-0.3.0}/tests/fixtures/django_app/project/settings.py +0 -0
  96. {python_ship-0.2.0 → python_ship-0.3.0}/tests/fixtures/django_app/project/urls.py +0 -0
  97. {python_ship-0.2.0 → python_ship-0.3.0}/tests/fixtures/django_app/project/views.py +0 -0
  98. {python_ship-0.2.0 → python_ship-0.3.0}/tests/fixtures/django_app/requirements.txt +0 -0
  99. {python_ship-0.2.0 → python_ship-0.3.0}/tests/fixtures/fastapi_app/main.py +0 -0
  100. {python_ship-0.2.0 → python_ship-0.3.0}/tests/fixtures/fastapi_app/requirements.txt +0 -0
  101. {python_ship-0.2.0 → python_ship-0.3.0}/tests/fixtures/flask_app/app.py +0 -0
  102. {python_ship-0.2.0 → python_ship-0.3.0}/tests/fixtures/flask_app/requirements.txt +0 -0
  103. {python_ship-0.2.0 → python_ship-0.3.0}/tests/fixtures/plain_asgi/main.py +0 -0
  104. {python_ship-0.2.0 → python_ship-0.3.0}/tests/helpers.py +0 -0
  105. {python_ship-0.2.0 → python_ship-0.3.0}/tests/test_adapters.py +0 -0
  106. {python_ship-0.2.0 → python_ship-0.3.0}/tests/test_capabilities.py +0 -0
  107. {python_ship-0.2.0 → python_ship-0.3.0}/tests/test_docker_release.py +0 -0
  108. {python_ship-0.2.0 → python_ship-0.3.0}/tests/test_docker_services.py +0 -0
  109. {python_ship-0.2.0 → python_ship-0.3.0}/tests/test_docker_tooling.py +0 -0
  110. {python_ship-0.2.0 → python_ship-0.3.0}/tests/test_extensions.py +0 -0
  111. {python_ship-0.2.0 → python_ship-0.3.0}/tests/test_plain_asgi_http.py +0 -0
  112. {python_ship-0.2.0 → python_ship-0.3.0}/tests/test_release.py +0 -0
  113. {python_ship-0.2.0 → python_ship-0.3.0}/tests/test_schema.py +0 -0
  114. {python_ship-0.2.0 → python_ship-0.3.0}/tests/test_servers.py +0 -0
  115. {python_ship-0.2.0 → python_ship-0.3.0}/tests/test_shared_contract.py +0 -0
  116. {python_ship-0.2.0 → python_ship-0.3.0}/tests/test_uv.py +0 -0
  117. {python_ship-0.2.0 → python_ship-0.3.0}/tests/vite.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-ship
3
- Version: 0.2.0
3
+ Version: 0.3.0
4
4
  Summary: Framework-agnostic, cross-platform Docker development environment and portable releases for Python web apps.
5
5
  Author: python-ship
6
6
  License-Expression: MIT
@@ -30,6 +30,7 @@ Description-Content-Type: text/markdown
30
30
  License-File: LICENSE.md
31
31
  Requires-Dist: typer<1,>=0.27
32
32
  Requires-Dist: questionary<3,>=2.1
33
+ Requires-Dist: rich>=13
33
34
  Dynamic: license-file
34
35
 
35
36
  # python-ship
@@ -41,30 +42,33 @@ Dynamic: license-file
41
42
  [![PyPI Downloads](https://img.shields.io/pypi/dm/python-ship)](https://pypistats.org/packages/python-ship)
42
43
  [![License](https://img.shields.io/pypi/l/python-ship)](https://github.com/ship-ecosystem/python-ship/blob/main/LICENSE.md)
43
44
 
44
- A framework-agnostic, cross-platform Docker development environment for
45
- Python web apps, with portable production releases. It is the Python member
46
- of the Ship ecosystem, alongside [PHP Ship](https://github.com/ship-ecosystem/php-ship):
47
- the same commands, the same `ship.json` vocabulary and the same release
48
- artifact, for any ASGI or WSGI app — a plain callable, Django, FastAPI or
49
- Flask built in, anything else through a community adapter.
45
+ A cross-platform Docker development environment and portable production
46
+ release builder for Python web apps. Ship supports Django, FastAPI, Flask,
47
+ and plain ASGI or WSGI apps, with Uvicorn, Hypercorn, Gunicorn, and Granian.
48
+ Community packages can add frameworks, servers, or services.
50
49
 
51
- Ship supports Uvicorn, Hypercorn, Gunicorn, and Granian. See
52
- [upgrading an existing project](docs/upgrading.md) for configuration and data migrations.
50
+ Python Ship and [PHP Ship](https://github.com/ship-ecosystem/php-ship) share
51
+ the same CLI workflow, `ship.json` vocabulary, and portable release format.
53
52
 
54
53
  ## Contents
55
54
 
56
55
  - [Why not just write a Compose file?](#why-not-just-write-a-compose-file)
57
56
  - [Requirements](#requirements)
58
57
  - [Quick start](#quick-start)
58
+ - [Upgrading the project layout](#upgrading-the-project-layout)
59
+ - [Choosing services](#choosing-services)
59
60
  - [Commands](#commands)
61
+ - [Image build output](#image-build-output)
62
+ - [Running setup commands before startup](#running-setup-commands-before-startup)
60
63
  - [Services](#services)
61
- - [Silo on older CPUs](#silo-on-older-cpus)
64
+ - [Broadcasting](#broadcasting)
65
+ - [Web servers and app entry points](#web-servers-asgi-and-wsgi)
66
+ - [Browser testing](#browser-testing-testing)
62
67
  - [Configuration (`ship.json`)](#configuration-shipjson)
63
68
  - [Adding a service later](#adding-a-service-later)
64
69
  - [Multiple instances of a service](#multiple-instances-of-a-service)
65
70
  - [Custom service names and an external network](#custom-service-names-and-an-external-network)
66
71
  - [Dependencies and `ship uv`](#dependencies-and-ship-uv)
67
- - [Web servers: ASGI and WSGI](#web-servers-asgi-and-wsgi)
68
72
  - [Background tasks (Celery)](#background-tasks-celery)
69
73
  - [Production releases](#production-releases)
70
74
  - [Python security floor](#python-security-floor)
@@ -126,61 +130,98 @@ otherwise rebuild by hand:
126
130
  ## Quick start
127
131
 
128
132
  ```sh
129
- uv tool install python-ship # or: pipx install python-ship
133
+ uv tool install python-ship
130
134
  cd your-project
131
- ship init # pick your services interactively
132
- ship up # build and start
133
- ship manage migrate # Django only: registered when manage.py is detected
134
- ship uv add httpx # add a dependency; `ship up` rebuilds the image
135
- ship shell # drop into the app container
136
- ship down
135
+ ship init
136
+ ship up
137
137
  ```
138
138
 
139
- `ship init` detects Django (`manage.py`), FastAPI and Flask (instances or factories), then suggests the compatible target and server. A framework-free app works too — save this
140
- as `main.py` and run `ship init`:
139
+ Open the URL printed by `ship up`, normally `http://127.0.0.1:8000`. Run
140
+ `ship manage migrate` if a Django project needs migrations, and `ship down`
141
+ when you finish.
141
142
 
142
- ```python
143
- async def app(scope, receive, send):
144
- if scope["type"] != "http":
145
- return
146
- await send({"type": "http.response.start", "status": 200, "headers": []})
147
- await send({"type": "http.response.body", "body": b"Hello from Ship"})
148
- ```
143
+ `ship init` detects Django, FastAPI and Flask, including Flask app factories,
144
+ then suggests an import target and compatible web server. To start from an
145
+ empty directory, use a [plain ASGI or WSGI example](docs/standalone-runtimes.md).
146
+ You can install the CLI with `pipx install python-ship`, or add it to a uv
147
+ project with `uv add --dev python-ship` and run commands as `uv run ship ...`.
148
+
149
+ Commit `ship.json`, the published files under `docker/ship/`, the project-root
150
+ `ship` launcher, and `.env.example`. Use the installed CLI or run the launcher
151
+ as `./ship` on Linux and macOS or `python ship` on Windows.
149
152
 
150
- `ship init` writes `ship.json` and publishes a `ship/` directory (the
151
- Dockerfile and its security check) into your project root — both are meant to
152
- be committed. In scripts and CI, pass everything as options and add
153
- `--no-interaction`:
153
+ For scripts and CI, use `--no-interaction` (`-n`) with explicit choices.
154
154
 
155
155
  ```sh
156
- ship init -n --framework django --app project.asgi:application --database postgres --cache redis
156
+ ship init -n --framework django --app project.asgi:application \
157
+ --server hypercorn --database postgres --cache redis
157
158
  ```
158
159
 
159
- Production is a separate pair of commands, not a flag on `ship up` — see
160
- [Production releases](#production-releases) for `ship build`/`ship release`.
160
+ ### Upgrading the project layout
161
+
162
+ Run `ship init` after updating Python Ship. It publishes the current layout in
163
+ `docker/ship/` and archives an older managed `ship/` directory in
164
+ `docker/ship-legacy/` to make room for the launcher. Review customizations and
165
+ update paths in your Compose override. See the
166
+ [upgrade guide](docs/upgrading.md) for Dockerfile and data migrations.
167
+
168
+ ### Choosing services
169
+
170
+ The wizard asks for the project name, framework and app target, then offers
171
+ servers compatible with the app's interface. Select the kinds of service you
172
+ need, then choose one provider per selected kind. Each provider list ends with
173
+ **None**. The wizard offers [named instances](#multiple-instances-of-a-service)
174
+ for eligible services in a separate step.
175
+
176
+ Ship also asks about Python, Compose service names, production processes,
177
+ external networks, and the host ports to publish in each environment. New
178
+ projects start with Python 3.14 and the app's HTTP port published in both
179
+ development and production. Review the summary before writing changes. In the
180
+ terminal wizard, press **Ctrl+U** to return to the previous prompt.
181
+
182
+ After confirmation, the wizard shows a table for each environment file with
183
+ its values, the service or group that uses each key, and what changed.
184
+ Credentials appear masked.
185
+
186
+ | File | What Ship fills in |
187
+ |---|---|
188
+ | `.env` | Development defaults, managed connection settings such as `DB_HOST`, and selected host ports. If the file is missing, Ship starts with `.env.example` when available. |
189
+ | `.env.example` | Known connection defaults and blank placeholders for credentials and custom values. |
190
+ | `.env.production` | Production connection settings and placeholders for required credentials. Ship omits settings used only by development tools. |
191
+
192
+ Ship preserves configurable credentials and suggests the Python client
193
+ packages your selected services need. Add them to your application
194
+ dependencies and rebuild with `ship up`. Use [Production releases](#production-releases)
195
+ when you are ready to build a deployment.
161
196
 
162
197
  ## Commands
163
198
 
199
+ Run `ship --help` for the grouped command list or `ship help <command>` for
200
+ options and examples.
201
+
164
202
  | Command | What it does |
165
203
  |---|---|
166
- | `ship init` | Interactive picker for the framework, ASGI target, server and services (database, cache, storage, ...); writes `ship.json` and publishes `ship/`. Scriptable flags cover services, instances, processes and networks (`ship init --help`). Re-run it to change selections — see [Adding a service later](#adding-a-service-later). |
167
- | `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. |
204
+ | `ship init` | Picks the framework, app target, server, services and published ports. Writes `ship.json`, the project launcher, and Docker templates under `docker/ship/`. Run `ship init --help` for automation flags. |
205
+ | `ship up` | Regenerates `docker/ship/docker-compose.generated.yml` from `ship.json`, builds the development images, then starts the stack and waits for container healthchecks and an HTTP response. |
168
206
  | `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](#production-releases). |
169
207
  | `ship release --tag <tag> [--force] [--no-env]` | Builds the same images (re-tagged) and assembles the portable release under `dist/ship/<tag>/`. |
170
208
  | `ship down [--volumes]` | `docker compose down`. `--volumes` also deletes named volumes (database and storage data — use with care). |
209
+ | `ship ps [OPTIONS] [SERVICE...]` | Shows development containers, including stopped ones, and their published ports. Passes filters and formatting options to Compose. |
210
+ | `ship run [--env NAME=value] [--] COMMAND [ARGS...]` | Runs a setup command in a disposable development container with the project bind-mounted. Works before `ship up`. |
171
211
  | `ship exec <service> <cmd...>` | Runs a command inside a running service. The generic escape hatch every shortcut below wraps. |
172
212
  | `ship shell [service]` | Opens a shell (`sh`) in a service; defaults to the app. |
173
213
  | `ship logs [service] [-f]` | Shows logs for one service, or all of them. `-f`/`--follow` streams. |
174
214
  | `ship db [instance]` | Opens the database's client (`psql`/`mysql`/`mariadb`/`mongosh`/`sqlcmd`) with credentials from its own container. Name one of `additionalServices`' databases to open that instance instead. |
175
- | `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. |
176
- | `ship doctor` | Shows the installed and published versions and the state and health of every container, with a recovery hint for anything that crashed. |
215
+ | `ship check` | Validates `ship.json`, published files, both Compose models, and required production settings without Docker. Groups errors and warnings. `ship config:test` is an alias. |
216
+ | `ship doctor` | Shows project and runtime versions, published templates, and a color-coded table of development service states, health, images, and ports. Lists problems with recovery commands. |
177
217
  | `ship uv <args...>` | Runs uv dependency commands (`add`, `remove`, `lock`, `tree`, ...) in a temporary container with the project's Python. See [Dependencies](#dependencies-and-ship-uv). |
178
218
  | `ship npm/pnpm/yarn <args...>` | Runs the selected, exactly pinned tool in the Node frontend service. The manifest and lockfile remain authoritative. |
179
- | `ship package-manager TOOL[@VERSION] [--yes]` | Switches the frontend tool in its running container, records the pin and reinstalls; restores recorded files and dependencies after installation failure. Rebuild with `ship up`. |
219
+ | `ship package-manager TOOL[@VERSION] [--yes]` | Switches the frontend tool, records the pin and reinstalls. Uses a disposable Node container before the stack starts. Restores recorded files and dependencies after installation failure. |
180
220
  | `ship test [-- ARGS...]` | Runs Cypress on demand, or Python pytest against the selected Selenium/Playwright service. Install/configure the application's test client first. |
181
221
  | `ship manage <args...>` | Runs `python manage.py` in the app — only registered for Django projects. |
182
222
  | `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. |
183
223
  | `ship --version` | Shows the installed python-ship version. |
224
+ | `ship help [COMMAND]` | Lists commands by workflow or shows help for one command. |
184
225
 
185
226
  Every proxied command forwards its arguments exactly as typed (including
186
227
  flags such as `ship manage migrate --database=other`), and returns the inner
@@ -188,99 +229,132 @@ command's exit code. `--project-directory PATH` before any command runs it
188
229
  against another project. Without a terminal (CI, piped input), `exec`-style
189
230
  commands pass `-T` to Compose, so `ship db < dump.sql` works.
190
231
 
232
+ ### Image build output
233
+
234
+ Ship shows a spinner and the latest Docker build step on a dimmed line below
235
+ it. CI and non-interactive sessions show a plain progress line. Docker still
236
+ uses its build cache.
237
+ Successful build logs are hidden by default. A failed build prints Docker's
238
+ diagnostics and returns Docker's exit code.
239
+
240
+ Once the build finishes, `ship up` shows Compose's container startup progress.
241
+ The same build display applies to production `build` and `release`, and to
242
+ `ship test` when it builds the Cypress image. Test output streams live.
243
+
244
+ To stream the full build log, put `-v` or `--verbose` before the command:
245
+
246
+ ```sh
247
+ ship -v up
248
+ ship -v build
249
+ ```
250
+
251
+ ### Running setup commands before startup
252
+
253
+ After `ship init`, use `ship run` for commands that need your development
254
+ Python or Node environment. The temporary container mounts the project, so
255
+ files it writes there persist. Ship passes through command output and exit
256
+ status, and removes the container when the command exits. It starts without
257
+ dependent services or published ports. Run migrations and other commands
258
+ that need the database after `ship up`.
259
+
260
+ ```sh
261
+ ship run python --version
262
+ ship run --env DJANGO_SETTINGS_MODULE=project.settings -- python manage.py check
263
+ ship run npm ci # with the Node service selected and a package-lock.json
264
+ ship up
265
+ ```
266
+
267
+ Frontend setup commands such as `ship npm ci` can also use a disposable Node
268
+ container when the frontend service is stopped.
269
+
191
270
  ## Services
192
271
 
193
- `ship init` groups services (database, cache, storage, search, mail, testing,
194
- frontend) and lets you pick one per group. "Wired" means the container runs,
195
- is healthchecked where it can be, and the right variables are injected into
196
- the app; it does not install the Python client library your app uses to
197
- read them — that stays your app's decision.
272
+ `ship init` selects one provider per group. Use
273
+ [`additionalServices`](#multiple-instances-of-a-service) for extra named
274
+ instances of supported providers. Ship creates containers, adds health checks
275
+ where available, and supplies connection settings. Your app declares its
276
+ client dependencies and connects using those settings.
277
+
278
+ ### Databases (`database`)
198
279
 
199
280
  | Service | Wired automatically | Still needed in the app |
200
281
  |---|---|---|
201
- | PostgreSQL (`postgres`, or `pgsql`) | `DB_HOST`/`DB_PORT`/`DB_DATABASE`/`DB_USERNAME`/`DB_PASSWORD`, `ship db` | A driver such as `psycopg[binary]`, and settings that read `DB_*` |
202
- | MySQL (`mysql`) | The same `DB_*` variables, a separate `DB_ROOT_PASSWORD` the app never receives, `ship db` | A driver such as `mysqlclient` or `PyMySQL` |
203
- | MariaDB (`mariadb`) | `DB_HOST`/`DB_PORT`/`DB_DATABASE`/`DB_USERNAME`/`DB_PASSWORD`, separate admin credential and `ship db` | A Python MySQL/MariaDB driver and framework settings |
204
- | MongoDB (`mongodb`) | Separate application/admin users, structured connection settings and encoded `MONGODB_URI` at application start, `ship db` | A MongoDB client; select/configure the framework backend explicitly |
205
- | SQL Server (`sqlserver`) | Application database/login, separate admin credential, `DB_*`, `ship db` | A Python driver and any native libraries it needs; an appropriate production license |
206
- | Valkey (`valkey`) | `REDIS_HOST`/`REDIS_PORT`, persistent Redis-compatible protocol | A Redis-compatible client; construct the connection from the injected settings |
207
- | Memcached (`memcached`) | `MEMCACHED_HOST`/`MEMCACHED_PORT`; ephemeral cache | A Memcached client; do not use it for persistent queues |
208
- | Elasticsearch (`elasticsearch`) | Authenticated single-node service, `ELASTICSEARCH_*` | An Elasticsearch client and suitable host resources |
209
- | Typesense (`typesense`) | Persistent service, `TYPESENSE_HOST`/`PORT`/`PROTOCOL`/`API_KEY` | A Typesense client and application collection schemas |
210
- | Centrifugo (`centrifugo`) | HTTP publishing API, token secret and WebSocket endpoint; optional Redis/Valkey engine | Application publishing/token logic and browser client; production origins and real credentials |
211
- | Cypress (`cypress`) | On-demand development browser container and internal base URL | Cypress tests/configuration; run `ship test` |
212
- | Redis (`redis`) | `REDIS_URL`; RDB snapshots plus an append-only log | `redis` |
213
- | 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 |
214
- | Celery (`celery`, tasks group) | A worker container from the app's image; `CELERY_BROKER_URL`, `CELERY_RESULT_BACKEND`, `CELERY_APP` | `celery` in your dependencies — see [Background tasks](#background-tasks-celery) |
215
- | 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 |
216
- | Meilisearch (`meilisearch`) | `MEILISEARCH_URL`/`MEILISEARCH_KEY` | `meilisearch` (or plain HTTP) |
217
- | 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](#silo-on-older-cpus) |
218
- | Selenium (`selenium`) | A Chrome grid, `SELENIUM_REMOTE_URL`, `APP_URL`. Development only | `selenium` in your test dependencies |
219
- | Playwright (`playwright`) | A browser server, `PLAYWRIGHT_WS_URL`, `APP_URL`. Development only | `playwright==1.65.1` — the client must match the server version |
220
- | Node.js (`node`) | A Node container for `ship npm`, Vite's port published. Development only | See [Frontend dev server](#frontend-dev-server-vite-hmr) |
221
-
222
- Connecting a Django app to the injected variables:
282
+ | PostgreSQL (`postgres`, alias `pgsql`) | `DB_HOST`, `DB_PORT`, `DB_DATABASE`, `DB_USERNAME`, `DB_PASSWORD` and `ship db` | A driver such as `psycopg[binary]` |
283
+ | MySQL (`mysql`) | The `DB_*` settings, a separate root credential, and `ship db` | A driver such as `mysqlclient` or `PyMySQL` |
284
+ | MariaDB (`mariadb`) | The `DB_*` settings, a separate root credential, and `ship db` | A MySQL/MariaDB driver |
285
+ | MongoDB (`mongodb`) | Separate app and admin users, `MONGODB_DATABASE`, and an encoded `MONGODB_URI` at app startup | A client such as `pymongo` and your framework's MongoDB backend, if needed |
286
+ | SQL Server (`sqlserver`) | An application database and login, `DB_*` settings, and `ship db`. The image uses linux/amd64 and defaults to Developer edition. | A driver such as `pymssql` or `pyodbc` with its native driver. Set `MSSQL_PID` in `.env.production` to select the edition for deployment. |
287
+
288
+ For example, Django can configure PostgreSQL and Redis from the container's
289
+ environment in `settings.py`.
223
290
 
224
291
  ```python
225
292
  import os
226
293
 
227
- DATABASES = {"default": {
228
- "ENGINE": "django.db.backends.postgresql",
229
- "HOST": os.environ["DB_HOST"], "PORT": os.environ["DB_PORT"],
230
- "NAME": os.environ["DB_DATABASE"], "USER": os.environ["DB_USERNAME"],
231
- "PASSWORD": os.environ["DB_PASSWORD"],
232
- }}
233
- CACHES = {"default": {"BACKEND": "django.core.cache.backends.redis.RedisCache",
234
- "LOCATION": os.environ["REDIS_URL"]}}
294
+ DATABASES = {
295
+ "default": {
296
+ "ENGINE": "django.db.backends.postgresql",
297
+ "HOST": os.environ["DB_HOST"],
298
+ "PORT": os.environ["DB_PORT"],
299
+ "NAME": os.environ["DB_DATABASE"],
300
+ "USER": os.environ["DB_USERNAME"],
301
+ "PASSWORD": os.environ["DB_PASSWORD"],
302
+ }
303
+ }
304
+ CACHES = {
305
+ "default": {
306
+ "BACKEND": "django.core.cache.backends.redis.RedisCache",
307
+ "LOCATION": os.environ["REDIS_URL"],
308
+ }
309
+ }
235
310
  ```
236
311
 
237
- A FastAPI or framework-free app passes the same values to its own clients:
238
- `psycopg.connect(host=os.environ["DB_HOST"], ...)`,
239
- `redis.from_url(os.environ["REDIS_URL"])`, or
240
- `boto3.client("s3", endpoint_url=os.environ["AWS_ENDPOINT"], ...,
241
- config=Config(s3={"addressing_style": "path"}))`. The
242
- [Django](https://github.com/ship-ecosystem/python-ship/tree/main/tests/fixtures/django_app) and
243
- [FastAPI](https://github.com/ship-ecosystem/python-ship/tree/main/tests/fixtures/fastapi_app)
244
- fixtures the test suite runs are complete working examples.
312
+ FastAPI, Flask, and plain apps can pass the same settings directly to their
313
+ clients. See the working [Django](tests/fixtures/django_app) and
314
+ [FastAPI](tests/fixtures/fastapi_app) examples used in the Docker tests.
245
315
 
246
- Browser tests reach the app at `APP_URL` (`http://ship-app.test:8000`):
247
- browsers force a single-label host such as `app` to HTTPS, so the app gets a
248
- dotted alias whenever a testing service is selected.
316
+ ### Cache (`cache`)
317
+
318
+ | Service | Wired automatically | Still needed in the app |
319
+ |---|---|---|
320
+ | Redis (`redis`) | `REDIS_URL`, `REDIS_HOST`, `REDIS_PORT`, and persistent storage | The `redis` client |
321
+ | Valkey (`valkey`) | The same Redis-compatible settings and persistent storage | A Redis-compatible client |
322
+ | Memcached (`memcached`) | `MEMCACHED_HOST` and `MEMCACHED_PORT` | A client such as `pymemcache`. Use it for ephemeral cache data. |
323
+
324
+ ### Search (`search`)
325
+
326
+ | Service | Wired automatically | Still needed in the app |
327
+ |---|---|---|
328
+ | Meilisearch (`meilisearch`) | `MEILISEARCH_URL`, `MEILISEARCH_HOST` and `MEILISEARCH_KEY` | A Meilisearch client or an HTTP client |
329
+ | Elasticsearch (`elasticsearch`) | An authenticated single-node service with `ELASTICSEARCH_HOST`, `ELASTICSEARCH_USERNAME` and `ELASTICSEARCH_PASSWORD` | An Elasticsearch client and enough host resources for the search node |
330
+ | Typesense (`typesense`) | Persistent storage and `TYPESENSE_HOST`, `TYPESENSE_PORT`, `TYPESENSE_PROTOCOL` and `TYPESENSE_API_KEY` | A Typesense or HTTP client and the application's collection schemas |
331
+
332
+ ### Object storage (`storage`)
333
+
334
+ | Service | Wired automatically | Still needed in the app |
335
+ |---|---|---|
336
+ | Garage (`garage`) | An S3 endpoint with a default key and bucket | An S3 client |
337
+ | SeaweedFS (`seaweedfs`), RustFS (`rustfs`), Silo (`silo`) | Authenticated S3 endpoints, with a development console for Silo when published | An S3 client. Create the bucket named by `AWS_BUCKET` before storing objects. |
338
+
339
+ All four provide `AWS_ENDPOINT`, `AWS_USE_PATH_STYLE_ENDPOINT`,
340
+ `AWS_DEFAULT_REGION`, `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY` and
341
+ `AWS_BUCKET`. With boto3, set the endpoint explicitly and use path-style
342
+ addressing.
249
343
 
250
344
  ```python
251
345
  import os
252
- from playwright.sync_api import sync_playwright
253
346
 
254
- with sync_playwright() as playwright:
255
- browser = playwright.chromium.connect(os.environ["PLAYWRIGHT_WS_URL"])
256
- page = browser.new_page()
257
- page.goto(os.environ["APP_URL"])
258
- ```
347
+ import boto3
348
+ from botocore.config import Config
259
349
 
260
- Built-in images use reviewed tags or digests; release registry references are pinned to their repository digest. Representative images:
350
+ s3 = boto3.client(
351
+ "s3",
352
+ endpoint_url=os.environ["AWS_ENDPOINT"],
353
+ config=Config(s3={"addressing_style": "path"}),
354
+ )
355
+ ```
261
356
 
262
- | Service | Image |
263
- |---|---|
264
- | PostgreSQL | `postgres:18.7-alpine` |
265
- | MySQL | `mysql:9.7.4` |
266
- | Redis | `redis:8.10.3-alpine3.23` |
267
- | RabbitMQ | `rabbitmq:4.4.1-management-alpine` |
268
- | Mailpit | `axllent/mailpit:v1.34.0` |
269
- | Meilisearch | `getmeili/meilisearch:v1.57.0` |
270
- | Garage | `dxflrs/garage:v2.5.0` (built from `ship/garage/`) |
271
- | SeaweedFS | `ghcr.io/chrislusf/seaweedfs:4.47` |
272
- | RustFS | `rustfs/rustfs:1.0.6` |
273
- | Silo | `pgsty/silo:RELEASE.2026-11-12T00-00-00Z` |
274
- | Selenium | `selenium/standalone-chromium:4.53.0-20261120` |
275
- | Playwright | `mcr.microsoft.com/playwright:v1.65.1-noble` |
276
- | Node.js | Reviewed digest-pinned Node 22/24/26 image (`node` field) |
277
-
278
- Ship rebuilds PostgreSQL, MySQL, Typesense, Elasticsearch, SeaweedFS and the development-only Cypress image
279
- with distribution package updates. Portable releases include the rebuilt
280
- production service images. Run `ship init --force` after reviewing local template
281
- edits to pick up the updated Python runtime Dockerfile.
282
-
283
- ### Silo on older CPUs
357
+ #### Silo on older CPUs
284
358
 
285
359
  Silo publishes two images of every release, and they don't run on the same
286
360
  set of machines:
@@ -306,6 +380,112 @@ To check a Linux machine, run
306
380
  searched)` means the standard image runs there. Both images are the same Silo
307
381
  release on the same data volume, so you can switch later.
308
382
 
383
+ ### Mail (`mail`)
384
+
385
+ | Service | Wired automatically | Still needed in the app |
386
+ |---|---|---|
387
+ | Mailpit (`mailpit`) | `MAIL_HOST` and `MAIL_PORT` for SMTP. Its development web UI defaults to `127.0.0.1:8025` when published. | Point your framework's mail settings or Python's `smtplib` at the SMTP address. |
388
+
389
+ ### Message broker (`broker`) and background workers (`tasks`)
390
+
391
+ | Service | Wired automatically | Still needed in the app |
392
+ |---|---|---|
393
+ | RabbitMQ (`rabbitmq`) | `AMQP_URL` and `RABBITMQ_*` connection settings. Its development management UI defaults to `127.0.0.1:15672` when published. | An AMQP client such as `kombu` or `pika`, or Celery |
394
+ | Celery (`celery`) | A worker using the app image, with `CELERY_APP`, `CELERY_BROKER_URL` and `CELERY_RESULT_BACKEND` | Celery and your task definitions. See [Background tasks](#background-tasks-celery). |
395
+
396
+ ### Broadcasting
397
+
398
+ | Service | Wired automatically | Still needed in the app |
399
+ |---|---|---|
400
+ | Centrifugo (`centrifugo`) | Internal `CENTRIFUGO_URL`, API key and token secret, and browser WebSocket address `VITE_CENTRIFUGO_URL`. Its development endpoint defaults to `127.0.0.1:8001` when published. | Publish from the backend and supply authorized connection tokens to browser clients. |
401
+ | Mercure (`mercure`) | A Server-Sent Events hub with internal `MERCURE_URL`, browser-facing `MERCURE_PUBLIC_URL`, and signing settings. Its development endpoint defaults to `localhost:8002` when published. | Publish through the hub with a signed token and subscribe in the browser with an SSE client. |
402
+
403
+ #### Connecting to Centrifugo
404
+
405
+ Post JSON with a `channel` and `data` to `CENTRIFUGO_URL` plus
406
+ `/api/publish`. Send `CENTRIFUGO_API_KEY` in the `X-API-Key` header and check
407
+ the body for an `error` field. The backend signs client connection tokens
408
+ using `CENTRIFUGO_TOKEN_SECRET`. Browser clients connect to
409
+ `VITE_CENTRIFUGO_URL` and subscribe to channels your application authorizes.
410
+ [Centrifugo server API](https://centrifugal.dev/docs/server/server_api)
411
+
412
+ Set `CENTRIFUGO_API_KEY`, `CENTRIFUGO_TOKEN_SECRET` and a space-separated
413
+ `CENTRIFUGO_ALLOWED_ORIGINS` in `.env.production`. Point the browser at your
414
+ public `wss://` endpoint and route WebSockets to Centrifugo's container port
415
+ `8000`.
416
+
417
+ #### Centrifugo with Redis
418
+
419
+ Centrifugo uses its in-memory engine by default. To share broadcasts across
420
+ several Centrifugo servers, set `CENTRIFUGO_ENGINE=redis` in `.env` or
421
+ `.env.production`. Ship derives the Redis address from the selected Redis
422
+ or Valkey cache, including a custom Compose service name. Set
423
+ `CENTRIFUGO_REDIS_ADDRESS` explicitly for an external server and to make
424
+ multiple Centrifugo deployments use the same Redis instance.
425
+
426
+ #### Connecting to Mercure
427
+
428
+ Publish form-encoded `topic` and `data` fields to `MERCURE_URL` with a bearer
429
+ token that grants publication on that topic. Use `MERCURE_JWT_ISSUER` as the
430
+ token issuer and `MERCURE_PUBLIC_URL` as its audience. Browser clients
431
+ subscribe at `MERCURE_PUBLIC_URL`. Development allows anonymous subscriptions
432
+ to public updates. [Mercure token authorization](https://mercure.rocks/docs/concepts/authorization)
433
+
434
+ In `.env.production`, set `MERCURE_PUBLIC_URL` to a public HTTPS URL ending
435
+ in `/.well-known/mercure`, set `MERCURE_JWT_ISSUER` and
436
+ `MERCURE_JWT_SECRET`, and list app origins in `MERCURE_ALLOWED_ORIGINS`.
437
+ Production subscriptions require a token. Route the public URL to port
438
+ `80` on the hub and configure the reverse proxy to stream responses.
439
+ [Mercure reverse proxy guide](https://mercure.rocks/docs/deployment/reverse-proxy)
440
+
441
+ ### Web servers: ASGI and WSGI
442
+
443
+ `ship init` offers servers that match the application interface. Ship
444
+ installs the selected server and enables reload in development. The server
445
+ binds to `0.0.0.0:8000` inside the container in both environments.
446
+
447
+ | App | Interface | Available servers |
448
+ |---|---|---|
449
+ | FastAPI, Django's `project.asgi:application`, or a plain ASGI callable | ASGI | Uvicorn (recommended), Granian, Hypercorn |
450
+ | Flask, Django's `project.wsgi:application`, or a plain WSGI callable | WSGI | Gunicorn (recommended), Granian |
451
+
452
+ Choose a server with `ship init --server hypercorn` or Ship's `server`
453
+ setting in `ship.json`. See the
454
+ [runtime guide](docs/standalone-runtimes.md) for copyable entry points,
455
+ server options, and production settings.
456
+
457
+ ### Browser testing (`testing`)
458
+
459
+ | Service | Wired automatically | Still needed in the app |
460
+ |---|---|---|
461
+ | Selenium (`selenium`) | A Chromium grid with `SELENIUM_REMOTE_URL` and `APP_URL` | Install the Python `selenium` client and connect to the remote grid. |
462
+ | Playwright (`playwright`) | A remote browser server with `PLAYWRIGHT_WS_URL`, `PW_TEST_CONNECT_WS_ENDPOINT` and `PLAYWRIGHT_BASE_URL` | Match the Python Playwright client version to the browser image. |
463
+ | Cypress (`cypress`) | An on-demand container with the project mounted at `/e2e` and `CYPRESS_BASE_URL` set | Add a Cypress config and specs, then run `ship test`. |
464
+
465
+ Browser tests use the internal address `http://ship-app.test:8000` with
466
+ the selected testing service. Run `ship test` for Cypress. For Selenium
467
+ and Playwright, the same command runs pytest in the app, so declare pytest
468
+ and your browser client in the project's dev dependencies.
469
+
470
+ ### Frontend (`frontend`)
471
+
472
+ Select Node (`node`) to run npm, pnpm or Yarn and Vite in a separate
473
+ development container. See [Vite HMR](#frontend-dev-server-vite-hmr) for setup
474
+ and the required port mapping. The Node image follows the `node` field in
475
+ `ship.json`. Set `nodeAssets` to build frontend assets into the production
476
+ image.
477
+
478
+ #### JavaScript package managers
479
+
480
+ Ship defaults to npm. A pnpm or Yarn project pins its tool in
481
+ `package.json` using an exact `packageManager` value and commits the matching
482
+ lockfile. Modern Yarn also needs `nodeLinker: node-modules` in `.yarnrc.yml`.
483
+
484
+ Run `ship package-manager pnpm@VERSION` with the exact version you want
485
+ to switch tools. The command asks before replacing lockfiles and reinstalling
486
+ dependencies. The `ship npm`, `ship pnpm` and `ship yarn` proxies check the
487
+ project's selection.
488
+
309
489
  ## Configuration (`ship.json`)
310
490
 
311
491
  `ship init` writes this file; you rarely need to edit it by hand. Its field
@@ -355,12 +535,23 @@ names match PHP Ship's `ship.json`, so a team using both reads one format:
355
535
  [Running more than one project at once](#running-more-than-one-project-at-once).
356
536
  - `siloImage` — `"standard"` (default, omitted) or `"distroless"`. See
357
537
  [Silo on older CPUs](#silo-on-older-cpus).
358
- - `publishPorts` — defaults to `false`, so production publishes nothing to
359
- the host. A reverse proxy on the project's Docker network reaches the app on
360
- port 8000. Set it to `true` only when you intend to expose
361
- `${APP_PORT:-8000}`; a Docker-published port bypasses most host firewalls.
362
- Production only — development always publishes what it needs, on
363
- `127.0.0.1`.
538
+ - `publishPorts` — legacy production publishing setting. Existing projects
539
+ without `portPublishing` keep their existing policy. New projects use
540
+ `portPublishing`.
541
+ - `portPublishing` — selects generated host ports independently for development
542
+ and production. It takes precedence over `publishPorts`. Use the Compose
543
+ service name after any rename, followed by the container port. TCP is
544
+ implicit. Append `/udp` or `/sctp` for those protocols. An empty list leaves
545
+ all endpoints internal. Development binds to `127.0.0.1`.
546
+
547
+ ```json
548
+ "portPublishing": {"development": ["app:8000"], "production": ["app:8000"]}
549
+ ```
550
+
551
+ The interactive wizard lets you choose these endpoints and their host port
552
+ numbers. It keeps existing choices where possible and suggests another
553
+ number if two selected endpoints would use the same port and protocol.
554
+ The host port settings go in `.env` and `.env.production`.
364
555
  - `hostUser` — defaults to `true`. See [File ownership in dev](#file-ownership-in-dev).
365
556
  - `deployCommands` — commands that run exactly once per deploy, **before**
366
557
  the app starts — migrations, typically:
@@ -400,8 +591,9 @@ Processes may also use `{ "command": ..., "healthcheck": ..., "http": ... }`.
400
591
  The HTTP block declares a container port, open role, optional health path and
401
592
  public URL setting name. It becomes an endpoint in `release.json`.
402
593
 
403
- Setup uses arrow-key selections, service checkboxes and Ctrl+U to go back;
404
- piped input has numbered prompts. `-n` never asks questions. The final preview
594
+ Setup uses arrow-key selections, service checkboxes and Ctrl+U to go back.
595
+ Piped input accepts service types by number or name, separated by commas.
596
+ `-n` never asks questions. The final preview
405
597
  precedes writes. Scriptable flags include `--name`, repeated `--additional-service
406
598
  GROUP=PROVIDER:NAME`, `--process NAME=COMMAND_OR_JSON`, `--network`,
407
599
  `--deploy-command`, `--remove-instance`, `--remove-process` and `--no-network`.
@@ -413,20 +605,24 @@ Host-port collisions are handled with environment variables, not `ship.json`
413
605
 
414
606
  Add the entry to `ship.json`'s `services` (e.g. `"cache": "redis"`) and run
415
607
  `ship up` — it reads `ship.json` fresh every time. The exception is Garage,
416
- which needs build files in `ship/garage/`; add that one by re-running
608
+ which needs build files in `docker/ship/garage/`; add that one by re-running
417
609
  `ship init`.
418
610
 
419
- Re-running `ship init` works for everything. Every prompt defaults to the
420
- current selection, so pressing Enter keeps it; existing `additionalServices`
421
- are kept, and every field it doesn't prompt for (`serviceNames`,
422
- `externalNetwork`, `publishPorts`, `hostUser`, `processes`, `deployCommands`,
423
- `name`, `extensions`, ...) carries over unchanged. It reads the old file
424
- leniently, so one invalid field doesn't discard the rest.
425
-
426
- Unlike PHP Ship, re-running `ship init` keeps your `ship/Dockerfile`: it is
427
- yours to edit. `ship init --force` replaces it with the version matching the
428
- installed python-ship — commit or back up your edits first. Ship records the
429
- version that published the Dockerfile in `ship/.ship-version`, and `ship up`,
611
+ Re-running `ship init` works for every service. Every prompt defaults to the
612
+ current selection, so pressing Enter keeps it. Settings such as `publishPorts`,
613
+ `hostUser`, `deployCommands` and `extensions` carry over from the existing
614
+ `ship.json`. It reads the old file leniently, so one invalid field doesn't
615
+ discard the rest.
616
+
617
+ Init shows a table for each environment file with its values and changes.
618
+ It masks credentials and custom values in the output, leaves new credential
619
+ placeholders blank in templates, and updates the connection settings that
620
+ Ship controls. It also suggests client packages missing from your dependency
621
+ manifest for the services you selected.
622
+
623
+ Re-running `ship init` keeps your `docker/ship/Dockerfile`. Use `ship init --force`
624
+ to replace it with the version matching the installed package. Ship records the
625
+ version that published the Dockerfile in `docker/ship/.ship-version`, and `ship up`,
430
626
  `ship init` and `ship config:test` warn when it differs from what's installed.
431
627
 
432
628
  ### Multiple instances of a service
@@ -441,8 +637,12 @@ named instance:
441
637
  ]
442
638
  ```
443
639
 
444
- `ship init` offers these interactively ("Add a named additional service
445
- instance?") and validates the name. By hand, `name` must be lowercase
640
+ `ship init` asks whether to add a named instance after the primary service
641
+ menus. You can continue there with only named instances. When you leave both
642
+ sets empty, choose **Use only the app** or **Choose services** to reopen the
643
+ picker.
644
+
645
+ `ship init` validates the instance name. When editing `ship.json`, `name` must be lowercase
446
646
  letters, digits and underscores, starting with a letter (`analytics`,
447
647
  `queue_2`). It becomes two things:
448
648
 
@@ -452,15 +652,19 @@ letters, digits and underscores, starting with a letter (`analytics`,
452
652
  - The Compose service: `postgres-analytics`, with its own volume
453
653
  (`postgres-analytics_data`), and `ship db analytics` opens its shell.
454
654
 
455
- Only `database`, `cache`, `storage`, `search` and `mail` support this; a
456
- second browser driver or frontend toolchain isn't a coherent idea.
655
+ The built-in providers that support named instances are in `database`, `cache`,
656
+ `storage`, `search` and `mail`. Choose a browser driver, frontend toolchain or
657
+ RabbitMQ in the main picker. Extensions can also offer named instances.
457
658
 
458
659
  ### Custom service names and an external network
459
660
 
460
661
  Every Compose service has a fixed name by default: `app`, and each selected
461
- service's key (`postgres`, `redis`, ...). Fine for one project on its own,
462
- but projects that share a Docker network collide on those names. Hand-edit
463
- `ship.json` when you need to:
662
+ service's key (`postgres`, `redis`, ...). On a shared Docker network, give the
663
+ services that need to be reachable distinct names. At **App service name** in
664
+ `ship init`, enter a name such as `client-app`, or press Enter to keep the current
665
+ name. If you select only the app, this is the only naming prompt. Each selected
666
+ service or named instance has its own prompt. Type the original name, such as
667
+ `app` or `postgres`, to restore that default. Custom names are saved to `ship.json`:
464
668
 
465
669
  ```json
466
670
  {
@@ -469,13 +673,13 @@ but projects that share a Docker network collide on those names. Hand-edit
469
673
  }
470
674
  ```
471
675
 
472
- - `serviceNames` renames the app or a selected service. The hostname a
676
+ - `serviceNames` renames the app, a selected service, or a named instance
677
+ such as `postgres-analytics`. The hostname a
473
678
  service injects follows the rename (`DB_HOST=client-db`), as do `ship shell`
474
679
  with no argument, `ship db`, `ship manage` and Mutagen sync. Volumes keep
475
680
  their original names, so renaming never orphans data. Commands where you
476
681
  type the service (`ship exec`, `ship logs`, `ship shell <service>`) take the
477
- new name. Additional instances already have distinct names and aren't
478
- renamed.
682
+ new name.
479
683
  - `externalNetwork` attaches the app (and every `processes` entry) to a
480
684
  Docker network created outside Ship, next to the project's own network —
481
685
  for reaching a database or cache that another Compose project runs. Point
@@ -504,33 +708,6 @@ the image. `ship uv sync`, `run`, `pip`, `python`, `tool` and `venv` are
504
708
  refused, since their effects would vanish with the container — use `ship up`
505
709
  to install and `ship exec app ...` to run.
506
710
 
507
- ## Web servers: ASGI and WSGI
508
-
509
- Each framework adapter knows whether the app is ASGI (async) or WSGI (sync),
510
- and `ship init` only offers servers that can run it, recommended first:
511
-
512
- | App | Interface | Servers (recommended first) |
513
- |---|---|---|
514
- | FastAPI, Starlette-style apps | ASGI | Uvicorn, Granian, Hypercorn |
515
- | Django with `project.asgi:application` | ASGI | Uvicorn, Granian, Hypercorn |
516
- | Django with `project.wsgi:application` | WSGI | Gunicorn, Granian |
517
- | Flask | WSGI | Gunicorn, Granian |
518
- | A plain callable | detected from its signature: `async def app(scope, receive, send)` is ASGI, `def app(environ, start_response)` WSGI | as above |
519
-
520
- Pick one with `ship init --server granian` or `"server": "granian"` in
521
- `ship.json`; without one, Ship uses the recommended server. A server that
522
- can't run the app (Gunicorn for FastAPI, Uvicorn for Flask) is a
523
- configuration error naming the ones that can. Ship installs the selected
524
- server into the image, with reload in development. Granian serves both
525
- interfaces and runs with `--interface asgi` or `--interface wsgi` to match.
526
- A community package can add another server (see [Extending ship](#extending-ship)).
527
-
528
- In production, every server reads its tuning from `.env.production`:
529
- Uvicorn and Gunicorn take `WEB_CONCURRENCY` (worker processes) and
530
- `FORWARDED_ALLOW_IPS` (which proxies to trust for `X-Forwarded-*`; set it to
531
- your proxy's address); Granian takes `GRANIAN_WORKERS` and its other
532
- `GRANIAN_*` settings. Uvicorn runs with `--proxy-headers`.
533
-
534
711
  ## Background tasks (Celery)
535
712
 
536
713
  Select Celery with a broker:
@@ -583,7 +760,7 @@ ship release --tag 1.2.0 # build + assemble the portable release artifact
583
760
  Both build a materially different image from `ship up`'s development one:
584
761
 
585
762
  - **No bind mount.** The code is copied into the image at build time, through
586
- the `builder` → `production` stages of `ship/Dockerfile`.
763
+ the `builder` → `production` stages of `docker/ship/Dockerfile`.
587
764
  - **No build tools, not root.** The production stage carries the installed
588
765
  app and server only: no uv, no pip, and it runs as UID 10001.
589
766
  - **Framework boot steps run at container *boot*, not build time.** Django
@@ -616,7 +793,7 @@ It is enforced at three points:
616
793
  - **`ship init`, `ship config:test` and every command that generates a
617
794
  Compose file** reject an end-of-life `python` branch, or a pinned patch
618
795
  release below the floor (`"3.13.4"`).
619
- - **The Dockerfile's `base` stage** runs `ship/check-python-security-floor.py`
796
+ - **The Dockerfile's `base` stage** runs `docker/ship/check-python-security-floor.py`
620
797
  against the Python actually in the image, and fails the build if it is below
621
798
  the floor. This catches a stale `python:3.13-slim` that Docker keeps reusing
622
799
  from its local cache; the fix is in the message: `docker pull` that image.
@@ -850,19 +1027,23 @@ Every published port has a variable, read from your shell or the project's
850
1027
  | App | `APP_PORT` | `8000` |
851
1028
  | Vite dev server | `VITE_PORT` | `5173` |
852
1029
  | Mailpit web UI | `MAILPIT_WEB_PORT` | `8025` |
1030
+ | RabbitMQ management UI | `RABBITMQ_MANAGEMENT_PORT` | `15672` |
1031
+ | Centrifugo | `CENTRIFUGO_PORT` | `8001` |
1032
+ | Mercure | `MERCURE_PORT` | `8002` |
853
1033
  | Silo console | `SILO_CONSOLE_PORT` | `9001` |
854
1034
 
855
1035
  ```sh
856
1036
  APP_PORT=8001 VITE_PORT=5174 ship up
857
1037
  ```
858
1038
 
859
- Every one binds to `127.0.0.1` in development. Production publishes nothing
860
- unless `publishPorts` is set, and then only the app on `${APP_PORT:-8000}`.
1039
+ Development bindings use `127.0.0.1`. In new production configurations,
1040
+ Ship publishes the app on `${APP_PORT:-8000}`. Set `portPublishing.production`
1041
+ to `[]` when the app should be reachable only from the Docker network.
861
1042
 
862
1043
  ## Customizing the stack
863
1044
 
864
- `ship/docker-compose.generated.yml` is regenerated from `ship.json` by every
865
- command, so editing it doesn't stick. Add a `docker-compose.override.yml`
1045
+ Ship generates `docker/ship/docker-compose.generated.yml` from `ship.json`.
1046
+ Add your changes in a `docker-compose.override.yml`
866
1047
  (`compose.override.yaml` works too) at the project root instead — Compose's
867
1048
  own [merge rules](https://docs.docker.com/compose/how-tos/multiple-compose-files/merge/)
868
1049
  apply, and every development command picks it up:
@@ -878,7 +1059,7 @@ services:
878
1059
 
879
1060
  Key overrides by the *renamed* service when you use `serviceNames`. The
880
1061
  override never applies to `ship build`/`ship release`. For the image itself,
881
- edit `ship/Dockerfile` directly — `ship init` keeps your edits unless you pass
1062
+ edit `docker/ship/Dockerfile` directly — `ship init` keeps your edits unless you pass
882
1063
  `--force`.
883
1064
 
884
1065
  ## Extending ship
@@ -912,6 +1093,10 @@ extension is a configuration error naming the extension. The contracts —
912
1093
  `ServiceDefinition`, `FrameworkAdapter`, `WebServer`, and the optional
913
1094
  `ProvidesDatabaseShell`/`ValidatesConfiguration`/`DescribesRelease`/`SuggestsProcesses`/`ExposesHttp` — are typed protocols in
914
1095
  [`python_ship.contracts`](https://github.com/ship-ecosystem/python-ship/blob/main/src/python_ship/contracts.py).
1096
+ Framework adapters can supply service providers through `services()`, env-file
1097
+ defaults through `environment_defaults(config, root, environment)`, and setup
1098
+ instructions through `setup_advice(config, root)`. Setup advice uses `SetupAdvice`
1099
+ entries. Set `before_up=True` to show an instruction again at startup.
915
1100
  See [`docs/adding-a-service.md`](https://github.com/ship-ecosystem/python-ship/blob/main/docs/adding-a-service.md)
916
1101
  for a worked example, and the installable
917
1102
  [service](https://github.com/ship-ecosystem/python-ship/tree/main/examples/community-service) and