portus-py
Docker scaffolding for Python projects. Scans your project and generates a production-ready Dockerfile, .dockerignore, and docker-compose.yaml tailored to what it finds.
For Node.js projects, see Portus instead — the original, npm-published version of this tool.
Requirements
Python 3.9 or later to run portus-py itself. Docker is required separately to build and run the generated Dockerfile and docker-compose.yaml.
Installation
pip install portus-py
Usage
Preview what portus-py detects without writing any files:
portus-py scan
Generate Docker configuration for the current project:
portus-py init
This scans the repository, prints what was detected, and writes a Dockerfile, .dockerignore, and docker-compose.yaml. If any of these files already exist, you will be prompted before they are overwritten.
Skip overwrite prompts:
portus-py init --yes
What gets detected
- Package manager — resolved from lockfiles, in priority order:
poetry.lock,pdm.lock,uv.lock,Pipfile.lock,requirements.txt, defaulting to plainpipif none are found. - Python version — resolved from
pyproject.toml(requires-pythonor Poetry'spythondependency), then.python-version, thenruntime.txt, defaulting to 3.12. - Framework — Django, FastAPI, and Flask (all treated as web services), and Celery (treated as a background worker with no HTTP port or healthcheck).
Framework support
For Django, FastAPI, and Flask, portus-py inspects the actual entry-point file (manage.py, main.py, app.py) to determine the correct module path for the generated CMD, rather than guessing. When it can't confirm the app instance with high confidence, it still generates a best-effort CMD but prints a warning explaining the assumption made, so nothing fails silently.
Dockerfiles are single-stage for now — Python's packaging story doesn't lend itself to the same clean multi-stage optimization Node projects get, so this keeps the generated output simple and correct rather than fragile.
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file portus_py-0.1.0.tar.gz.
File metadata
- Download URL: portus_py-0.1.0.tar.gz
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2a389cf2844c3e920fca0885a36e3d05c577b3c54ed2c605d6b44dd5fdc35e35
|
|
| MD5 |
d353d314be4ead841200a4434fd11c8d
|
|
| BLAKE2b-256 |
8a59a7b27092315bbfe62e83305c5dffbeae3bb941def7c935ede00223af965b
|
File details
Details for the file portus_py-0.1.0-py3-none-any.whl.
File metadata
- Download URL: portus_py-0.1.0-py3-none-any.whl
- Upload date:
- Size: 14.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d28fd80ba7f371f9371fd3206ed05768db97ba2223bce72949464280464279e
|
|
| MD5 |
a5c35f889dff180e30b2b5024c3a9972
|
|
| BLAKE2b-256 |
da243fe842d9cbc831048c850ab804c2ff141b615b7bc6f52fbc9de19952ff05
|