common-python-tasks 0.10.2__tar.gz → 0.10.3__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.2 → common_python_tasks-0.10.3}/PKG-INFO +8 -8
- {common_python_tasks-0.10.2 → common_python_tasks-0.10.3}/README.md +7 -7
- {common_python_tasks-0.10.2 → common_python_tasks-0.10.3}/src/common_python_tasks/data/fastapi/compose-db.yml.j2 +1 -1
- {common_python_tasks-0.10.2 → common_python_tasks-0.10.3}/src/common_python_tasks/data/generic/Dockerfile.j2 +8 -1
- {common_python_tasks-0.10.2 → common_python_tasks-0.10.3}/src/common_python_tasks/docker_compose.py +2 -1
- {common_python_tasks-0.10.2 → common_python_tasks-0.10.3}/src/common_python_tasks/env.py +1 -0
- {common_python_tasks-0.10.2 → common_python_tasks-0.10.3}/src/common_python_tasks/git.py +8 -1
- {common_python_tasks-0.10.2 → common_python_tasks-0.10.3}/src/common_python_tasks/project.py +3 -1
- {common_python_tasks-0.10.2 → common_python_tasks-0.10.3}/src/common_python_tasks/tasks.py +33 -10
- {common_python_tasks-0.10.2 → common_python_tasks-0.10.3}/.gitignore +0 -0
- {common_python_tasks-0.10.2 → common_python_tasks-0.10.3}/.poetry/plugins/poetry_dynamic_versioning-1.10.0.dist-info/licenses/LICENSE +0 -0
- {common_python_tasks-0.10.2 → common_python_tasks-0.10.3}/.poetry/plugins/poetry_plugin_export-1.10.0.dist-info/licenses/LICENSE +0 -0
- {common_python_tasks-0.10.2 → common_python_tasks-0.10.3}/LICENSE +0 -0
- {common_python_tasks-0.10.2 → common_python_tasks-0.10.3}/pyproject.toml +0 -0
- {common_python_tasks-0.10.2 → common_python_tasks-0.10.3}/scripts/__init__.py +0 -0
- {common_python_tasks-0.10.2 → common_python_tasks-0.10.3}/scripts/add_common_python_tasks.py +0 -0
- {common_python_tasks-0.10.2 → common_python_tasks-0.10.3}/scripts/readme_tasks_table.py +0 -0
- {common_python_tasks-0.10.2 → common_python_tasks-0.10.3}/scripts/release_script.py +0 -0
- {common_python_tasks-0.10.2 → common_python_tasks-0.10.3}/scripts/update_readme_tasks_table.py +0 -0
- {common_python_tasks-0.10.2 → common_python_tasks-0.10.3}/scripts/utils.py +0 -0
- {common_python_tasks-0.10.2 → common_python_tasks-0.10.3}/src/common_python_tasks/__init__.py +0 -0
- {common_python_tasks-0.10.2 → common_python_tasks-0.10.3}/src/common_python_tasks/__main__.py +0 -0
- {common_python_tasks-0.10.2 → common_python_tasks-0.10.3}/src/common_python_tasks/data/dockerfile_extensions/.gitkeep +0 -0
- {common_python_tasks-0.10.2 → common_python_tasks-0.10.3}/src/common_python_tasks/data/fastapi/alembic.ini.j2 +0 -0
- {common_python_tasks-0.10.2 → common_python_tasks-0.10.3}/src/common_python_tasks/data/fastapi/compose-base.yml.j2 +0 -0
- {common_python_tasks-0.10.2 → common_python_tasks-0.10.3}/src/common_python_tasks/data/fastapi/compose-db-debug.yml.j2 +0 -0
- {common_python_tasks-0.10.2 → common_python_tasks-0.10.3}/src/common_python_tasks/data/fastapi/compose-debug.yml.j2 +0 -0
- {common_python_tasks-0.10.2 → common_python_tasks-0.10.3}/src/common_python_tasks/data/generic/.coveragerc +0 -0
- {common_python_tasks-0.10.2 → common_python_tasks-0.10.3}/src/common_python_tasks/data/generic/.dockerignore +0 -0
- {common_python_tasks-0.10.2 → common_python_tasks-0.10.3}/src/common_python_tasks/data/generic/Dockerfile.deps.j2 +0 -0
- {common_python_tasks-0.10.2 → common_python_tasks-0.10.3}/src/common_python_tasks/data/generic/cliff.toml +0 -0
- {common_python_tasks-0.10.2 → common_python_tasks-0.10.3}/src/common_python_tasks/data/generic/pytest.ini +0 -0
- {common_python_tasks-0.10.2 → common_python_tasks-0.10.3}/src/common_python_tasks/data/generic/ruff.toml +0 -0
- {common_python_tasks-0.10.2 → common_python_tasks-0.10.3}/src/common_python_tasks/docker.py +0 -0
- {common_python_tasks-0.10.2 → common_python_tasks-0.10.3}/src/common_python_tasks/github.py +0 -0
- {common_python_tasks-0.10.2 → common_python_tasks-0.10.3}/src/common_python_tasks/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: common-python-tasks
|
|
3
|
-
Version: 0.10.
|
|
3
|
+
Version: 0.10.3
|
|
4
4
|
Summary: Opinionated Poe the Poet tasks for Python package development.
|
|
5
5
|
Project-URL: Homepage, http://github.com/ci-sourcerer/common-python-tasks
|
|
6
6
|
Project-URL: Source, http://github.com/ci-sourcerer/common-python-tasks.git
|
|
@@ -43,7 +43,7 @@ It supplies sensible defaults for formatting, linting, testing, packaging, relea
|
|
|
43
43
|
Add `common-python-tasks` as a development dependency from your project root.
|
|
44
44
|
|
|
45
45
|
```shell
|
|
46
|
-
uv add --dev common-python-tasks==0.10.
|
|
46
|
+
uv add --dev common-python-tasks==0.10.3
|
|
47
47
|
```
|
|
48
48
|
|
|
49
49
|
Configure Poe the Poet to expose the default `common` task set.
|
|
@@ -68,7 +68,7 @@ The helper script performs the same development-dependency installation and Poe
|
|
|
68
68
|
```shell
|
|
69
69
|
curl --fail --silent --show-error --location \
|
|
70
70
|
--output /tmp/add_common_python_tasks.py \
|
|
71
|
-
https://raw.githubusercontent.com/ci-sourcerer/common-python-tasks/v0.10.
|
|
71
|
+
https://raw.githubusercontent.com/ci-sourcerer/common-python-tasks/v0.10.3/scripts/add_common_python_tasks.py
|
|
72
72
|
```
|
|
73
73
|
|
|
74
74
|
Review the downloaded script before executing it.
|
|
@@ -80,10 +80,10 @@ less /tmp/add_common_python_tasks.py
|
|
|
80
80
|
Run the reviewed script with the same pinned package version.
|
|
81
81
|
|
|
82
82
|
```shell
|
|
83
|
-
COMMON_PYTHON_TASKS_VERSION=0.10.
|
|
83
|
+
COMMON_PYTHON_TASKS_VERSION=0.10.3 python3 /tmp/add_common_python_tasks.py
|
|
84
84
|
```
|
|
85
85
|
|
|
86
|
-
To install another release, replace both occurrences of `0.10.
|
|
86
|
+
To install another release, replace both occurrences of `0.10.3` with that release's version.
|
|
87
87
|
|
|
88
88
|
## Available tasks
|
|
89
89
|
|
|
@@ -203,7 +203,7 @@ After installing the package, a minimal project configuration looks like this.
|
|
|
203
203
|
```toml
|
|
204
204
|
[project]
|
|
205
205
|
name = "simple-cli-tool"
|
|
206
|
-
version = "0.10.
|
|
206
|
+
version = "0.10.3"
|
|
207
207
|
|
|
208
208
|
[tool.poe]
|
|
209
209
|
include_script = "common_python_tasks:tasks()"
|
|
@@ -256,7 +256,7 @@ addopts = "-ra"
|
|
|
256
256
|
- `CONTAINER_DEPS_IMAGE`: Existing dependency image used when neither `CONTAINER_DEPS_CONTENT` nor `CONTAINER_DEPS_FILE` is configured
|
|
257
257
|
- `CONTAINER_EXTENSION_FILES`: Colon-delimited local extension Dockerfile paths. Escape literal colons as `\:` or quote the complete path.
|
|
258
258
|
- `CONTAINER_EXTENSIONS`: Colon-delimited extension-bundle names or parameterized values. Escape literal colons as `\:` or quote the complete value.
|
|
259
|
-
- `CONTAINER_ENV`: Colon-delimited `KEY=VALUE` declarations injected into the
|
|
259
|
+
- `CONTAINER_ENV`: Colon-delimited `KEY=VALUE` declarations injected into both the builder and runtime stages. These variables are available to package build commands and runtime-stage build commands, and persist in the final and debug images for running containers. The `container_env` and `container_envfile` task arguments use the same behavior. Escape literal colons as `\:` or quote the complete value. Use `run-container --env` or `--envfile` to override values when starting a container.
|
|
260
260
|
- `.containerenv`: A project-root file that can supply the same declarations. It is loaded before the `container_envfile` task argument, `CONTAINER_ENV`, and the `container_env` task argument.
|
|
261
261
|
- `CONTAINER_PRUNE_KEEP`: Image-pruning policy after builds. `-1` keeps all images, `0` keeps only the latest, and `N` keeps the latest plus `N` prior images.
|
|
262
262
|
- `CONTAINER_DEPS_CONTENT`: Inline Dockerfile instructions for a dependency image that installs artifacts into `/tmp/deps`
|
|
@@ -291,7 +291,7 @@ addopts = "-ra"
|
|
|
291
291
|
- `SECRET_KEY`: Application secret key generated automatically when unset
|
|
292
292
|
- `ENVIRONMENT`: Environment name with a default of `production`
|
|
293
293
|
- `DEBUG_PORT`: Python debugger port in debug mode with a default of `5678`
|
|
294
|
-
- `DB_PORT`:
|
|
294
|
+
- `DB_PORT`: Published host port for PostgreSQL, defaulting to `5432`. The API and migrator connect to the database container on port `5432` regardless of this setting.
|
|
295
295
|
- `DB_USER`: Database user with a default of the package name
|
|
296
296
|
- `DB_BASE`: Database name with a default of the package name
|
|
297
297
|
- `DB_PASS`: Database password generated automatically when unset
|
|
@@ -11,7 +11,7 @@ It supplies sensible defaults for formatting, linting, testing, packaging, relea
|
|
|
11
11
|
Add `common-python-tasks` as a development dependency from your project root.
|
|
12
12
|
|
|
13
13
|
```shell
|
|
14
|
-
uv add --dev common-python-tasks==0.10.
|
|
14
|
+
uv add --dev common-python-tasks==0.10.3
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
Configure Poe the Poet to expose the default `common` task set.
|
|
@@ -36,7 +36,7 @@ The helper script performs the same development-dependency installation and Poe
|
|
|
36
36
|
```shell
|
|
37
37
|
curl --fail --silent --show-error --location \
|
|
38
38
|
--output /tmp/add_common_python_tasks.py \
|
|
39
|
-
https://raw.githubusercontent.com/ci-sourcerer/common-python-tasks/v0.10.
|
|
39
|
+
https://raw.githubusercontent.com/ci-sourcerer/common-python-tasks/v0.10.3/scripts/add_common_python_tasks.py
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
Review the downloaded script before executing it.
|
|
@@ -48,10 +48,10 @@ less /tmp/add_common_python_tasks.py
|
|
|
48
48
|
Run the reviewed script with the same pinned package version.
|
|
49
49
|
|
|
50
50
|
```shell
|
|
51
|
-
COMMON_PYTHON_TASKS_VERSION=0.10.
|
|
51
|
+
COMMON_PYTHON_TASKS_VERSION=0.10.3 python3 /tmp/add_common_python_tasks.py
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
-
To install another release, replace both occurrences of `0.10.
|
|
54
|
+
To install another release, replace both occurrences of `0.10.3` with that release's version.
|
|
55
55
|
|
|
56
56
|
## Available tasks
|
|
57
57
|
|
|
@@ -171,7 +171,7 @@ After installing the package, a minimal project configuration looks like this.
|
|
|
171
171
|
```toml
|
|
172
172
|
[project]
|
|
173
173
|
name = "simple-cli-tool"
|
|
174
|
-
version = "0.10.
|
|
174
|
+
version = "0.10.3"
|
|
175
175
|
|
|
176
176
|
[tool.poe]
|
|
177
177
|
include_script = "common_python_tasks:tasks()"
|
|
@@ -224,7 +224,7 @@ addopts = "-ra"
|
|
|
224
224
|
- `CONTAINER_DEPS_IMAGE`: Existing dependency image used when neither `CONTAINER_DEPS_CONTENT` nor `CONTAINER_DEPS_FILE` is configured
|
|
225
225
|
- `CONTAINER_EXTENSION_FILES`: Colon-delimited local extension Dockerfile paths. Escape literal colons as `\:` or quote the complete path.
|
|
226
226
|
- `CONTAINER_EXTENSIONS`: Colon-delimited extension-bundle names or parameterized values. Escape literal colons as `\:` or quote the complete value.
|
|
227
|
-
- `CONTAINER_ENV`: Colon-delimited `KEY=VALUE` declarations injected into the
|
|
227
|
+
- `CONTAINER_ENV`: Colon-delimited `KEY=VALUE` declarations injected into both the builder and runtime stages. These variables are available to package build commands and runtime-stage build commands, and persist in the final and debug images for running containers. The `container_env` and `container_envfile` task arguments use the same behavior. Escape literal colons as `\:` or quote the complete value. Use `run-container --env` or `--envfile` to override values when starting a container.
|
|
228
228
|
- `.containerenv`: A project-root file that can supply the same declarations. It is loaded before the `container_envfile` task argument, `CONTAINER_ENV`, and the `container_env` task argument.
|
|
229
229
|
- `CONTAINER_PRUNE_KEEP`: Image-pruning policy after builds. `-1` keeps all images, `0` keeps only the latest, and `N` keeps the latest plus `N` prior images.
|
|
230
230
|
- `CONTAINER_DEPS_CONTENT`: Inline Dockerfile instructions for a dependency image that installs artifacts into `/tmp/deps`
|
|
@@ -259,7 +259,7 @@ addopts = "-ra"
|
|
|
259
259
|
- `SECRET_KEY`: Application secret key generated automatically when unset
|
|
260
260
|
- `ENVIRONMENT`: Environment name with a default of `production`
|
|
261
261
|
- `DEBUG_PORT`: Python debugger port in debug mode with a default of `5678`
|
|
262
|
-
- `DB_PORT`:
|
|
262
|
+
- `DB_PORT`: Published host port for PostgreSQL, defaulting to `5432`. The API and migrator connect to the database container on port `5432` regardless of this setting.
|
|
263
263
|
- `DB_USER`: Database user with a default of the package name
|
|
264
264
|
- `DB_BASE`: Database name with a default of the package name
|
|
265
265
|
- `DB_PASS`: Database password generated automatically when unset
|
|
@@ -12,6 +12,13 @@ FROM python:${PYTHON_VERSION} AS builder
|
|
|
12
12
|
ARG PACKAGE_VERSION
|
|
13
13
|
ARG UV_VERSION
|
|
14
14
|
|
|
15
|
+
{% if CONTAINER_ENV_VARS %}
|
|
16
|
+
# Make configured variables available to package build commands.
|
|
17
|
+
{% for env_var in CONTAINER_ENV_VARS -%}
|
|
18
|
+
ENV {{ env_var }}
|
|
19
|
+
{% endfor %}
|
|
20
|
+
{%- endif %}
|
|
21
|
+
|
|
15
22
|
# Bypass VCS-based version detection: use the host-computed version directly.
|
|
16
23
|
# This avoids requiring a .git directory in the build context and prevents
|
|
17
24
|
# false dirty-version detection from a partial working tree.
|
|
@@ -60,7 +67,7 @@ ARG NONROOT_UID=1000
|
|
|
60
67
|
ARG NONROOT_GID=1000
|
|
61
68
|
|
|
62
69
|
{% if CONTAINER_ENV_VARS %}
|
|
63
|
-
#
|
|
70
|
+
# Persist the same variables for runtime build commands and running containers.
|
|
64
71
|
{% for env_var in CONTAINER_ENV_VARS -%}
|
|
65
72
|
ENV {{ env_var }}
|
|
66
73
|
{% endfor %}
|
{common_python_tasks-0.10.2 → common_python_tasks-0.10.3}/src/common_python_tasks/docker_compose.py
RENAMED
|
@@ -606,6 +606,7 @@ def build_exec_script(
|
|
|
606
606
|
"trap 'rm -f \"$SCRIPT_PATH\"' EXIT",
|
|
607
607
|
"",
|
|
608
608
|
" ".join(quote(str(arg)) for arg in command),
|
|
609
|
+
"command_status=$?",
|
|
609
610
|
]
|
|
610
611
|
|
|
611
612
|
if teardown_command:
|
|
@@ -619,7 +620,7 @@ def build_exec_script(
|
|
|
619
620
|
for path in cleanup_paths:
|
|
620
621
|
lines.append(f"rm -f {quote(str(path))}")
|
|
621
622
|
|
|
622
|
-
lines.
|
|
623
|
+
lines.extend(['exit "$command_status"', ""])
|
|
623
624
|
|
|
624
625
|
script_path.write_text("\n".join(lines), encoding="utf-8")
|
|
625
626
|
script_path.chmod(0o700)
|
|
@@ -335,7 +335,14 @@ def has_tags_later_in_history() -> bool:
|
|
|
335
335
|
capture_output=True,
|
|
336
336
|
acceptable_returncodes={0, 1},
|
|
337
337
|
)
|
|
338
|
-
if
|
|
338
|
+
if (
|
|
339
|
+
check_result.returncode == 0
|
|
340
|
+
and utils.run_command(
|
|
341
|
+
["git", "rev-list", "--count", f"HEAD..{tag}"],
|
|
342
|
+
capture_output=True,
|
|
343
|
+
).stdout.strip()
|
|
344
|
+
!= "0"
|
|
345
|
+
):
|
|
339
346
|
return True
|
|
340
347
|
|
|
341
348
|
return False
|
{common_python_tasks-0.10.2 → common_python_tasks-0.10.3}/src/common_python_tasks/project.py
RENAMED
|
@@ -154,7 +154,9 @@ def get_dependency_update_command(
|
|
|
154
154
|
if dependencies is None:
|
|
155
155
|
dependencies = []
|
|
156
156
|
|
|
157
|
-
command = ["uv", "sync"
|
|
157
|
+
command = ["uv", "sync"]
|
|
158
|
+
if not dependencies:
|
|
159
|
+
command.append("--upgrade")
|
|
158
160
|
for dependency in dependencies:
|
|
159
161
|
command.extend(["--upgrade-package", dependency])
|
|
160
162
|
return command
|
|
@@ -430,9 +430,9 @@ def build_image(
|
|
|
430
430
|
dockerfile_hook_path: Optional executable script path that can mutate
|
|
431
431
|
the generated Dockerfile before build. Overrides
|
|
432
432
|
CONTAINER_DOCKERFILE_HOOK_PATH if provided.
|
|
433
|
-
container_env: Builder
|
|
433
|
+
container_env: Builder and runtime environment declarations as repeated
|
|
434
434
|
KEY=VALUE values.
|
|
435
|
-
container_envfile: Optional repeated list of files containing builder
|
|
435
|
+
container_envfile: Optional repeated list of files containing builder and runtime
|
|
436
436
|
environment declarations.
|
|
437
437
|
|
|
438
438
|
Precedence for container env declarations is: .containerenv, container_envfile,
|
|
@@ -524,7 +524,7 @@ def build_image(
|
|
|
524
524
|
)
|
|
525
525
|
if container_env_vars:
|
|
526
526
|
LOGGER.debug(
|
|
527
|
-
"Injecting builder
|
|
527
|
+
"Injecting builder and runtime env vars: %s",
|
|
528
528
|
", ".join(container_env_vars),
|
|
529
529
|
)
|
|
530
530
|
top_level_build_args = inject_auto_build_args_from_env(
|
|
@@ -1731,26 +1731,49 @@ def fastapi_run_db_migrations() -> None:
|
|
|
1731
1731
|
"""Run database migrations."""
|
|
1732
1732
|
from .docker_compose import (
|
|
1733
1733
|
cleanup_temp_files,
|
|
1734
|
+
ensure_secrets_generated,
|
|
1734
1735
|
load_and_prepare_compose,
|
|
1735
1736
|
run_docker_compose_command,
|
|
1736
1737
|
)
|
|
1737
1738
|
|
|
1738
|
-
|
|
1739
|
-
|
|
1739
|
+
container_build = build_image(single_arch=True)
|
|
1740
|
+
ensure_secrets_generated()
|
|
1741
|
+
compose_files, temp_compose_files, temp_config_files, compose_env = (
|
|
1742
|
+
load_and_prepare_compose(image_tag=container_build.commit_tag)
|
|
1743
|
+
)
|
|
1740
1744
|
try:
|
|
1741
|
-
|
|
1745
|
+
run_docker_compose_command(
|
|
1746
|
+
"up",
|
|
1747
|
+
"-d",
|
|
1748
|
+
"--no-build",
|
|
1749
|
+
"db",
|
|
1750
|
+
compose_files=compose_files,
|
|
1751
|
+
compose_env=compose_env,
|
|
1752
|
+
tasks=tasks,
|
|
1753
|
+
)
|
|
1754
|
+
run_docker_compose_command(
|
|
1755
|
+
"run",
|
|
1756
|
+
"--rm",
|
|
1757
|
+
"migrator",
|
|
1758
|
+
compose_files=compose_files,
|
|
1759
|
+
compose_env=compose_env,
|
|
1760
|
+
tasks=tasks,
|
|
1761
|
+
)
|
|
1762
|
+
finally:
|
|
1742
1763
|
try:
|
|
1743
1764
|
run_docker_compose_command(
|
|
1744
|
-
"
|
|
1765
|
+
"rm",
|
|
1766
|
+
"-f",
|
|
1767
|
+
"-s",
|
|
1768
|
+
"-v",
|
|
1769
|
+
"db",
|
|
1745
1770
|
"migrator",
|
|
1746
1771
|
compose_files=compose_files,
|
|
1747
1772
|
compose_env=compose_env,
|
|
1748
1773
|
tasks=tasks,
|
|
1749
1774
|
)
|
|
1750
1775
|
finally:
|
|
1751
|
-
cleanup_temp_files(temp_compose_files)
|
|
1752
|
-
finally:
|
|
1753
|
-
fastapi_stack_down()
|
|
1776
|
+
cleanup_temp_files(temp_compose_files, temp_config_files)
|
|
1754
1777
|
|
|
1755
1778
|
|
|
1756
1779
|
@tasks.script(task_name="db-shell", tags=["web", "containers", "database", "fastapi"])
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{common_python_tasks-0.10.2 → common_python_tasks-0.10.3}/scripts/add_common_python_tasks.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{common_python_tasks-0.10.2 → common_python_tasks-0.10.3}/scripts/update_readme_tasks_table.py
RENAMED
|
File without changes
|
|
File without changes
|
{common_python_tasks-0.10.2 → common_python_tasks-0.10.3}/src/common_python_tasks/__init__.py
RENAMED
|
File without changes
|
{common_python_tasks-0.10.2 → common_python_tasks-0.10.3}/src/common_python_tasks/__main__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|