common-python-tasks 0.0.2__tar.gz → 0.1.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 (38) hide show
  1. {common_python_tasks-0.0.2 → common_python_tasks-0.1.0}/LICENSE +1 -1
  2. common_python_tasks-0.1.0/PKG-INFO +428 -0
  3. common_python_tasks-0.1.0/README.md +394 -0
  4. {common_python_tasks-0.0.2 → common_python_tasks-0.1.0}/pyproject.toml +12 -5
  5. common_python_tasks-0.1.0/src/common_python_tasks/__init__.py +27 -0
  6. common_python_tasks-0.1.0/src/common_python_tasks/__main__.py +108 -0
  7. common_python_tasks-0.1.0/src/common_python_tasks/compose.py +625 -0
  8. common_python_tasks-0.1.0/src/common_python_tasks/data/dockerfile_extensions/.gitkeep +0 -0
  9. common_python_tasks-0.1.0/src/common_python_tasks/data/fastapi/alembic.ini.j2 +52 -0
  10. common_python_tasks-0.1.0/src/common_python_tasks/data/fastapi/compose-base.yml.j2 +40 -0
  11. common_python_tasks-0.1.0/src/common_python_tasks/data/fastapi/compose-db-debug.yml.j2 +45 -0
  12. common_python_tasks-0.1.0/src/common_python_tasks/data/fastapi/compose-db.yml.j2 +80 -0
  13. common_python_tasks-0.1.0/src/common_python_tasks/data/fastapi/compose-debug.yml.j2 +30 -0
  14. common_python_tasks-0.1.0/src/common_python_tasks/data/generic/.pytest_cache/v/cache/lastfailed +4 -0
  15. common_python_tasks-0.1.0/src/common_python_tasks/data/generic/.pytest_cache/v/cache/nodeids +310 -0
  16. common_python_tasks-0.1.0/src/common_python_tasks/data/generic/Dockerfile.deps.j2 +17 -0
  17. common_python_tasks-0.1.0/src/common_python_tasks/data/generic/Dockerfile.j2 +145 -0
  18. common_python_tasks-0.1.0/src/common_python_tasks/docker.py +454 -0
  19. common_python_tasks-0.1.0/src/common_python_tasks/env.py +406 -0
  20. common_python_tasks-0.1.0/src/common_python_tasks/git.py +307 -0
  21. common_python_tasks-0.1.0/src/common_python_tasks/github.py +540 -0
  22. common_python_tasks-0.1.0/src/common_python_tasks/project.py +298 -0
  23. common_python_tasks-0.1.0/src/common_python_tasks/tasks.py +1492 -0
  24. common_python_tasks-0.1.0/src/common_python_tasks/utils.py +349 -0
  25. common_python_tasks-0.0.2/PKG-INFO +0 -295
  26. common_python_tasks-0.0.2/README.md +0 -262
  27. common_python_tasks-0.0.2/src/common_python_tasks/__init__.py +0 -18
  28. common_python_tasks-0.0.2/src/common_python_tasks/data/.pytest_cache/v/cache/nodeids +0 -47
  29. common_python_tasks-0.0.2/src/common_python_tasks/data/Containerfile +0 -76
  30. common_python_tasks-0.0.2/src/common_python_tasks/tasks.py +0 -849
  31. {common_python_tasks-0.0.2/src/common_python_tasks/data → common_python_tasks-0.1.0/src/common_python_tasks/data/generic}/.coveragerc +0 -0
  32. {common_python_tasks-0.0.2/src/common_python_tasks/data → common_python_tasks-0.1.0/src/common_python_tasks/data/generic}/.dockerignore +0 -0
  33. {common_python_tasks-0.0.2/src/common_python_tasks/data → common_python_tasks-0.1.0/src/common_python_tasks/data/generic}/.flake8 +0 -0
  34. {common_python_tasks-0.0.2/src/common_python_tasks/data → common_python_tasks-0.1.0/src/common_python_tasks/data/generic}/.isort.cfg +0 -0
  35. {common_python_tasks-0.0.2/src/common_python_tasks/data → common_python_tasks-0.1.0/src/common_python_tasks/data/generic}/.pytest_cache/.gitignore +0 -0
  36. {common_python_tasks-0.0.2/src/common_python_tasks/data → common_python_tasks-0.1.0/src/common_python_tasks/data/generic}/.pytest_cache/CACHEDIR.TAG +0 -0
  37. {common_python_tasks-0.0.2/src/common_python_tasks/data → common_python_tasks-0.1.0/src/common_python_tasks/data/generic}/.pytest_cache/README.md +0 -0
  38. {common_python_tasks-0.0.2/src/common_python_tasks/data → common_python_tasks-0.1.0/src/common_python_tasks/data/generic}/pytest.ini +0 -0
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025 Joseph Asbury
3
+ Copyright (c) 2026 Joseph Asbury
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -0,0 +1,428 @@
1
+ Metadata-Version: 2.4
2
+ Name: common-python-tasks
3
+ Version: 0.1.0
4
+ Summary: Opinionated Poe the Poet tasks for Python package development.
5
+ License-Expression: MIT
6
+ License-File: LICENSE
7
+ Author: Joseph Asbury
8
+ Author-email: ci_sourcerer@yahoo.com
9
+ Requires-Python: >=3.11,<4.0
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Programming Language :: Python :: 3.14
17
+ Classifier: Topic :: Software Development :: Build Tools
18
+ Requires-Dist: autoflake (>=2.3.1,<3.0.0)
19
+ Requires-Dist: black (>=26.3.1,<27.0.0)
20
+ Requires-Dist: dunamai (>=1.25.0,<2.0.0)
21
+ Requires-Dist: flake8 (>=7.3.0,<8.0.0)
22
+ Requires-Dist: git-cliff (>=2.12.0,<3.0.0)
23
+ Requires-Dist: isort (>=8.0.1,<9.0.0)
24
+ Requires-Dist: jinja2 (>=3.1.6,<4.0.0)
25
+ Requires-Dist: poethepoet-tasks (>=0.3.0,<0.4.0)
26
+ Requires-Dist: pytest (>=9.0.1,<10.0.0)
27
+ Requires-Dist: pytest-cov (>=7.0.0,<8.0.0)
28
+ Requires-Dist: tomlkit (>=0.13.3,<0.14.0)
29
+ Project-URL: Homepage, http://github.com/ci-sourcerer/common-python-tasks
30
+ Project-URL: Issues, http://github.com/ci-sourcerer/common-python-tasks/issues
31
+ Project-URL: Source, http://github.com/ci-sourcerer/common-python-tasks.git
32
+ Description-Content-Type: text/markdown
33
+
34
+ # Common Python Tasks
35
+
36
+ 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
+
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.
39
+
40
+ ## Quick start
41
+
42
+ ### Automated setup
43
+
44
+ You can add `common-python-tasks` to a new project by using the handy automated installation script.
45
+
46
+ ```shell
47
+ curl -sSL https://api.github.com/repos/ci-sourcerer/common-python-tasks/contents/scripts/add-common-python-tasks.sh | jq -r '.content' | base64 -d | sh
48
+ ```
49
+
50
+ To install a specific release, set the environment variable `COMMON_PYTHON_TASKS_VERSION`.
51
+
52
+ ```shell
53
+ COMMON_PYTHON_TASKS_VERSION=0.1.0 \
54
+ 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
+ ```
56
+
57
+ This will complete the following steps.
58
+
59
+ 1. Add the latest version of `common-python-tasks` to your `pyproject.toml` dependencies
60
+ 2. Configure Poe the Poet to expose the default common task set
61
+ 3. Install the package using Poetry
62
+
63
+ **Always review scripts before running them!** Even though I believe I write good software, it's best practice to verify any script you download from the Internet.
64
+
65
+ ### Manual setup
66
+
67
+ There's no real reason to run the automated script; I just like automating everything. You can achieve the same result by following these steps.
68
+
69
+ 1. Add `common-python-tasks` to your `pyproject.toml` and configure Poe the Poet
70
+
71
+ ```toml
72
+ [project]
73
+ name = "my-awesome-project"
74
+ version = "0.1.0"
75
+ dependencies = [
76
+ "common-python-tasks==0.1.0", # Always pin to a specific version
77
+ ]
78
+
79
+ [tool.poe]
80
+ include_script = "common_python_tasks:tasks()" # Uses the default `common` task set
81
+ ```
82
+
83
+ 2. Install the package
84
+
85
+ ```shell
86
+ poetry install
87
+ ```
88
+
89
+ 3. Run tasks
90
+
91
+ ```shell
92
+ poe format # Format your code
93
+ poe lint # Check code quality
94
+ poe test # Run tests with coverage
95
+ ```
96
+
97
+ ## Available tasks
98
+
99
+ Internal tasks are used by other tasks and are not meant to be run directly.
100
+
101
+ <!-- tasks-table -->
102
+ | Task | Description | Tags |
103
+ | - | - | - |
104
+ | `test` | Run the test suite with coverage (if `pytest-cov` is installed). | common, test |
105
+ | `clean` | Clean up temporary files and directories. | clean, common |
106
+ | `format` | Format Python code with autoflake, black, and isort. | common, format |
107
+ | `lint` | Lint Python code with autoflake, black, isort, and flake8. | common, lint |
108
+ | `build-image` | Build the container image for this project using the Dockerfile template. | build, containers |
109
+ | `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
+ | `push-image` | Push the Docker image for this project to the container registry. | containers, packaging, release |
111
+ | `publish-package` | Publish the package to the PyPI server. | common, packaging |
112
+ | `publish-github-release` | Publish or update a GitHub Release for the current repository. | common, packaging, release |
113
+ | `build-package` | Build the package (wheel and sdist). | build, common, packaging |
114
+ | `bump-version` | Bump the project version. | common, packaging |
115
+ | `changelog` | Print the changelog for the current version based on git history and git-cliff. | common, packaging, release |
116
+ | `release` | Run a full release flow for package and containers. | common, containers, packaging, release |
117
+ | `build` | Build the project and its containers. | common, containers, packaging |
118
+ | `stack-up` | Bring up the development stack for the application. | containers, fastapi, web |
119
+ | `stack-down` | Bring down the development stack for the application. | containers, fastapi, web |
120
+ | `reset-db` | Reset the database by deleting the database volume. | containers, database, fastapi, web |
121
+ | `run-db-migrations` | Run database migrations. | containers, database, fastapi, web |
122
+ | `db-shell` | Open a psql shell to the database container. | containers, database, fastapi, web |
123
+ | `container-shell` | Run the debug image with an interactive shell. | containers, debug |
124
+ <!-- end-tasks-table -->
125
+
126
+ ## Docker Compose Development Stacks
127
+
128
+ Some tasks of certain tags provide Docker Compose-based development stacks for running your application with supporting services (databases, caches, etc.). Currently supports FastAPI applications with PostgreSQL.
129
+
130
+ ### Configuration
131
+
132
+ #### `COMPOSE_TYPE`
133
+
134
+ Specifies the type of application stack. Currently supported:
135
+
136
+ - `fastapi` - FastAPI application with optional database, Alembic migrations
137
+
138
+ Set via environment variable:
139
+
140
+ ```toml
141
+ [tool.poe.env]
142
+ COMPOSE_TYPE = "fastapi"
143
+ ```
144
+
145
+ #### `COMPOSE_ADDONS`
146
+
147
+ Colon-separated list of additional services to include. Available addons:
148
+
149
+ - `db` - PostgreSQL database with Alembic migration support and Adminer web UI
150
+
151
+ Example:
152
+
153
+ ```toml
154
+ [tool.poe.env]
155
+ COMPOSE_ADDONS = "db"
156
+ ```
157
+
158
+ For multiple addons (future): `COMPOSE_ADDONS = "db:redis:cache"`
159
+
160
+ ### Compose File Customization
161
+
162
+ The compose setup follows this precedence.
163
+
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
171
+
172
+ You can provide local compose files or let the tasks use bundled templates.
173
+
174
+ ### `fastapi`
175
+
176
+ The `fastapi` stack includes a service for your FastAPI application. It uses the standard Dockerfile included with this package.
177
+
178
+ #### Environment variables
179
+
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`)
190
+
191
+ ## How it works
192
+
193
+ ### Prerequisites
194
+
195
+ Your project must meet the following requirements.
196
+
197
+ - Use Poetry for dependency management
198
+ - Have a `pyproject.toml` file at the root
199
+ - Have a package name (automatically inferred from `project.name` in `pyproject.toml` or set via `PACKAGE_NAME` environment variable)
200
+
201
+ ### Configuration precedence
202
+
203
+ Tasks that need configuration files (`pytest`, `coverage`, `flake8`, `isort`) follow this order of precedence.
204
+
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
209
+
210
+ You can start with zero configuration and customize as needed.
211
+
212
+ ### Environment variables
213
+
214
+ #### Configuration files
215
+
216
+ The following environment variables configure the paths to configuration files.
217
+
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
222
+
223
+ #### Package/Container settings
224
+
225
+ The following environment variables configure package and container behavior.
226
+
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` with `git-cliff --tag "$RELEASE_TAG" --prepend CHANGELOG.md` 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`.
255
+
256
+ #### Docker Compose settings
257
+
258
+ The following environment variables configure Docker Compose stacks (when using the `web` tag).
259
+
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`)
274
+
275
+ #### Debugging
276
+
277
+ The following environment variable enables debugging output.
278
+
279
+ - `COMMON_PYTHON_TASKS_LOG_LEVEL` should be set to `DEBUG` to see detailed configuration resolution
280
+
281
+ ### Usage examples
282
+
283
+ By default, `tasks()` exposes the common task set. You can still include or exclude tags in your `pyproject.toml` when needed.
284
+
285
+ #### Minimal setup
286
+
287
+ ```toml
288
+ [project]
289
+ name = "simple-cli-tool"
290
+ version = "0.1.0"
291
+ dependencies = ["common-python-tasks==0.1.0"]
292
+
293
+ [tool.poe]
294
+ include_script = "common_python_tasks:tasks()"
295
+ ```
296
+
297
+ Available tasks: common defaults such as `format`, `lint`, `test`, and `build`.
298
+
299
+ #### Container-based project
300
+
301
+ ```toml
302
+ [project]
303
+ name = "containerized-app"
304
+ version = "0.1.0"
305
+ dependencies = ["common-python-tasks==0.1.0"]
306
+
307
+ [tool.poe]
308
+ include_script = "common_python_tasks:tasks(include_tags=['common', 'containers'])"
309
+
310
+ [tool.poe.env]
311
+ DOCKERHUB_USERNAME = "myusername"
312
+ PACKAGE_NAME = "containerized-app"
313
+ ```
314
+
315
+ Available tasks: All tasks including `build-image` and `push-image`.
316
+
317
+ #### Custom pytest configuration
318
+
319
+ ```toml
320
+ [project]
321
+ name = "custom-test-setup"
322
+ dependencies = ["common-python-tasks==0.1.0"]
323
+ dynamic = ["version"]
324
+
325
+ [tool.poe]
326
+ include_script = "common_python_tasks:tasks()"
327
+
328
+ [tool.pytest.ini_options]
329
+ testpaths = ["tests", "integration"]
330
+ addopts = "-ra"
331
+ ```
332
+
333
+ The `test` task will automatically use your `[tool.pytest.ini_options]` configuration.
334
+
335
+ ## Troubleshooting
336
+
337
+ ### Tasks not showing up with `poe --help`
338
+
339
+ Check your `[tool.poe]` configuration in `pyproject.toml`. Make sure you're using `include_script`.
340
+
341
+ ```toml
342
+ # Correct
343
+ [tool.poe]
344
+ include_script = "common_python_tasks:tasks(exclude_tags=['internal'])"
345
+
346
+ # Incorrect
347
+ [tool.poe]
348
+ includes = "common_python_tasks:tasks"
349
+ ```
350
+
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
+ ### Config files not being used
359
+
360
+ Check the configuration precedence (see [How it works](#how-it-works)). Use debug logging to see which config is selected.
361
+
362
+ ### GitHub Release assets not uploading
363
+
364
+ If your release task does not attach assets, confirm `dist/` contains the built wheels and sdists. You can override the default asset selection using `GITHUB_RELEASE_ASSETS`, for example:
365
+
366
+ ```shell
367
+ GITHUB_RELEASE_ASSETS="dist/*.whl:dist/*.tar.gz" poe publish-github-release
368
+ ```
369
+
370
+ ```shell
371
+ COMMON_PYTHON_TASKS_LOG_LEVEL=DEBUG poe test
372
+ ```
373
+
374
+ ### Container build fails with "unable to find package"
375
+
376
+ Make sure your `pyproject.toml` contains the following.
377
+
378
+ - A correct package name in `[project]`
379
+ - A package location defined with this configuration: `[tool.poetry] packages = [{ include = "your_package", from = "src" }]`
380
+
381
+ ### Stack fails to start or services won't connect
382
+
383
+ If `stack-up` builds successfully but services can't connect:
384
+
385
+ - Check that required environment variables are set (`COMPOSE_TYPE` at minimum)
386
+ - Verify ports aren't already in use (defaults: 8080 for API, 5432 for database, 8081 for Adminer)
387
+ - Check Docker daemon is running: `docker info`
388
+ - View service logs: `docker-compose logs` in your project directory
389
+
390
+ ### Database migrations fail
391
+
392
+ If `run-db-migrations` fails:
393
+
394
+ - Ensure the `db` addon is included: `COMPOSE_ADDONS=db`
395
+ - Check that your project has Alembic configured with migrations in the expected location
396
+ - Verify database credentials in `.env` match your Alembic configuration
397
+ - Manually inspect the database: `poe db-shell`
398
+
399
+ ### Secrets not being generated
400
+
401
+ If `SECRET_KEY` or `DB_PASS` aren't auto-generated:
402
+
403
+ - Ensure `.env` file is writable in your project root
404
+ - Check file permissions: `ls -la .env`
405
+ - Generate manually: `python -c "import secrets; print(secrets.token_hex(32))"`
406
+
407
+ ## Design choices
408
+
409
+ ### Dockerfile (see [src/common_python_tasks/data/Dockerfile](src/common_python_tasks/data/Dockerfile))
410
+
411
+ The standard Python Dockerfile incorporates several intentional design choices.
412
+
413
+ - 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
420
+
421
+ ## Notes
422
+
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**
424
+ - `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
+ - `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
+ - 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
427
+ - Alpha status: Expect breaking changes between minor versions until 1.0.0
428
+