common-python-tasks 0.10.3__tar.gz → 0.11.1__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.
- {common_python_tasks-0.10.3 → common_python_tasks-0.11.1}/.gitignore +1 -1
- common_python_tasks-0.11.1/PKG-INFO +94 -0
- common_python_tasks-0.11.1/README.md +61 -0
- common_python_tasks-0.11.1/docs/configuration.md +95 -0
- common_python_tasks-0.11.1/docs/documentation-workflows.md +104 -0
- common_python_tasks-0.11.1/docs/getting-started.md +72 -0
- common_python_tasks-0.11.1/docs/index.md +34 -0
- common_python_tasks-0.11.1/docs/tasks/container-images.md +375 -0
- common_python_tasks-0.11.1/docs/tasks/daily-development.md +24 -0
- common_python_tasks-0.11.1/docs/tasks/development-stacks.md +25 -0
- common_python_tasks-0.11.1/docs/tasks/documentation.md +20 -0
- common_python_tasks-0.11.1/docs/tasks/index.md +37 -0
- common_python_tasks-0.11.1/docs/tasks/packaging-and-releases.md +21 -0
- common_python_tasks-0.11.1/docs/tasks/reference/build-deps-image.md +22 -0
- common_python_tasks-0.11.1/docs/tasks/reference/build-image.md +27 -0
- common_python_tasks-0.11.1/docs/tasks/reference/build-package.md +20 -0
- common_python_tasks-0.11.1/docs/tasks/reference/build.md +25 -0
- common_python_tasks-0.11.1/docs/tasks/reference/bump-version.md +22 -0
- common_python_tasks-0.11.1/docs/tasks/reference/changelog.md +13 -0
- common_python_tasks-0.11.1/docs/tasks/reference/clean.md +19 -0
- common_python_tasks-0.11.1/docs/tasks/reference/container-shell.md +26 -0
- common_python_tasks-0.11.1/docs/tasks/reference/db-shell.md +13 -0
- common_python_tasks-0.11.1/docs/tasks/reference/docs-build.md +20 -0
- common_python_tasks-0.11.1/docs/tasks/reference/docs-serve.md +21 -0
- common_python_tasks-0.11.1/docs/tasks/reference/format.md +13 -0
- common_python_tasks-0.11.1/docs/tasks/reference/lint.md +13 -0
- common_python_tasks-0.11.1/docs/tasks/reference/publish-github-release.md +24 -0
- common_python_tasks-0.11.1/docs/tasks/reference/publish-package.md +21 -0
- common_python_tasks-0.11.1/docs/tasks/reference/push-image.md +19 -0
- common_python_tasks-0.11.1/docs/tasks/reference/release.md +33 -0
- common_python_tasks-0.11.1/docs/tasks/reference/reset-db.md +13 -0
- common_python_tasks-0.11.1/docs/tasks/reference/run-container.md +27 -0
- common_python_tasks-0.11.1/docs/tasks/reference/run-db-migrations.md +13 -0
- common_python_tasks-0.11.1/docs/tasks/reference/stack-down.md +13 -0
- common_python_tasks-0.11.1/docs/tasks/reference/stack-up.md +24 -0
- common_python_tasks-0.11.1/docs/tasks/reference/test.md +20 -0
- common_python_tasks-0.11.1/docs/tasks/reference/update-dependencies.md +25 -0
- {common_python_tasks-0.10.3 → common_python_tasks-0.11.1}/pyproject.toml +15 -4
- common_python_tasks-0.11.1/scripts/docs_tasks_reference.py +285 -0
- {common_python_tasks-0.10.3 → common_python_tasks-0.11.1}/scripts/release_script.py +1 -2
- common_python_tasks-0.11.1/scripts/update_docs_tasks_reference.py +61 -0
- {common_python_tasks-0.10.3 → common_python_tasks-0.11.1}/src/common_python_tasks/env.py +74 -37
- {common_python_tasks-0.10.3 → common_python_tasks-0.11.1}/src/common_python_tasks/tasks.py +135 -25
- common_python_tasks-0.11.1/zensical.toml +35 -0
- common_python_tasks-0.10.3/PKG-INFO +0 -442
- common_python_tasks-0.10.3/README.md +0 -410
- common_python_tasks-0.10.3/scripts/readme_tasks_table.py +0 -78
- common_python_tasks-0.10.3/scripts/update_readme_tasks_table.py +0 -35
- {common_python_tasks-0.10.3 → common_python_tasks-0.11.1}/.poetry/plugins/poetry_dynamic_versioning-1.10.0.dist-info/licenses/LICENSE +0 -0
- {common_python_tasks-0.10.3 → common_python_tasks-0.11.1}/.poetry/plugins/poetry_plugin_export-1.10.0.dist-info/licenses/LICENSE +0 -0
- {common_python_tasks-0.10.3 → common_python_tasks-0.11.1}/LICENSE +0 -0
- {common_python_tasks-0.10.3 → common_python_tasks-0.11.1}/scripts/__init__.py +0 -0
- {common_python_tasks-0.10.3 → common_python_tasks-0.11.1}/scripts/add_common_python_tasks.py +0 -0
- {common_python_tasks-0.10.3 → common_python_tasks-0.11.1}/scripts/utils.py +0 -0
- {common_python_tasks-0.10.3 → common_python_tasks-0.11.1}/src/common_python_tasks/__init__.py +0 -0
- {common_python_tasks-0.10.3 → common_python_tasks-0.11.1}/src/common_python_tasks/__main__.py +0 -0
- {common_python_tasks-0.10.3 → common_python_tasks-0.11.1}/src/common_python_tasks/data/dockerfile_extensions/.gitkeep +0 -0
- {common_python_tasks-0.10.3 → common_python_tasks-0.11.1}/src/common_python_tasks/data/fastapi/alembic.ini.j2 +0 -0
- {common_python_tasks-0.10.3 → common_python_tasks-0.11.1}/src/common_python_tasks/data/fastapi/compose-base.yml.j2 +0 -0
- {common_python_tasks-0.10.3 → common_python_tasks-0.11.1}/src/common_python_tasks/data/fastapi/compose-db-debug.yml.j2 +0 -0
- {common_python_tasks-0.10.3 → common_python_tasks-0.11.1}/src/common_python_tasks/data/fastapi/compose-db.yml.j2 +0 -0
- {common_python_tasks-0.10.3 → common_python_tasks-0.11.1}/src/common_python_tasks/data/fastapi/compose-debug.yml.j2 +0 -0
- {common_python_tasks-0.10.3 → common_python_tasks-0.11.1}/src/common_python_tasks/data/generic/.coveragerc +0 -0
- {common_python_tasks-0.10.3 → common_python_tasks-0.11.1}/src/common_python_tasks/data/generic/.dockerignore +0 -0
- {common_python_tasks-0.10.3 → common_python_tasks-0.11.1}/src/common_python_tasks/data/generic/Dockerfile.deps.j2 +0 -0
- {common_python_tasks-0.10.3 → common_python_tasks-0.11.1}/src/common_python_tasks/data/generic/Dockerfile.j2 +0 -0
- {common_python_tasks-0.10.3 → common_python_tasks-0.11.1}/src/common_python_tasks/data/generic/cliff.toml +0 -0
- {common_python_tasks-0.10.3 → common_python_tasks-0.11.1}/src/common_python_tasks/data/generic/pytest.ini +0 -0
- {common_python_tasks-0.10.3 → common_python_tasks-0.11.1}/src/common_python_tasks/data/generic/ruff.toml +0 -0
- {common_python_tasks-0.10.3 → common_python_tasks-0.11.1}/src/common_python_tasks/docker.py +0 -0
- {common_python_tasks-0.10.3 → common_python_tasks-0.11.1}/src/common_python_tasks/docker_compose.py +0 -0
- {common_python_tasks-0.10.3 → common_python_tasks-0.11.1}/src/common_python_tasks/git.py +0 -0
- {common_python_tasks-0.10.3 → common_python_tasks-0.11.1}/src/common_python_tasks/github.py +0 -0
- {common_python_tasks-0.10.3 → common_python_tasks-0.11.1}/src/common_python_tasks/project.py +0 -0
- {common_python_tasks-0.10.3 → common_python_tasks-0.11.1}/src/common_python_tasks/utils.py +0 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: common-python-tasks
|
|
3
|
+
Version: 0.11.1
|
|
4
|
+
Summary: Opinionated Poe the Poet tasks for Python package development.
|
|
5
|
+
Project-URL: Homepage, http://github.com/ci-sourcerer/common-python-tasks
|
|
6
|
+
Project-URL: Source, http://github.com/ci-sourcerer/common-python-tasks.git
|
|
7
|
+
Project-URL: Issues, http://github.com/ci-sourcerer/common-python-tasks/issues
|
|
8
|
+
Author-email: Joseph Asbury <ci_sourcerer@yahoo.com>
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
18
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
19
|
+
Requires-Python: <4.0,>=3.11
|
|
20
|
+
Requires-Dist: docker<8.0.0,>=7.1.0
|
|
21
|
+
Requires-Dist: dunamai<2.0.0,>=1.25.0
|
|
22
|
+
Requires-Dist: git-cliff<3.0.0,>=2.12.0
|
|
23
|
+
Requires-Dist: jinja2<4.0.0,>=3.1.6
|
|
24
|
+
Requires-Dist: packaging<27.0,>=26.2
|
|
25
|
+
Requires-Dist: poethepoet-tasks<0.4.0,>=0.3.0
|
|
26
|
+
Requires-Dist: pytest-cov<8.0.0,>=7.0.0
|
|
27
|
+
Requires-Dist: pytest<10.0.0,>=9.0.3
|
|
28
|
+
Requires-Dist: requests<3.0.0,>=2.34.2
|
|
29
|
+
Requires-Dist: ruff<0.17.0,>=0.16.1
|
|
30
|
+
Requires-Dist: tomlkit<0.14.0,>=0.13.3
|
|
31
|
+
Requires-Dist: zensical<0.1.0,>=0.0.59
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
|
|
34
|
+
# Common Python Tasks
|
|
35
|
+
|
|
36
|
+
`common-python-tasks` provides reusable, opinionated [Poe the Poet](https://poethepoet.natn.io/guides/packaged_tasks.html) tasks for Python development, packaging, releases, containers, and documentation.
|
|
37
|
+
|
|
38
|
+
Read the [complete documentation](https://ci-sourcerer.github.io/common-python-tasks/) for the task reference, configuration options, and deployment guidance.
|
|
39
|
+
|
|
40
|
+
## Quick start
|
|
41
|
+
|
|
42
|
+
Add the package as a development dependency.
|
|
43
|
+
|
|
44
|
+
```shell
|
|
45
|
+
uv add --dev common-python-tasks==0.11.1
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Expose the default task set in `pyproject.toml`.
|
|
49
|
+
|
|
50
|
+
```toml
|
|
51
|
+
[tool.poe]
|
|
52
|
+
include_script = "common_python_tasks:tasks()"
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Run the everyday development tasks.
|
|
56
|
+
|
|
57
|
+
```shell
|
|
58
|
+
poe format
|
|
59
|
+
poe lint
|
|
60
|
+
poe test
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Optional workflows
|
|
64
|
+
|
|
65
|
+
Select additional task groups with `include_tags`.
|
|
66
|
+
|
|
67
|
+
```toml
|
|
68
|
+
[tool.poe]
|
|
69
|
+
include_script = "common_python_tasks:tasks(include_tags=['common', 'docs', 'containers'])"
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
| Tag | Purpose |
|
|
73
|
+
| - | - |
|
|
74
|
+
| `common` | Formatting, linting, testing, packaging, and releases |
|
|
75
|
+
| `docs` | Build and serve Zensical documentation |
|
|
76
|
+
| `containers` | Build, run, inspect, and publish container images |
|
|
77
|
+
| `fastapi` | Run the FastAPI and PostgreSQL development stack |
|
|
78
|
+
|
|
79
|
+
Documentation projects can build locally or start a development server.
|
|
80
|
+
|
|
81
|
+
```shell
|
|
82
|
+
poe docs-build
|
|
83
|
+
poe docs-serve
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
The [documentation workflow guide](https://ci-sourcerer.github.io/common-python-tasks/documentation-workflows/) covers GitHub Actions artifacts, optional Cloudflare Pages previews, and GitHub Pages deployment.
|
|
87
|
+
|
|
88
|
+
## Learn more
|
|
89
|
+
|
|
90
|
+
- [Getting started](https://ci-sourcerer.github.io/common-python-tasks/getting-started/)
|
|
91
|
+
- [Task reference](https://ci-sourcerer.github.io/common-python-tasks/tasks/)
|
|
92
|
+
- [Configuration reference](https://ci-sourcerer.github.io/common-python-tasks/configuration/)
|
|
93
|
+
|
|
94
|
+
The project is in alpha, so minor releases may contain breaking changes. It is distributed under the [MIT license](LICENSE).
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Common Python Tasks
|
|
2
|
+
|
|
3
|
+
`common-python-tasks` provides reusable, opinionated [Poe the Poet](https://poethepoet.natn.io/guides/packaged_tasks.html) tasks for Python development, packaging, releases, containers, and documentation.
|
|
4
|
+
|
|
5
|
+
Read the [complete documentation](https://ci-sourcerer.github.io/common-python-tasks/) for the task reference, configuration options, and deployment guidance.
|
|
6
|
+
|
|
7
|
+
## Quick start
|
|
8
|
+
|
|
9
|
+
Add the package as a development dependency.
|
|
10
|
+
|
|
11
|
+
```shell
|
|
12
|
+
uv add --dev common-python-tasks==0.11.1
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Expose the default task set in `pyproject.toml`.
|
|
16
|
+
|
|
17
|
+
```toml
|
|
18
|
+
[tool.poe]
|
|
19
|
+
include_script = "common_python_tasks:tasks()"
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Run the everyday development tasks.
|
|
23
|
+
|
|
24
|
+
```shell
|
|
25
|
+
poe format
|
|
26
|
+
poe lint
|
|
27
|
+
poe test
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Optional workflows
|
|
31
|
+
|
|
32
|
+
Select additional task groups with `include_tags`.
|
|
33
|
+
|
|
34
|
+
```toml
|
|
35
|
+
[tool.poe]
|
|
36
|
+
include_script = "common_python_tasks:tasks(include_tags=['common', 'docs', 'containers'])"
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
| Tag | Purpose |
|
|
40
|
+
| - | - |
|
|
41
|
+
| `common` | Formatting, linting, testing, packaging, and releases |
|
|
42
|
+
| `docs` | Build and serve Zensical documentation |
|
|
43
|
+
| `containers` | Build, run, inspect, and publish container images |
|
|
44
|
+
| `fastapi` | Run the FastAPI and PostgreSQL development stack |
|
|
45
|
+
|
|
46
|
+
Documentation projects can build locally or start a development server.
|
|
47
|
+
|
|
48
|
+
```shell
|
|
49
|
+
poe docs-build
|
|
50
|
+
poe docs-serve
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
The [documentation workflow guide](https://ci-sourcerer.github.io/common-python-tasks/documentation-workflows/) covers GitHub Actions artifacts, optional Cloudflare Pages previews, and GitHub Pages deployment.
|
|
54
|
+
|
|
55
|
+
## Learn more
|
|
56
|
+
|
|
57
|
+
- [Getting started](https://ci-sourcerer.github.io/common-python-tasks/getting-started/)
|
|
58
|
+
- [Task reference](https://ci-sourcerer.github.io/common-python-tasks/tasks/)
|
|
59
|
+
- [Configuration reference](https://ci-sourcerer.github.io/common-python-tasks/configuration/)
|
|
60
|
+
|
|
61
|
+
The project is in alpha, so minor releases may contain breaking changes. It is distributed under the [MIT license](LICENSE).
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# Configuration
|
|
2
|
+
|
|
3
|
+
Every consuming project needs `pyproject.toml` and Poe the Poet. Tasks that build, publish, install, or update packages use uv.
|
|
4
|
+
|
|
5
|
+
## Configuration precedence
|
|
6
|
+
|
|
7
|
+
Pytest and coverage configuration is resolved in this order.
|
|
8
|
+
|
|
9
|
+
1. Matching `pyproject.toml` sections
|
|
10
|
+
2. Environment variables naming configuration files
|
|
11
|
+
3. Project-root configuration files
|
|
12
|
+
4. Defaults bundled with `common-python-tasks`
|
|
13
|
+
|
|
14
|
+
Ruff uses `RUFF_CONFIG` when set. Otherwise, it discovers `.ruff.toml`, `ruff.toml`, or `[tool.ruff]` in `pyproject.toml`. The bundled configuration is used when the project has no Ruff configuration.
|
|
15
|
+
|
|
16
|
+
## Project and publishing settings
|
|
17
|
+
|
|
18
|
+
| Setting | Purpose |
|
|
19
|
+
| - | - |
|
|
20
|
+
| `PACKAGE_NAME` | Override the package name inferred from `pyproject.toml` |
|
|
21
|
+
| `COMMON_PYTHON_TASKS_PUBLISH_REPOSITORY` | Select a named uv publish index |
|
|
22
|
+
| `COMMON_PYTHON_TASKS_PUBLISH_URL` | Select a uv upload URL |
|
|
23
|
+
| `GITHUB_RELEASE_ASSETS` | Select GitHub Release asset paths or glob patterns |
|
|
24
|
+
| `SKIP_GITHUB_RELEASE` | Disable GitHub Release publication |
|
|
25
|
+
| `RELEASE_UPDATE_CHANGELOG` | Generate and commit release changelog content |
|
|
26
|
+
| `RELEASE_PRE_SCRIPT` | Run a command before the release steps |
|
|
27
|
+
| `RELEASE_POST_SCRIPT` | Run a command after the release steps |
|
|
28
|
+
|
|
29
|
+
The package also recognizes uv's `UV_PUBLISH_INDEX` and `UV_PUBLISH_URL` settings. Explicit task arguments take precedence over environment values and project configuration.
|
|
30
|
+
|
|
31
|
+
## Container settings
|
|
32
|
+
|
|
33
|
+
Container variables are read by the host-side tasks unless their description explicitly says that they persist in the image. See [Container images](tasks/container-images.md) for the generated Dockerfile lifecycle, environment precedence, extensions, and dependency images.
|
|
34
|
+
|
|
35
|
+
### Image and build settings
|
|
36
|
+
|
|
37
|
+
| Setting | Purpose |
|
|
38
|
+
| - | - |
|
|
39
|
+
| `CONTAINER_REGISTRY_USERNAME` | Registry username used for image tags |
|
|
40
|
+
| `CONTAINER_REGISTRY_URL` | Registry hostname and optional namespace path; defaults to `docker.io/<username>` |
|
|
41
|
+
| `CONTAINER_REGISTRY_NAMESPACE` | Namespace appended when the registry URL contains only a hostname |
|
|
42
|
+
| `CONTAINER_PYTHON_VARIANT` | Python base-image variant; defaults to `slim`, while an empty value disables the suffix |
|
|
43
|
+
| `WORKDIR_PATH` | Home and working directory for the non-root `py` user; defaults to `/workspace` |
|
|
44
|
+
| `CONTAINER_APT_PACKAGES` | Space-delimited APT packages installed in the runtime stage |
|
|
45
|
+
| `CONTAINER_CUSTOM_ENTRYPOINT` | `[project.scripts]` key selected as the image entrypoint command |
|
|
46
|
+
| `CONTAINER_DOCKER_BUILD_ARGS` | Shell-tokenized arguments passed directly to `docker build`; task arguments after `--` take precedence |
|
|
47
|
+
| `CONTAINER_DOCKERFILE_PATH` | Project-owned application Dockerfile used by `build-image`, `build`, and `release` instead of the bundled template |
|
|
48
|
+
| `CONTAINER_DOCKERFILE_HOOK_PATH` | Executable host script that modifies the selected Dockerfile before the build |
|
|
49
|
+
| `CONTAINER_PRUNE_KEEP` | Prior images kept after a build; `-1` disables pruning, `0` keeps only the latest, and `N` keeps the latest plus `N` prior images |
|
|
50
|
+
|
|
51
|
+
### Environment and extension settings
|
|
52
|
+
|
|
53
|
+
| Setting | Purpose |
|
|
54
|
+
| - | - |
|
|
55
|
+
| `CONTAINER_ENV` | Colon-delimited `KEY=VALUE` declarations persisted in the builder, runtime, final, and debug images |
|
|
56
|
+
| `.containerenv` | Project-root file containing the same declarations, at the lowest precedence |
|
|
57
|
+
| `UV_INDEX_<NAME>_USERNAME` | Private uv index username passed to BuildKit as a secret rather than persisted in the image |
|
|
58
|
+
| `UV_INDEX_<NAME>_PASSWORD` | Private uv index password passed to BuildKit as a secret rather than persisted in the image |
|
|
59
|
+
| `CONTAINER_EXTENSION_FILES` | Colon-delimited local Dockerfile fragments appended to the runtime stage |
|
|
60
|
+
| `CONTAINER_EXTENSIONS` | Colon-delimited installed extension bundles, optionally written as `bundle=value` |
|
|
61
|
+
|
|
62
|
+
### Dependency-image settings
|
|
63
|
+
|
|
64
|
+
| Setting | Purpose |
|
|
65
|
+
| - | - |
|
|
66
|
+
| `CONTAINER_DEPS_CONTENT` | Inline instructions for the bundled dependency-image Dockerfile; takes precedence over dependency files |
|
|
67
|
+
| `CONTAINER_DEPS_FILE` | Colon-delimited complete dependency Dockerfiles used when inline content is unset |
|
|
68
|
+
| `CONTAINER_DEPS_IMAGE` | Existing image that exports artifacts through `/tmp/deps` |
|
|
69
|
+
| `CONTAINER_DEPS_MAPPINGS` | Whitespace-delimited `name:/destination/path` moves for content copied from `/tmp/deps` |
|
|
70
|
+
| `CONTAINER_DEPS_MOVE_SCRIPT` | Inline script that distributes copied dependency artifacts and takes precedence over mappings |
|
|
71
|
+
| `CONTAINER_DEPS_MOVE_SCRIPT_PATH` | Host path to a dependency move script; takes precedence over the inline script and mappings |
|
|
72
|
+
|
|
73
|
+
## Development-stack settings
|
|
74
|
+
|
|
75
|
+
Set `COMPOSE_TYPE=fastapi` to use the bundled FastAPI stack. Add PostgreSQL with `COMPOSE_ADDONS=db`.
|
|
76
|
+
|
|
77
|
+
```toml
|
|
78
|
+
[tool.poe.env]
|
|
79
|
+
COMPOSE_TYPE = "fastapi"
|
|
80
|
+
COMPOSE_ADDONS = "db"
|
|
81
|
+
API_PORT = "8080"
|
|
82
|
+
DB_PORT = "5432"
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
`COMPOSE_FILE` replaces automatic compose-file selection. `COMPOSE_OVERLAY_FILES` appends project-specific overlays to the automatically selected files.
|
|
86
|
+
|
|
87
|
+
## Diagnostics
|
|
88
|
+
|
|
89
|
+
Set `COMMON_PYTHON_TASKS_LOG_LEVEL=DEBUG` to show configuration resolution and subprocess commands.
|
|
90
|
+
|
|
91
|
+
```shell
|
|
92
|
+
COMMON_PYTHON_TASKS_LOG_LEVEL=DEBUG poe test
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
The complete environment-variable inventory remains available in the repository [README](https://github.com/ci-sourcerer/common-python-tasks#environment-variables).
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# Documentation workflows
|
|
2
|
+
|
|
3
|
+
Projects can use the packaged documentation tasks locally and the repository's reusable GitHub workflow in CI. The workflow builds the caller's repository, not `common-python-tasks`.
|
|
4
|
+
|
|
5
|
+
## Configure a project
|
|
6
|
+
|
|
7
|
+
Add a `zensical.toml` file and select the `docs` task group.
|
|
8
|
+
|
|
9
|
+
```toml
|
|
10
|
+
[tool.poe]
|
|
11
|
+
include_script = "common_python_tasks:tasks(include_tags=['common', 'docs'])"
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Build or serve the site locally.
|
|
15
|
+
|
|
16
|
+
```shell
|
|
17
|
+
poe docs-build
|
|
18
|
+
poe docs-serve
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Build pull-request artifacts
|
|
22
|
+
|
|
23
|
+
Keep event triggers and path filters in the consuming repository, then call the reusable workflow from a job.
|
|
24
|
+
|
|
25
|
+
```yaml
|
|
26
|
+
name: docs-preview
|
|
27
|
+
|
|
28
|
+
on:
|
|
29
|
+
pull_request:
|
|
30
|
+
paths:
|
|
31
|
+
- 'docs/**'
|
|
32
|
+
- 'zensical.toml'
|
|
33
|
+
- 'pyproject.toml'
|
|
34
|
+
- 'uv.lock'
|
|
35
|
+
|
|
36
|
+
jobs:
|
|
37
|
+
docs:
|
|
38
|
+
uses: ci-sourcerer/common-python-tasks/.github/workflows/docs.yml@v0.11.0
|
|
39
|
+
with:
|
|
40
|
+
python_version: '3.14'
|
|
41
|
+
dependency_group: dev
|
|
42
|
+
permissions:
|
|
43
|
+
contents: read
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
The workflow uploads the rendered site as a GitHub Actions artifact by default.
|
|
47
|
+
|
|
48
|
+
## Run a client-owned generated-document check
|
|
49
|
+
|
|
50
|
+
Some projects generate additional documentation from application code. Keep that generator in the consuming project and pass its Poe check task to the workflow.
|
|
51
|
+
|
|
52
|
+
```yaml
|
|
53
|
+
with:
|
|
54
|
+
python_version: '3.14'
|
|
55
|
+
dependency_group: dev
|
|
56
|
+
generated_docs_check_task: docs-cli-reference-check
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Only task names containing letters, digits, underscores, and hyphens are accepted.
|
|
60
|
+
|
|
61
|
+
## Enable Cloudflare Pages previews
|
|
62
|
+
|
|
63
|
+
Cloudflare publication is optional. The workflow ensures that one Direct Upload Pages project exists for the consuming repository, then deploys previews to it with narrowly scoped credentials.
|
|
64
|
+
|
|
65
|
+
```yaml
|
|
66
|
+
jobs:
|
|
67
|
+
docs:
|
|
68
|
+
uses: ci-sourcerer/common-python-tasks/.github/workflows/docs.yml@v0.11.0
|
|
69
|
+
with:
|
|
70
|
+
python_version: '3.14'
|
|
71
|
+
dependency_group: dev
|
|
72
|
+
publish_cloudflare: true
|
|
73
|
+
cloudflare_project_name: stacksmith-docs
|
|
74
|
+
cloudflare_preview_domain: preview.example.com
|
|
75
|
+
cloudflare_preview_zone: example.com
|
|
76
|
+
permissions:
|
|
77
|
+
contents: read
|
|
78
|
+
deployments: write
|
|
79
|
+
secrets:
|
|
80
|
+
cloudflare_account_id: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
81
|
+
cloudflare_api_token: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
The project is created on the first trusted pull request, using `main` as its production branch by default. Set `cloudflare_production_branch` if the repository uses a different default branch. Set `cloudflare_preview_domain` to publish previews at `pr-42.preview.example.com`; leave it empty to use `pr-42.stacksmith-docs.pages.dev`. Set `cloudflare_preview_zone` when the preview domain is a subdomain of the DNS zone. The API token needs Pages Write, Zone Read, and Zone DNS Edit permissions when custom preview domains are enabled. Fork pull requests receive the build artifact but are not published because repository secrets are unavailable. A separate `pull_request`-closed workflow can remove the custom hostname, its matching DNS record, and older deployments for that preview branch while preserving the shared Pages project. Cloudflare retains the latest branch deployment.
|
|
85
|
+
|
|
86
|
+
## Deploy production documentation to GitHub Pages
|
|
87
|
+
|
|
88
|
+
Enable GitHub Actions as the repository's Pages source. A default-branch caller can then select production deployment.
|
|
89
|
+
|
|
90
|
+
```yaml
|
|
91
|
+
jobs:
|
|
92
|
+
docs:
|
|
93
|
+
uses: ci-sourcerer/common-python-tasks/.github/workflows/docs.yml@v0.11.0
|
|
94
|
+
with:
|
|
95
|
+
python_version: '3.14'
|
|
96
|
+
dependency_group: dev
|
|
97
|
+
deploy_github_pages: true
|
|
98
|
+
permissions:
|
|
99
|
+
contents: read
|
|
100
|
+
pages: write
|
|
101
|
+
id-token: write
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Pin the workflow to the release that matches the installed package. Pin an exact commit SHA when an immutable workflow reference is required.
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Getting started
|
|
2
|
+
|
|
3
|
+
## Add the development dependency
|
|
4
|
+
|
|
5
|
+
Add a released version of `common-python-tasks` from the root of a Python project.
|
|
6
|
+
|
|
7
|
+
```shell
|
|
8
|
+
uv add --dev common-python-tasks==0.10.3
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Configure Poe to expose the standard task set.
|
|
12
|
+
|
|
13
|
+
```toml
|
|
14
|
+
[tool.poe]
|
|
15
|
+
include_script = "common_python_tasks:tasks()"
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
The default selection provides formatting, linting, testing, package builds, dependency updates, and release tasks.
|
|
19
|
+
|
|
20
|
+
```shell
|
|
21
|
+
poe format
|
|
22
|
+
poe lint
|
|
23
|
+
poe test
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Select optional task groups
|
|
27
|
+
|
|
28
|
+
Pass `include_tags` when a project needs optional workflows.
|
|
29
|
+
|
|
30
|
+
```toml
|
|
31
|
+
[tool.poe]
|
|
32
|
+
include_script = "common_python_tasks:tasks(include_tags=['common', 'docs', 'containers'])"
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Use `exclude_tags` when a project wants nearly every group.
|
|
36
|
+
|
|
37
|
+
```toml
|
|
38
|
+
[tool.poe]
|
|
39
|
+
include_script = "common_python_tasks:tasks(exclude_tags=['fastapi'])"
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Calling `tasks()` with no arguments selects only `common`. Passing an explicit empty `include_tags` sequence selects every task unless an exclusion removes it.
|
|
43
|
+
|
|
44
|
+
## Automated setup
|
|
45
|
+
|
|
46
|
+
The release helper adds the dependency and configures Poe. Download the helper for the exact release being installed, review it, and run it with the same version.
|
|
47
|
+
|
|
48
|
+
```shell
|
|
49
|
+
curl --fail --silent --show-error --location \
|
|
50
|
+
--output /tmp/add_common_python_tasks.py \
|
|
51
|
+
https://raw.githubusercontent.com/ci-sourcerer/common-python-tasks/v0.10.3/scripts/add_common_python_tasks.py
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
```shell
|
|
55
|
+
COMMON_PYTHON_TASKS_VERSION=0.10.3 python3 /tmp/add_common_python_tasks.py
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Inspect available tasks
|
|
59
|
+
|
|
60
|
+
Poe displays the tasks selected by the project.
|
|
61
|
+
|
|
62
|
+
```shell
|
|
63
|
+
poe --help
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
The package module also lists its public default tasks. Set the log level to include their descriptions.
|
|
67
|
+
|
|
68
|
+
```shell
|
|
69
|
+
COMMON_PYTHON_TASKS_LOG_LEVEL=DEBUG python -m common_python_tasks
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Continue with the [task reference](tasks/index.md) for task-specific behavior and requirements.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Common Python Tasks
|
|
2
|
+
|
|
3
|
+
`common-python-tasks` is a reusable collection of opinionated [Poe the Poet](https://poethepoet.natn.io/guides/packaged_tasks.html) tasks for Python projects. It gives projects one shared implementation for everyday development, packaging, releases, container images, development stacks, and documentation.
|
|
4
|
+
|
|
5
|
+
## Choose where to begin
|
|
6
|
+
|
|
7
|
+
- **Adding the package to a project?** Follow [Getting started](getting-started.md).
|
|
8
|
+
- **Looking for a command?** Browse the [task reference](tasks/index.md).
|
|
9
|
+
- **Customizing behavior?** Use the [configuration reference](configuration.md).
|
|
10
|
+
- **Publishing documentation like this?** See the [documentation workflows](documentation-workflows.md).
|
|
11
|
+
|
|
12
|
+
## Task groups
|
|
13
|
+
|
|
14
|
+
Tasks are organized by tags, so each project can select only the workflows it needs.
|
|
15
|
+
|
|
16
|
+
| Group | Purpose |
|
|
17
|
+
| - | - |
|
|
18
|
+
| `common` | Formatting, linting, testing, packaging, and releases |
|
|
19
|
+
| `docs` | Build and locally serve Zensical documentation |
|
|
20
|
+
| `containers` | Build, run, inspect, and publish container images |
|
|
21
|
+
| `fastapi` | Run a local FastAPI and PostgreSQL development stack |
|
|
22
|
+
|
|
23
|
+
The default task collection exposes the `common` group. Optional groups are enabled through the package's `include_script` expression.
|
|
24
|
+
|
|
25
|
+
```toml
|
|
26
|
+
[tool.poe]
|
|
27
|
+
include_script = "common_python_tasks:tasks(include_tags=['common', 'docs'])"
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Design approach
|
|
31
|
+
|
|
32
|
+
The package supplies executable workflows and conservative defaults. Project-specific source files remain in the consuming repository, including application code, documentation content, Zensical configuration, Docker extensions, and environment settings.
|
|
33
|
+
|
|
34
|
+
Commands run in the consuming project's environment, so the same task definitions work locally and in CI without hiding the underlying tools.
|