common-python-tasks 0.3.1__tar.gz → 0.4.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 (33) hide show
  1. {common_python_tasks-0.3.1 → common_python_tasks-0.4.0}/PKG-INFO +92 -101
  2. {common_python_tasks-0.3.1 → common_python_tasks-0.4.0}/README.md +88 -100
  3. {common_python_tasks-0.3.1 → common_python_tasks-0.4.0}/pyproject.toml +4 -1
  4. {common_python_tasks-0.3.1 → common_python_tasks-0.4.0}/src/common_python_tasks/data/generic/.dockerignore +0 -2
  5. {common_python_tasks-0.3.1 → common_python_tasks-0.4.0}/src/common_python_tasks/data/generic/.pytest_cache/v/cache/lastfailed +2 -1
  6. {common_python_tasks-0.3.1 → common_python_tasks-0.4.0}/src/common_python_tasks/data/generic/.pytest_cache/v/cache/nodeids +155 -0
  7. {common_python_tasks-0.3.1 → common_python_tasks-0.4.0}/src/common_python_tasks/data/generic/Dockerfile.j2 +7 -3
  8. {common_python_tasks-0.3.1 → common_python_tasks-0.4.0}/src/common_python_tasks/docker.py +98 -39
  9. {common_python_tasks-0.3.1 → common_python_tasks-0.4.0}/src/common_python_tasks/docker_compose.py +8 -5
  10. {common_python_tasks-0.3.1 → common_python_tasks-0.4.0}/src/common_python_tasks/env.py +53 -12
  11. {common_python_tasks-0.3.1 → common_python_tasks-0.4.0}/src/common_python_tasks/git.py +24 -0
  12. {common_python_tasks-0.3.1 → common_python_tasks-0.4.0}/src/common_python_tasks/github.py +19 -40
  13. {common_python_tasks-0.3.1 → common_python_tasks-0.4.0}/src/common_python_tasks/project.py +29 -0
  14. {common_python_tasks-0.3.1 → common_python_tasks-0.4.0}/src/common_python_tasks/tasks.py +172 -62
  15. {common_python_tasks-0.3.1 → common_python_tasks-0.4.0}/src/common_python_tasks/utils.py +166 -13
  16. {common_python_tasks-0.3.1 → common_python_tasks-0.4.0}/LICENSE +0 -0
  17. {common_python_tasks-0.3.1 → common_python_tasks-0.4.0}/src/common_python_tasks/__init__.py +0 -0
  18. {common_python_tasks-0.3.1 → common_python_tasks-0.4.0}/src/common_python_tasks/__main__.py +0 -0
  19. {common_python_tasks-0.3.1 → common_python_tasks-0.4.0}/src/common_python_tasks/data/dockerfile_extensions/.gitkeep +0 -0
  20. {common_python_tasks-0.3.1 → common_python_tasks-0.4.0}/src/common_python_tasks/data/fastapi/alembic.ini.j2 +0 -0
  21. {common_python_tasks-0.3.1 → common_python_tasks-0.4.0}/src/common_python_tasks/data/fastapi/compose-base.yml.j2 +0 -0
  22. {common_python_tasks-0.3.1 → common_python_tasks-0.4.0}/src/common_python_tasks/data/fastapi/compose-db-debug.yml.j2 +0 -0
  23. {common_python_tasks-0.3.1 → common_python_tasks-0.4.0}/src/common_python_tasks/data/fastapi/compose-db.yml.j2 +0 -0
  24. {common_python_tasks-0.3.1 → common_python_tasks-0.4.0}/src/common_python_tasks/data/fastapi/compose-debug.yml.j2 +0 -0
  25. {common_python_tasks-0.3.1 → common_python_tasks-0.4.0}/src/common_python_tasks/data/generic/.coveragerc +0 -0
  26. {common_python_tasks-0.3.1 → common_python_tasks-0.4.0}/src/common_python_tasks/data/generic/.flake8 +0 -0
  27. {common_python_tasks-0.3.1 → common_python_tasks-0.4.0}/src/common_python_tasks/data/generic/.isort.cfg +0 -0
  28. {common_python_tasks-0.3.1 → common_python_tasks-0.4.0}/src/common_python_tasks/data/generic/.pytest_cache/.gitignore +0 -0
  29. {common_python_tasks-0.3.1 → common_python_tasks-0.4.0}/src/common_python_tasks/data/generic/.pytest_cache/CACHEDIR.TAG +0 -0
  30. {common_python_tasks-0.3.1 → common_python_tasks-0.4.0}/src/common_python_tasks/data/generic/.pytest_cache/README.md +0 -0
  31. {common_python_tasks-0.3.1 → common_python_tasks-0.4.0}/src/common_python_tasks/data/generic/Dockerfile.deps.j2 +0 -0
  32. {common_python_tasks-0.3.1 → common_python_tasks-0.4.0}/src/common_python_tasks/data/generic/cliff.toml +0 -0
  33. {common_python_tasks-0.3.1 → common_python_tasks-0.4.0}/src/common_python_tasks/data/generic/pytest.ini +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: common-python-tasks
3
- Version: 0.3.1
3
+ Version: 0.4.0
4
4
  Summary: Opinionated Poe the Poet tasks for Python package development.
5
5
  License-Expression: MIT
6
6
  License-File: LICENSE
@@ -17,14 +17,17 @@ Classifier: Programming Language :: Python :: 3.14
17
17
  Classifier: Topic :: Software Development :: Build Tools
18
18
  Requires-Dist: autoflake (>=2.3.1,<3.0.0)
19
19
  Requires-Dist: black (>=26.3.1,<27.0.0)
20
+ Requires-Dist: docker (>=7.1.0,<8.0.0)
20
21
  Requires-Dist: dunamai (>=1.25.0,<2.0.0)
21
22
  Requires-Dist: flake8 (>=7.3.0,<8.0.0)
22
23
  Requires-Dist: git-cliff (>=2.12.0,<3.0.0)
23
24
  Requires-Dist: isort (>=8.0.1,<9.0.0)
24
25
  Requires-Dist: jinja2 (>=3.1.6,<4.0.0)
26
+ Requires-Dist: packaging (>=26.2,<27.0)
25
27
  Requires-Dist: poethepoet-tasks (>=0.3.0,<0.4.0)
26
28
  Requires-Dist: pytest (>=9.0.3,<10.0.0)
27
29
  Requires-Dist: pytest-cov (>=7.0.0,<8.0.0)
30
+ Requires-Dist: requests (>=2.34.2,<3.0.0)
28
31
  Requires-Dist: tomlkit (>=0.13.3,<0.14.0)
29
32
  Project-URL: Homepage, http://github.com/ci-sourcerer/common-python-tasks
30
33
  Project-URL: Issues, http://github.com/ci-sourcerer/common-python-tasks/issues
@@ -35,7 +38,7 @@ Description-Content-Type: text/markdown
35
38
 
36
39
  This package is a collection of (very) opinionated [Poe the Poet](https://poethepoet.natn.io/guides/packaged_tasks.html) Python tasks for common Python development workflows.
37
40
 
38
- Instead of writing your own tasks for formatting, linting, testing, packaging, and more, you can use these pre-built tasks that work out of the box with reasonable defaults and support configuration overrides when needed. In the past, I found myself copying and pasting the same task definitions across projects, and this package is my attempt to DRY up that workflow and provide a single source of truth for common Python development tasks. I hope you can use them too.
41
+ Instead of writing your own tasks for formatting, linting, testing, packaging, and more, you can use these prebuilt tasks that work immediately with reasonable defaults and support configuration overrides when needed. In the past, I found myself copying and pasting the same task definitions across projects, and this package is my attempt to DRY up that workflow and provide a single source of truth for common Python development tasks. I hope you can use them too.
39
42
 
40
43
  ## Quick start
41
44
 
@@ -50,7 +53,7 @@ curl -sSL https://api.github.com/repos/ci-sourcerer/common-python-tasks/contents
50
53
  To install a specific release, set the environment variable `COMMON_PYTHON_TASKS_VERSION`.
51
54
 
52
55
  ```shell
53
- COMMON_PYTHON_TASKS_VERSION=0.3.1 \
56
+ COMMON_PYTHON_TASKS_VERSION=0.4.0 \
54
57
  sh -c "$(curl -sSL https://api.github.com/repos/ci-sourcerer/common-python-tasks/contents/scripts/add-common-python-tasks.sh | jq -r '.content' | base64 -d)"
55
58
  ```
56
59
 
@@ -70,10 +73,8 @@ There's no real reason to run the automated script; I just like automating every
70
73
 
71
74
  ```toml
72
75
  [project]
73
- name = "my-awesome-project"
74
- version = "0.3.1"
75
76
  dependencies = [
76
- "common-python-tasks==0.3.1", # Always pin to a specific version
77
+ "common-python-tasks==0.4.0" # Always pin to a specific version
77
78
  ]
78
79
 
79
80
  [tool.poe]
@@ -106,6 +107,7 @@ Internal tasks are used by other tasks and are not meant to be run directly.
106
107
  | `format` | Format Python code with autoflake, black, and isort. | common, format |
107
108
  | `lint` | Lint Python code with autoflake, black, isort, and flake8. | common, lint |
108
109
  | `build-image` | Build the container image for this project using the Dockerfile template. | build, containers |
110
+ | `build-deps-image` | Build only the container dependency collector image for this project. | build, containers |
109
111
  | `run-container` | Run the Docker image as a container for this project. By default (when `tag` is `None`) this will run the most-recently-built tag for the project's image. | containers |
110
112
  | `push-image` | Push the Docker image for this project to the container registry. | containers, packaging, release |
111
113
  | `publish-package` | Publish the package to the PyPI server. | common, packaging |
@@ -133,7 +135,7 @@ Some tasks of certain tags provide Docker Compose-based development stacks for r
133
135
 
134
136
  Specifies the type of application stack. Currently supported:
135
137
 
136
- - `fastapi` - FastAPI application with optional database, Alembic migrations
138
+ - `fastapi`: FastAPI application with optional database support and Alembic migrations
137
139
 
138
140
  Set via environment variable:
139
141
 
@@ -146,7 +148,7 @@ COMPOSE_TYPE = "fastapi"
146
148
 
147
149
  Colon-separated list of additional services to include. Available addons:
148
150
 
149
- - `db` - PostgreSQL database with Alembic migration support and Adminer web UI
151
+ - `db`: PostgreSQL database with Alembic migration support and Adminer web UI
150
152
 
151
153
  Example:
152
154
 
@@ -161,13 +163,13 @@ For multiple addons (future): `COMPOSE_ADDONS = "db:redis:cache"`
161
163
 
162
164
  The compose setup follows this precedence.
163
165
 
164
- 1. **Environment override** - `COMPOSE_FILE` environment variable with colon-separated paths
165
- 2. **Auto-loaded files** - Based on `COMPOSE_TYPE` and `COMPOSE_ADDONS`:
166
- - `compose-base.yml` - Core application service
167
- - `compose-{addon}.yml` - For each addon (e.g., `compose-db.yml`)
168
- - `compose-debug.yml` - When `--debug` flag is used
169
- - `compose-{addon}-debug.yml` - Debug overlays for addons
170
- 3. **Additional overlays** - `COMPOSE_OVERLAY_FILES` with colon-separated paths
166
+ 1. **Environment override**: `COMPOSE_FILE` environment variable with colon separated paths
167
+ 2. **Automatically loaded files**: Based on `COMPOSE_TYPE` and `COMPOSE_ADDONS`
168
+ - `compose-base.yml`: Core application service
169
+ - `compose-{addon}.yml`: One file for each addon; for example, `compose-db.yml`
170
+ - `compose-debug.yml`: Used when the `--debug` flag is present
171
+ - `compose-{addon}-debug.yml`: Debug overlays for addons
172
+ 3. **Additional overlays**: `COMPOSE_OVERLAY_FILES` with colon separated paths
171
173
 
172
174
  You can provide local compose files or let the tasks use bundled templates.
173
175
 
@@ -177,16 +179,16 @@ The `fastapi` stack includes a service for your FastAPI application. It uses the
177
179
 
178
180
  #### Environment variables
179
181
 
180
- - `API_PORT` - Port for the API server (default: `8080`)
181
- - `SECRET_KEY` - Application secret key (auto-generated and stored in `.env` if not set)
182
- - `ENVIRONMENT` - Environment name like `development` or `production` (default: `production`)
183
- - `DEBUG_PORT` - Port for the Python debugger when using `--debug` (default: `5678`)
184
- - `DB_PORT` - PostgreSQL port (default: `5432`)
185
- - `DB_USER` - Database user (default: package name)
186
- - `DB_BASE` - Database name (default: package name)
187
- - `DB_PASS` - Database password (auto-generated and stored in `.env` if not set)
188
- - `POSTGRES_VERSION` - PostgreSQL Docker image version (default: `17`)
189
- - `ADMINER_PORT` - Adminer web UI port (default: `8081`)
182
+ - `API_PORT`: Port for the API server (default: `8080`)
183
+ - `SECRET_KEY`: Application secret key; generated automatically and stored in `.env` if not set
184
+ - `ENVIRONMENT`: Environment name such as `development` or `production` (default: `production`)
185
+ - `DEBUG_PORT`: Port for the Python debugger when using `--debug` (default: `5678`)
186
+ - `DB_PORT`: PostgreSQL port (default: `5432`)
187
+ - `DB_USER`: Database user (default: package name)
188
+ - `DB_BASE`: Database name (default: package name)
189
+ - `DB_PASS`: Database password; generated automatically and stored in `.env` if not set
190
+ - `POSTGRES_VERSION`: PostgreSQL Docker image version (default: `17`)
191
+ - `ADMINER_PORT`: Adminer web UI port (default: `8081`)
190
192
 
191
193
  ## How it works
192
194
 
@@ -202,10 +204,10 @@ Your project must meet the following requirements.
202
204
 
203
205
  Tasks that need configuration files (`pytest`, `coverage`, `flake8`, `isort`) follow this order of precedence.
204
206
 
205
- 1. **`pyproject.toml` sections** - `[tool.pytest]`, `[tool.coverage]`, `[tool.isort]` take priority
206
- 2. **Environment variables** - Override config paths (see [Environment Variables](#environment-variables))
207
- 3. **Local config files** - `pytest.ini`, `.coveragerc`, `.flake8`, `.isort.cfg` in project root
208
- 4. **Bundled defaults** - Sensible defaults included with this package, found in the [`src/common_python_tasks/data`](src/common_python_tasks/data) directory
207
+ 1. **`pyproject.toml` sections**: `[tool.pytest]`, `[tool.coverage]`, `[tool.isort]` take priority
208
+ 2. **Environment variables**: Override config paths; see [Environment Variables](#environment-variables)
209
+ 3. **Local config files**: `pytest.ini`, `.coveragerc`, `.flake8`, `.isort.cfg` in the project root
210
+ 4. **Bundled defaults**: Sensible defaults included with this package, found in the [`src/common_python_tasks/data`](src/common_python_tasks/data) directory
209
211
 
210
212
  You can start with zero configuration and customize as needed.
211
213
 
@@ -215,68 +217,68 @@ You can start with zero configuration and customize as needed.
215
217
 
216
218
  The following environment variables configure the paths to configuration files.
217
219
 
218
- - `PYTEST_CONFIG` specifies the path to the pytest configuration file
219
- - `COVERAGE_RCFILE` specifies the path to the coverage configuration file
220
- - `FLAKE8_CONFIG` specifies the path to the flake8 configuration file
221
- - `ISORT_CONFIG` specifies the path to the isort configuration file
220
+ - `PYTEST_CONFIG`: Specifies the path to the pytest configuration file
221
+ - `COVERAGE_RCFILE`: Specifies the path to the coverage configuration file
222
+ - `FLAKE8_CONFIG`: Specifies the path to the flake8 configuration file
223
+ - `ISORT_CONFIG`: Specifies the path to the isort configuration file
222
224
 
223
225
  #### Package/Container settings
224
226
 
225
227
  The following environment variables configure package and container behavior.
226
228
 
227
- - `PACKAGE_NAME` overrides the package name (default is from `pyproject.toml`)
228
- - `POETRY_VERSION` overrides the Poetry version for container builds
229
- - `DOCKERHUB_USERNAME` specifies the Docker Hub username for image tagging (default is current local user)
230
- - `CONTAINER_REGISTRY_URL` specifies the registry URL (default is `docker.io/{username}`)
231
- - `CONTAINER_BUILD_ARGS` provides additional Docker build arguments in `KEY=VALUE:OTHER=VALUE` format
232
- - `CONTAINER_EXTENSION_FILES` specifies colon-delimited local extension Dockerfile paths to include in the rendered build.
233
- - `CONTAINER_EXTENSIONS` specifies colon-delimited extension bundle names or parameterized bundle values to include in the rendered build.
234
- - `CONTAINER_ENV` provides colon-delimited `KEY=VALUE` declarations to inject into the builder stage of the rendered Dockerfile.
235
- - `.containerenv` can also supply the same declarations from a file in the project root. It is the fallback source when neither `container_envfile` nor `CONTAINER_ENV` is provided.
236
- - `CONTAINER_PRUNE_KEEP` controls image pruning after builds (`-1` keep all, `0` keep latest only, `N` keep latest + `N` previous)
237
- - `CUSTOM_IMAGE_ENTRYPOINT` specifies a custom entrypoint script name for containers
238
- - `CONTAINER_DEPS_CONTENT` supplies inline Dockerfile instructions for a dependency image that installs artifacts into `/tmp/deps`
239
- - `CONTAINER_DEPS_FILE` points to one or more explicit Dockerfiles to build the dependency image. It may be a colon-delimited list of file paths and is used only when `CONTAINER_DEPS_CONTENT` is unset.
240
- - `CONTAINER_DEPS_MAPPINGS` maps copied dependency names from `/tmp/deps` into destination paths, as whitespace-separated `name:/target/path` entries. This is only used when `CONTAINER_DEPS_MOVE_SCRIPT` or `CONTAINER_DEPS_MOVE_SCRIPT_PATH` is not set.
241
- - `CONTAINER_DEPS_MOVE_SCRIPT` supplies a raw executable script to run after `/tmp/deps` is copied into the image. The script is written to `/tmp/container-deps-move-script` and executed with its own shebang.
242
- - `CONTAINER_DEPS_MOVE_SCRIPT_PATH` supplies a host path to a script file to run after `/tmp/deps` is copied into the image. This path takes precedence over `CONTAINER_DEPS_MOVE_SCRIPT` when both are set.
243
- - `GITHUB_RELEASE_ASSETS` colon-separated list of file paths or glob patterns to attach to the GitHub Release (default: `dist/*`)
244
- - `SKIP_GITHUB_RELEASE` truthy value to skip GitHub Release publication.
245
- - `GITHUB_TOKEN` or `GH_TOKEN` GitHub authentication token used to publish releases and upload assets.
246
- - `GITHUB_REPOSITORY` optional override for the repository slug used when publishing a GitHub Release.
247
- - `GITHUB_API_URL` and `GITHUB_SERVER_URL` configure the GitHub API host for GitHub Enterprise environments.
248
- - `GITHUB_RELEASE_TAG` optional tag name to publish for the GitHub Release.
249
- - `GITHUB_RELEASE_NAME` optional release title to use for the GitHub Release.
250
- - `GITHUB_RELEASE_BODY` optional release body text to use for the GitHub Release.
251
- - `RELEASE_UPDATE_CHANGELOG` truthy value to update `CHANGELOG.md` by prepending the `git-cliff --unreleased --tag "$RELEASE_TAG"` output before the release tag is created. This is enabled by default; set it to a falsy value to disable changelog commits during release.
252
- - `RELEASE_PRE_SCRIPT` optional shell command to run before the release steps.
253
- - `RELEASE_POST_SCRIPT` optional shell command to run after the release completes.
254
- - Hook commands receive the following env vars: `RELEASE_SCRIPT_PHASE`, `RELEASE_TAG`, `RELEASE_VERSION`, `RELEASE_STAGE`, `RELEASE_COMPONENT`, and `RELEASE_DRY_RUN`.
229
+ - `PACKAGE_NAME`: Overrides the package name; the default comes from `pyproject.toml`
230
+ - `POETRY_VERSION`: Overrides the Poetry version for container builds
231
+ - `CONTAINER_REGISTRY_USERNAME`: Specifies the container registry username for image tagging; the default is the current local user
232
+ - `CONTAINER_REGISTRY_URL`: Specifies the registry URL (default: `docker.io/{username}`)
233
+ - `CONTAINER_BUILD_ARGS`: Provides additional Docker build arguments in `KEY=VALUE:OTHER=VALUE` format
234
+ - `CONTAINER_EXTENSION_FILES`: Specifies colon delimited local extension Dockerfile paths to include in the rendered build
235
+ - `CONTAINER_EXTENSIONS`: Specifies colon delimited extension bundle names or parameterized bundle values to include in the rendered build
236
+ - `CONTAINER_ENV`: Provides colon delimited `KEY=VALUE` declarations to inject into the builder stage of the rendered Dockerfile
237
+ - `.containerenv`: Can also supply the same declarations from a file in the project root. It is loaded first, then `container_envfile`, then `CONTAINER_ENV`, and finally `container_env`.
238
+ - `CONTAINER_PRUNE_KEEP`: Controls image pruning after builds (`-1` keeps all, `0` keeps the latest only, `N` keeps the latest plus `N` previous)
239
+ - `CUSTOM_ENTRYPOINT`: Specifies a custom entrypoint script name for containers
240
+ - `CONTAINER_DEPS_CONTENT`: Supplies inline Dockerfile instructions for a dependency image that installs artifacts into `/tmp/deps`
241
+ - `CONTAINER_DEPS_FILE`: Points to one or more explicit Dockerfiles to build the dependency image. It may be a colon delimited list of file paths and is used only when `CONTAINER_DEPS_CONTENT` is unset
242
+ - `CONTAINER_DEPS_MAPPINGS`: Maps copied dependency names from `/tmp/deps` into destination paths as space separated `name:/target/path` entries. This is used only when `CONTAINER_DEPS_MOVE_SCRIPT` or `CONTAINER_DEPS_MOVE_SCRIPT_PATH` is not set
243
+ - `CONTAINER_DEPS_MOVE_SCRIPT`: Supplies a raw executable script to run after `/tmp/deps` is copied into the image. The script is written to `/tmp/container-deps-move-script` and executed with its own shebang
244
+ - `CONTAINER_DEPS_MOVE_SCRIPT_PATH`: Supplies a host path to a script file to run after `/tmp/deps` is copied into the image. This path takes precedence over `CONTAINER_DEPS_MOVE_SCRIPT` when both are set
245
+ - `GITHUB_RELEASE_ASSETS`: Colon separated list of file paths or glob patterns to attach to the GitHub Release (default: `dist/*`)
246
+ - `SKIP_GITHUB_RELEASE`: Truthy value to skip GitHub Release publication
247
+ - `GITHUB_TOKEN` or `GH_TOKEN`: GitHub authentication token used to publish releases and upload assets
248
+ - `GITHUB_REPOSITORY`: Optional override for the repository slug used when publishing a GitHub Release
249
+ - `GITHUB_API_URL` and `GITHUB_SERVER_URL`: Configure the GitHub API host for GitHub Enterprise environments
250
+ - `GITHUB_RELEASE_TAG`: Optional tag name to publish for the GitHub Release
251
+ - `GITHUB_RELEASE_NAME`: Optional release title to use for the GitHub Release
252
+ - `GITHUB_RELEASE_BODY`: Optional release body text to use for the GitHub Release
253
+ - `RELEASE_UPDATE_CHANGELOG`: Truthy value to update `CHANGELOG.md` by prepending the `git-cliff --unreleased --tag "$RELEASE_TAG"` output before the release tag is created. This is enabled by default; set it to a falsy value if you want to disable changelog commits during release
254
+ - `RELEASE_PRE_SCRIPT`: Optional shell command to run before the release steps
255
+ - `RELEASE_POST_SCRIPT`: Optional shell command to run after the release completes
256
+ - Hook commands: Receive the following env vars; `RELEASE_SCRIPT_PHASE`, `RELEASE_TAG`, `RELEASE_VERSION`, `RELEASE_STAGE`, `RELEASE_COMPONENT`, and `RELEASE_DRY_RUN`
255
257
 
256
258
  #### Docker Compose settings
257
259
 
258
260
  The following environment variables configure Docker Compose stacks (when using the `web` tag).
259
261
 
260
- - `COMPOSE_TYPE` specifies the type of application stack (e.g., `fastapi`)
261
- - `COMPOSE_ADDONS` colon-separated list of services to include (e.g., `db` for database)
262
- - `COMPOSE_FILE` overrides all compose files with colon-separated paths
263
- - `COMPOSE_OVERLAY_FILES` additional compose files to merge (colon-separated paths)
264
- - `API_PORT` port for the API server (default: `8080`)
265
- - `SECRET_KEY` application secret key (auto-generated if not set)
266
- - `ENVIRONMENT` environment name (default: `production`)
267
- - `DEBUG_PORT` port for Python debugger in debug mode (default: `5678`)
268
- - `DB_PORT` PostgreSQL port (default: `5432`)
269
- - `DB_USER` database user (default: package name)
270
- - `DB_BASE` database name (default: package name)
271
- - `DB_PASS` database password (auto-generated if not set)
272
- - `POSTGRES_VERSION` PostgreSQL version (default: `17`)
273
- - `ADMINER_PORT` Adminer web UI port (default: `8081`)
262
+ - `COMPOSE_TYPE`: Specifies the type of application stack; for example, `fastapi`
263
+ - `COMPOSE_ADDONS`: Colon separated list of services to include; for example, `db` for database support
264
+ - `COMPOSE_FILE`: Overrides all compose files with colon separated paths
265
+ - `COMPOSE_OVERLAY_FILES`: Additional compose files to merge; uses colon separated paths
266
+ - `API_PORT`: Port for the API server (default: `8080`)
267
+ - `SECRET_KEY`: Application secret key; generated automatically if not set
268
+ - `ENVIRONMENT`: Environment name (default: `production`)
269
+ - `DEBUG_PORT`: Port for the Python debugger in debug mode (default: `5678`)
270
+ - `DB_PORT`: PostgreSQL port (default: `5432`)
271
+ - `DB_USER`: Database user (default: package name)
272
+ - `DB_BASE`: Database name (default: package name)
273
+ - `DB_PASS`: Database password; generated automatically if not set
274
+ - `POSTGRES_VERSION`: PostgreSQL version (default: `17`)
275
+ - `ADMINER_PORT`: Adminer web UI port (default: `8081`)
274
276
 
275
277
  #### Debugging
276
278
 
277
279
  The following environment variable enables debugging output.
278
280
 
279
- - `COMMON_PYTHON_TASKS_LOG_LEVEL` should be set to `DEBUG` to see detailed configuration resolution
281
+ - `COMMON_PYTHON_TASKS_LOG_LEVEL`: Set this to `DEBUG` to see detailed configuration resolution
280
282
 
281
283
  ### Usage examples
282
284
 
@@ -287,8 +289,8 @@ By default, `tasks()` exposes the common task set. You can still include or excl
287
289
  ```toml
288
290
  [project]
289
291
  name = "simple-cli-tool"
290
- version = "0.3.1"
291
- dependencies = ["common-python-tasks==0.3.1"]
292
+ version = "0.4.0"
293
+ dependencies = ["common-python-tasks==0.4.0"]
292
294
 
293
295
  [tool.poe]
294
296
  include_script = "common_python_tasks:tasks()"
@@ -300,15 +302,13 @@ Available tasks: common defaults such as `format`, `lint`, `test`, and `build`.
300
302
 
301
303
  ```toml
302
304
  [project]
303
- name = "containerized-app"
304
- version = "0.3.1"
305
- dependencies = ["common-python-tasks==0.3.1"]
305
+ dependencies = ["common-python-tasks==0.4.0"]
306
306
 
307
307
  [tool.poe]
308
308
  include_script = "common_python_tasks:tasks(include_tags=['common', 'containers'])"
309
309
 
310
310
  [tool.poe.env]
311
- DOCKERHUB_USERNAME = "myusername"
311
+ CONTAINER_REGISTRY_USERNAME = "myusername"
312
312
  PACKAGE_NAME = "containerized-app"
313
313
  ```
314
314
 
@@ -318,9 +318,7 @@ Available tasks: All tasks including `build-image` and `push-image`.
318
318
 
319
319
  ```toml
320
320
  [project]
321
- name = "custom-test-setup"
322
- dependencies = ["common-python-tasks==0.3.1"]
323
- dynamic = ["version"]
321
+ dependencies = ["common-python-tasks==0.4.0"]
324
322
 
325
323
  [tool.poe]
326
324
  include_script = "common_python_tasks:tasks()"
@@ -348,13 +346,6 @@ include_script = "common_python_tasks:tasks(exclude_tags=['internal'])"
348
346
  includes = "common_python_tasks:tasks"
349
347
  ```
350
348
 
351
- ### Version bump fails with "no changes since last tag"
352
-
353
- This is expected behavior. The `bump-version` task requires commits between the last tag and HEAD. You can resolve this in one of the following ways.
354
-
355
- - Make changes and commit them first
356
- - Delete the old tag (for example, `git tag -d v0.0.1`). This is not recommended. Versions should be immutable, and if you need to fix something, you should create a new patch version instead. Rarely do you want to pass off new code as an old version
357
-
358
349
  ### Config files not being used
359
350
 
360
351
  Check the configuration precedence (see [How it works](#how-it-works)). Use debug logging to see which config is selected.
@@ -385,7 +376,7 @@ If `stack-up` builds successfully but services can't connect:
385
376
  - Check that required environment variables are set (`COMPOSE_TYPE` at minimum)
386
377
  - Verify ports aren't already in use (defaults: 8080 for API, 5432 for database, 8081 for Adminer)
387
378
  - Check Docker daemon is running: `docker info`
388
- - View service logs: `docker-compose logs` in your project directory
379
+ - View service logs: `docker compose logs` in your project directory
389
380
 
390
381
  ### Database migrations fail
391
382
 
@@ -406,21 +397,21 @@ If `SECRET_KEY` or `DB_PASS` aren't auto-generated:
406
397
 
407
398
  ## Design choices
408
399
 
409
- ### Dockerfile (see [src/common_python_tasks/data/Dockerfile](src/common_python_tasks/data/Dockerfile))
400
+ ### Dockerfile (see [`src/common_python_tasks/data/generic/Dockerfile.j2`](src/common_python_tasks/data/generic/Dockerfile.j2))
410
401
 
411
402
  The standard Python Dockerfile incorporates several intentional design choices.
412
403
 
413
404
  - Multi-stage build: The build stage installs Poetry and builds a wheel while the runtime stage installs only the wheel to keep the final image slim and reproducible
414
- - Pip and Poetry cache mounts speed up iterative builds without bloating the final image
415
- - Explicit inputs through build args (`PYTHON_VERSION`, `POETRY_VERSION`, `PACKAGE_NAME`, `AUTHORS`, `GIT_COMMIT`, `CUSTOM_ENTRYPOINT`) make image metadata and behavior predictable and auditable
416
- - Optional debug stage exports and installs the `debug` dependency group only when present without failing otherwise and is not part of the default final image
417
- - Stable package path creates symlinks to the installed package so entrypoints and consumers have a consistent `/pkg` and `/_$PACKAGE_NAME` path regardless of wheel layout, which ensures that the package can be reliably imported and executed from a known location, and allows for the less common use case of reading files directly from the package path
418
- - Safe entrypoint selection means the default entrypoint resolves the console script matching the package name while `CUSTOM_ENTRYPOINT` allows overriding at build time while keeping runtime behavior predictable
419
- - Minimal final image uses the slim Python base by default, cleans wheel artifacts and caches, and sets `runtime` as the explicit final target so the debug stage is opt-in
405
+ - Pip and Poetry cache mounts: Speed up iterative builds without bloating the final image
406
+ - Explicit inputs through build args: `PYTHON_VERSION`, `POETRY_VERSION`, `PACKAGE_NAME`, `AUTHORS`, `GIT_COMMIT`, and `CUSTOM_ENTRYPOINT` make image metadata and behavior predictable and auditable
407
+ - Optional debug stage: Exports and installs the `debug` dependency group only when present, without failing otherwise, and is not part of the default final image
408
+ - Stable package path: Creates symlinks to the installed package so entrypoints and consumers have a consistent `/pkg` and `/_$PACKAGE_NAME` path regardless of wheel layout. This ensures that the package can be imported and executed from a known location and supports the less common case of reading files directly from the package path
409
+ - Safe entrypoint selection: The default entrypoint resolves the console script matching the package name, while `CUSTOM_ENTRYPOINT` allows an override at build time and keeps runtime behavior predictable
410
+ - Minimal final image: Uses the slim Python base by default, cleans wheel artifacts and caches, and sets `runtime` as the explicit final target so the debug stage remains optional
420
411
 
421
412
  ## Notes
422
413
 
423
- - This project dogfoods itself - it uses `common-python-tasks` for its own development. **That said, you must set the environment variable `PYTHONPATH=src` when running tasks locally to ensure you are using the local version of the package instead of the installed version**
414
+ - This project dogfoods itself; it uses `common-python-tasks` for its own development. **That said, you must set the environment variable `PYTHONPATH=src` when running tasks locally to ensure you are using the local version of the package instead of the installed version**
424
415
  - `RELEASE_UPDATE_CHANGELOG` is enabled by default for releases and prepends a tagged section into `CHANGELOG.md` before the release tag is created. Set it to a falsy value if you prefer to manage changelog commits yourself.
425
416
  - `RELEASE_PRE_SCRIPT` and `RELEASE_POST_SCRIPT` hooks may not be necessary for most users, as this package promotes the use of `poetry-dynamic-versioning` and `git-cliff` to automate versioning and changelog generation based on git history. One advanced use case for the `RELEASE_PRE_SCRIPT` hook is to edit another file before release, such as a README that references the current stable version number. This allows you to keep the README up to date with the latest version without hardcoding it.
426
417
  - Contributions welcome! Open an issue/discussion to discuss changes before submitting a PR. I do not claim to have all the answers, and you can help determine the future of low-code solutions for Python. I am very interested in your feedback as I don't want to work in a vacuum