You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Add smart base image detection from pyproject.toml
- Auto-detect Python version from requires-python field
- Base images now always required (ensures Python runtime)
- Default to python:X.Y-slim based on detected version
- Users can still override with --base-image flag
- Update all documentation and examples
- Bump version to 0.3.0
Breaking change: Base images are no longer optional, but auto-detection
maintains backward compatibility for projects specifying requires-python.
Copy file name to clipboardExpand all lines: .github/copilot-instructions.md
+6-7Lines changed: 6 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,9 +20,9 @@ cli.py (entry point)
20
20
21
21
### Key Architectural Decisions
22
22
23
-
1.**No Base Image Layering (Yet)**: Currently only creates application layers, doesn't pull/layer base images like `python:3.11-slim`. The `base_image` field in `BuildConfig` is defined but not used—this is a known limitation.
23
+
1.**Smart Base Image Selection**: Auto-detects Python version from `requires-python` in `pyproject.toml` and constructs base image name (e.g., `>=3.11` → `python:3.11-slim`). Users can override with `--base-image` flag. Base images are always required—every build pulls and layers on a Python runtime.
24
24
25
-
2.**Single Layer Output**: Creates one tar layer with all app files, writes to `dist/image/blobs/sha256/<digest>`. The OCI manifest + config are written to `dist/image/`.
25
+
2.**Multi-Layer Output**: Creates base image layers + optional dependency layer + application layer. All layers are written to `dist/image/blobs/sha256/<digest>`. The OCI manifest + config are written to `dist/image/`.
26
26
27
27
3.**Entrypoint Auto-Detection**: `project.py` reads `pyproject.toml` → looks for `[project.scripts]` → converts first script to Python module invocation. Falls back to `python -m app` if nothing found.
28
28
@@ -117,12 +117,11 @@ if child.is_file() and not any(child.match(p) for p in exclude):
117
117
118
118
## Known Limitations (Do Not "Fix" Without Discussion)
119
119
120
-
1.**No base image support**: Doesn't download/layer Python runtime. Output is app-only.
121
-
2.**No registry push**: No code to push to Docker Hub/GitHub Container Registry.
122
-
3.**No dependency installation**: Doesn't run `pip install`. Expects dependencies already in context.
123
-
4.**Single architecture**: Hard-coded to `amd64`/`linux` in `builder.py`.
120
+
1.**Single architecture support**: Metadata supports multi-arch but no actual cross-compilation yet.
121
+
2.**Limited framework detection**: Supports FastAPI, Flask, Django only (easy to extend).
122
+
3.**SBOM scope**: Python packages only; doesn't parse OS packages from base images.
124
123
125
-
These are intentional scope limitations for the experiment phase.
124
+
These are intentional scope limitations for the current phase.
> **Note**: The `--base-image` flag is optional. pycontainer-build will auto-detect the Python version from your `pyproject.toml` (`requires-python` field) and use the appropriate base image (e.g., `python:3.11-slim`). You can override this by explicitly setting `--base-image python:3.12-slim` or any custom base image.
0 commit comments