tempest-fastapi-sdk 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.
- tempest_fastapi_sdk-0.1.0/.github/workflows/ci.yml +89 -0
- tempest_fastapi_sdk-0.1.0/.github/workflows/release-pypi.yml +108 -0
- tempest_fastapi_sdk-0.1.0/.gitignore +22 -0
- tempest_fastapi_sdk-0.1.0/.python-version +1 -0
- tempest_fastapi_sdk-0.1.0/Makefile +101 -0
- tempest_fastapi_sdk-0.1.0/PKG-INFO +1499 -0
- tempest_fastapi_sdk-0.1.0/README.md +1458 -0
- tempest_fastapi_sdk-0.1.0/pyproject.toml +172 -0
- tempest_fastapi_sdk-0.1.0/tempest_fastapi_sdk/__init__.py +110 -0
- tempest_fastapi_sdk-0.1.0/tempest_fastapi_sdk/api/__init__.py +11 -0
- tempest_fastapi_sdk-0.1.0/tempest_fastapi_sdk/api/handlers.py +59 -0
- tempest_fastapi_sdk-0.1.0/tempest_fastapi_sdk/db/__init__.py +14 -0
- tempest_fastapi_sdk-0.1.0/tempest_fastapi_sdk/db/_alembic_templates/__init__.py +1 -0
- tempest_fastapi_sdk-0.1.0/tempest_fastapi_sdk/db/_alembic_templates/env.py.template +73 -0
- tempest_fastapi_sdk-0.1.0/tempest_fastapi_sdk/db/connection.py +257 -0
- tempest_fastapi_sdk-0.1.0/tempest_fastapi_sdk/db/migrations.py +353 -0
- tempest_fastapi_sdk-0.1.0/tempest_fastapi_sdk/db/model.py +249 -0
- tempest_fastapi_sdk-0.1.0/tempest_fastapi_sdk/db/repository.py +716 -0
- tempest_fastapi_sdk-0.1.0/tempest_fastapi_sdk/exceptions/__init__.py +29 -0
- tempest_fastapi_sdk-0.1.0/tempest_fastapi_sdk/exceptions/base.py +66 -0
- tempest_fastapi_sdk-0.1.0/tempest_fastapi_sdk/exceptions/conflict.py +22 -0
- tempest_fastapi_sdk-0.1.0/tempest_fastapi_sdk/exceptions/forbidden.py +18 -0
- tempest_fastapi_sdk-0.1.0/tempest_fastapi_sdk/exceptions/jwt.py +25 -0
- tempest_fastapi_sdk-0.1.0/tempest_fastapi_sdk/exceptions/not_found.py +22 -0
- tempest_fastapi_sdk-0.1.0/tempest_fastapi_sdk/exceptions/unauthorized.py +23 -0
- tempest_fastapi_sdk-0.1.0/tempest_fastapi_sdk/exceptions/upload.py +27 -0
- tempest_fastapi_sdk-0.1.0/tempest_fastapi_sdk/exceptions/validation.py +22 -0
- tempest_fastapi_sdk-0.1.0/tempest_fastapi_sdk/schemas/__init__.py +15 -0
- tempest_fastapi_sdk-0.1.0/tempest_fastapi_sdk/schemas/base.py +64 -0
- tempest_fastapi_sdk-0.1.0/tempest_fastapi_sdk/schemas/pagination.py +132 -0
- tempest_fastapi_sdk-0.1.0/tempest_fastapi_sdk/schemas/response.py +69 -0
- tempest_fastapi_sdk-0.1.0/tempest_fastapi_sdk/settings/__init__.py +7 -0
- tempest_fastapi_sdk-0.1.0/tempest_fastapi_sdk/settings/base.py +43 -0
- tempest_fastapi_sdk-0.1.0/tempest_fastapi_sdk/utils/__init__.py +61 -0
- tempest_fastapi_sdk-0.1.0/tempest_fastapi_sdk/utils/datetime.py +35 -0
- tempest_fastapi_sdk-0.1.0/tempest_fastapi_sdk/utils/dict.py +36 -0
- tempest_fastapi_sdk-0.1.0/tempest_fastapi_sdk/utils/email.py +152 -0
- tempest_fastapi_sdk-0.1.0/tempest_fastapi_sdk/utils/jwt.py +141 -0
- tempest_fastapi_sdk-0.1.0/tempest_fastapi_sdk/utils/password.py +76 -0
- tempest_fastapi_sdk-0.1.0/tempest_fastapi_sdk/utils/regex.py +275 -0
- tempest_fastapi_sdk-0.1.0/tempest_fastapi_sdk/utils/upload.py +197 -0
- tempest_fastapi_sdk-0.1.0/tests/__init__.py +0 -0
- tempest_fastapi_sdk-0.1.0/tests/api/__init__.py +0 -0
- tempest_fastapi_sdk-0.1.0/tests/api/test_handlers.py +58 -0
- tempest_fastapi_sdk-0.1.0/tests/conftest.py +30 -0
- tempest_fastapi_sdk-0.1.0/tests/db/__init__.py +0 -0
- tempest_fastapi_sdk-0.1.0/tests/db/test_connection.py +132 -0
- tempest_fastapi_sdk-0.1.0/tests/db/test_migrations.py +117 -0
- tempest_fastapi_sdk-0.1.0/tests/db/test_model.py +198 -0
- tempest_fastapi_sdk-0.1.0/tests/db/test_repository.py +315 -0
- tempest_fastapi_sdk-0.1.0/tests/exceptions/__init__.py +0 -0
- tempest_fastapi_sdk-0.1.0/tests/exceptions/test_exceptions.py +49 -0
- tempest_fastapi_sdk-0.1.0/tests/schemas/__init__.py +0 -0
- tempest_fastapi_sdk-0.1.0/tests/schemas/test_base.py +53 -0
- tempest_fastapi_sdk-0.1.0/tests/schemas/test_pagination.py +46 -0
- tempest_fastapi_sdk-0.1.0/tests/schemas/test_response.py +35 -0
- tempest_fastapi_sdk-0.1.0/tests/settings/__init__.py +0 -0
- tempest_fastapi_sdk-0.1.0/tests/settings/test_base.py +45 -0
- tempest_fastapi_sdk-0.1.0/tests/utils/__init__.py +0 -0
- tempest_fastapi_sdk-0.1.0/tests/utils/test_datetime.py +33 -0
- tempest_fastapi_sdk-0.1.0/tests/utils/test_dict.py +26 -0
- tempest_fastapi_sdk-0.1.0/tests/utils/test_email.py +141 -0
- tempest_fastapi_sdk-0.1.0/tests/utils/test_jwt.py +84 -0
- tempest_fastapi_sdk-0.1.0/tests/utils/test_password.py +36 -0
- tempest_fastapi_sdk-0.1.0/tests/utils/test_regex.py +207 -0
- tempest_fastapi_sdk-0.1.0/tests/utils/test_upload.py +112 -0
- tempest_fastapi_sdk-0.1.0/uv.lock +910 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
python:
|
|
14
|
+
name: Python ${{ matrix.python-version }}
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
strategy:
|
|
17
|
+
fail-fast: false
|
|
18
|
+
matrix:
|
|
19
|
+
python-version: ["3.13"]
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v4
|
|
22
|
+
|
|
23
|
+
- name: Install uv
|
|
24
|
+
uses: astral-sh/setup-uv@v3
|
|
25
|
+
with:
|
|
26
|
+
enable-cache: true
|
|
27
|
+
|
|
28
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
29
|
+
run: uv python install ${{ matrix.python-version }}
|
|
30
|
+
|
|
31
|
+
- name: Install project with all extras + dev dependencies
|
|
32
|
+
run: uv sync --all-extras
|
|
33
|
+
|
|
34
|
+
- name: Lint
|
|
35
|
+
run: uv run ruff check .
|
|
36
|
+
|
|
37
|
+
- name: Format check
|
|
38
|
+
run: uv run ruff format --check .
|
|
39
|
+
|
|
40
|
+
- name: Type check
|
|
41
|
+
run: uv run mypy tempest_fastapi_sdk
|
|
42
|
+
|
|
43
|
+
- name: Run tests
|
|
44
|
+
run: uv run pytest
|
|
45
|
+
|
|
46
|
+
- name: Build sdist and wheel
|
|
47
|
+
run: uv build
|
|
48
|
+
|
|
49
|
+
- name: Verify distributions
|
|
50
|
+
run: |
|
|
51
|
+
uv tool install twine
|
|
52
|
+
uv tool run twine check dist/*
|
|
53
|
+
|
|
54
|
+
- name: Verify wheel contains package source
|
|
55
|
+
run: |
|
|
56
|
+
python -c "import zipfile, glob; \
|
|
57
|
+
wheel = glob.glob('dist/*.whl')[0]; \
|
|
58
|
+
members = zipfile.ZipFile(wheel).namelist(); \
|
|
59
|
+
py_files = [n for n in members if n.startswith('tempest_fastapi_sdk/') and n.endswith('.py')]; \
|
|
60
|
+
template = [n for n in members if n.endswith('env.py.template')]; \
|
|
61
|
+
print('Python files in wheel:', len(py_files)); \
|
|
62
|
+
print('Alembic templates in wheel:', len(template)); \
|
|
63
|
+
assert len(py_files) >= 20, f'wheel suspiciously empty ({len(py_files)} files)'; \
|
|
64
|
+
assert len(template) == 1, f'env.py.template missing from wheel'; \
|
|
65
|
+
print('OK')"
|
|
66
|
+
|
|
67
|
+
- name: Smoke-install built wheel in a clean venv
|
|
68
|
+
run: |
|
|
69
|
+
uv venv --python ${{ matrix.python-version }} /tmp/smoke-core
|
|
70
|
+
uv pip install --python /tmp/smoke-core/bin/python --quiet dist/*.whl
|
|
71
|
+
/tmp/smoke-core/bin/python -c "import tempest_fastapi_sdk as m; \
|
|
72
|
+
assert m.__version__, 'no __version__'; \
|
|
73
|
+
assert m.BaseModel and m.BaseRepository and m.AsyncDatabaseManager, 'core primitives missing'; \
|
|
74
|
+
assert m.AlembicHelper and m.NAMING_CONVENTION, 'alembic helpers missing'; \
|
|
75
|
+
assert m.AppException and m.NotFoundException and m.ConflictException, 'exceptions missing'; \
|
|
76
|
+
assert m.BaseSchema and m.BaseResponseSchema and m.BasePaginationSchema, 'schemas missing'; \
|
|
77
|
+
assert m.BaseAppSettings, 'settings missing'; \
|
|
78
|
+
assert m.register_exception_handlers, 'api helpers missing'; \
|
|
79
|
+
assert m.is_valid_cpf and m.is_valid_cnpj and m.is_valid_phone_br, 'BR regex helpers missing'; \
|
|
80
|
+
print('Core smoke OK · version =', m.__version__)"
|
|
81
|
+
|
|
82
|
+
- name: Smoke-install with [all] extras and verify utilities
|
|
83
|
+
run: |
|
|
84
|
+
uv venv --python ${{ matrix.python-version }} /tmp/smoke-all
|
|
85
|
+
uv pip install --python /tmp/smoke-all/bin/python --quiet "$(ls dist/*.whl)[all]"
|
|
86
|
+
/tmp/smoke-all/bin/python -c "from tempest_fastapi_sdk import (\
|
|
87
|
+
PasswordUtils, JWTUtils, EmailUtils, UploadUtils); \
|
|
88
|
+
assert PasswordUtils and JWTUtils and EmailUtils and UploadUtils, 'utils missing'; \
|
|
89
|
+
print('Extras smoke OK')"
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
name: Release to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*.*.*"
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
build:
|
|
14
|
+
name: Build distributions
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Install uv
|
|
20
|
+
uses: astral-sh/setup-uv@v3
|
|
21
|
+
with:
|
|
22
|
+
enable-cache: true
|
|
23
|
+
|
|
24
|
+
- name: Set up Python
|
|
25
|
+
run: uv python install 3.13
|
|
26
|
+
|
|
27
|
+
- name: Verify tag matches project version
|
|
28
|
+
run: |
|
|
29
|
+
TAG_VERSION="${GITHUB_REF_NAME#v}"
|
|
30
|
+
PYPROJECT_VERSION=$(python -c "import tomllib; print(tomllib.loads(open('pyproject.toml','rb').read().decode())['project']['version'])")
|
|
31
|
+
PACKAGE_VERSION=$(python -c "import re; print(re.search(r'__version__:\s*str\s*=\s*\"([^\"]+)\"', open('tempest_fastapi_sdk/__init__.py').read()).group(1))")
|
|
32
|
+
echo "Tag: $TAG_VERSION"
|
|
33
|
+
echo "pyproject: $PYPROJECT_VERSION"
|
|
34
|
+
echo "__version__: $PACKAGE_VERSION"
|
|
35
|
+
if [ "$TAG_VERSION" != "$PYPROJECT_VERSION" ] || [ "$TAG_VERSION" != "$PACKAGE_VERSION" ]; then
|
|
36
|
+
echo "Version mismatch — bump pyproject.toml AND tempest_fastapi_sdk/__init__.py to match the tag before retagging."
|
|
37
|
+
exit 1
|
|
38
|
+
fi
|
|
39
|
+
|
|
40
|
+
- name: Install project with all extras
|
|
41
|
+
run: uv sync --all-extras
|
|
42
|
+
|
|
43
|
+
- name: Run full test suite
|
|
44
|
+
run: uv run pytest
|
|
45
|
+
|
|
46
|
+
- name: Lint + format + type check
|
|
47
|
+
run: |
|
|
48
|
+
uv run ruff check .
|
|
49
|
+
uv run ruff format --check .
|
|
50
|
+
uv run mypy tempest_fastapi_sdk
|
|
51
|
+
|
|
52
|
+
- name: Build sdist and wheel
|
|
53
|
+
run: uv build
|
|
54
|
+
|
|
55
|
+
- name: Verify metadata
|
|
56
|
+
run: |
|
|
57
|
+
uv tool install twine
|
|
58
|
+
uv tool run twine check dist/*
|
|
59
|
+
|
|
60
|
+
- name: Verify wheel contains package source
|
|
61
|
+
run: |
|
|
62
|
+
python -c "import zipfile, glob; \
|
|
63
|
+
wheel = glob.glob('dist/*.whl')[0]; \
|
|
64
|
+
members = zipfile.ZipFile(wheel).namelist(); \
|
|
65
|
+
py_files = [n for n in members if n.startswith('tempest_fastapi_sdk/') and n.endswith('.py')]; \
|
|
66
|
+
template = [n for n in members if n.endswith('env.py.template')]; \
|
|
67
|
+
print('Python files in wheel:', len(py_files)); \
|
|
68
|
+
print('Alembic templates in wheel:', len(template)); \
|
|
69
|
+
assert len(py_files) >= 20, f'wheel suspiciously empty ({len(py_files)} files)'; \
|
|
70
|
+
assert len(template) == 1, 'env.py.template missing from wheel'; \
|
|
71
|
+
print('OK')"
|
|
72
|
+
|
|
73
|
+
- name: Smoke-install built wheel in a clean venv
|
|
74
|
+
run: |
|
|
75
|
+
uv venv --python 3.13 /tmp/smoke-venv
|
|
76
|
+
uv pip install --python /tmp/smoke-venv/bin/python --quiet "$(ls dist/*.whl)[all]"
|
|
77
|
+
/tmp/smoke-venv/bin/python -c "import tempest_fastapi_sdk as m; \
|
|
78
|
+
assert m.__version__, 'no __version__'; \
|
|
79
|
+
assert m.BaseModel and m.BaseRepository and m.AsyncDatabaseManager, 'core primitives missing'; \
|
|
80
|
+
assert m.AlembicHelper and m.NAMING_CONVENTION, 'alembic helpers missing'; \
|
|
81
|
+
assert m.PasswordUtils and m.JWTUtils and m.EmailUtils and m.UploadUtils, 'utils missing'; \
|
|
82
|
+
assert m.is_valid_cpf and m.is_valid_cnpj and m.is_valid_phone_br, 'BR regex helpers missing'; \
|
|
83
|
+
print('Smoke OK · version =', m.__version__)"
|
|
84
|
+
|
|
85
|
+
- name: Upload distributions artifact
|
|
86
|
+
uses: actions/upload-artifact@v4
|
|
87
|
+
with:
|
|
88
|
+
name: python-dist
|
|
89
|
+
path: dist/
|
|
90
|
+
|
|
91
|
+
publish:
|
|
92
|
+
name: Publish to PyPI
|
|
93
|
+
needs: build
|
|
94
|
+
runs-on: ubuntu-latest
|
|
95
|
+
environment:
|
|
96
|
+
name: pypi
|
|
97
|
+
url: https://pypi.org/p/tempest-fastapi-sdk
|
|
98
|
+
permissions:
|
|
99
|
+
id-token: write
|
|
100
|
+
steps:
|
|
101
|
+
- name: Download distributions artifact
|
|
102
|
+
uses: actions/download-artifact@v4
|
|
103
|
+
with:
|
|
104
|
+
name: python-dist
|
|
105
|
+
path: dist
|
|
106
|
+
|
|
107
|
+
- name: Publish to PyPI (Trusted Publishing)
|
|
108
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Python-generated files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[oc]
|
|
4
|
+
build/
|
|
5
|
+
dist/
|
|
6
|
+
wheels/
|
|
7
|
+
*.egg-info
|
|
8
|
+
|
|
9
|
+
# Virtual environments
|
|
10
|
+
.venv
|
|
11
|
+
|
|
12
|
+
# Test + tooling caches
|
|
13
|
+
.coverage
|
|
14
|
+
.coverage.*
|
|
15
|
+
htmlcov/
|
|
16
|
+
.pytest_cache/
|
|
17
|
+
.mypy_cache/
|
|
18
|
+
.ruff_cache/
|
|
19
|
+
|
|
20
|
+
# Editor
|
|
21
|
+
.vscode/
|
|
22
|
+
.idea/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.13
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# tempest-fastapi-sdk — developer & release automation.
|
|
2
|
+
#
|
|
3
|
+
# Run `make` (or `make help`) to see every target.
|
|
4
|
+
# Override defaults: `make release VERSION=0.2.0`.
|
|
5
|
+
|
|
6
|
+
PACKAGE := tempest_fastapi_sdk
|
|
7
|
+
PYTHON_VERSION := 3.13
|
|
8
|
+
|
|
9
|
+
.DEFAULT_GOAL := help
|
|
10
|
+
.PHONY: help install sync clean test cov lint fmt fmt-check type check ci build smoke release tag version
|
|
11
|
+
|
|
12
|
+
help: ## List available targets
|
|
13
|
+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
|
|
14
|
+
| awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-14s\033[0m %s\n", $$1, $$2}'
|
|
15
|
+
|
|
16
|
+
## ---------- setup ----------
|
|
17
|
+
|
|
18
|
+
install: ## Sync dependencies with all extras (auth, email, upload)
|
|
19
|
+
uv sync --all-extras
|
|
20
|
+
|
|
21
|
+
sync: install ## Alias for `install`
|
|
22
|
+
|
|
23
|
+
## ---------- code quality ----------
|
|
24
|
+
|
|
25
|
+
test: ## Run pytest with coverage
|
|
26
|
+
uv run pytest
|
|
27
|
+
|
|
28
|
+
cov: ## Open the last coverage HTML report (run `pytest --cov-report=html` first)
|
|
29
|
+
@command -v xdg-open >/dev/null && xdg-open htmlcov/index.html || open htmlcov/index.html
|
|
30
|
+
|
|
31
|
+
lint: ## Run ruff lint
|
|
32
|
+
uv run ruff check .
|
|
33
|
+
|
|
34
|
+
fmt: ## Auto-format with ruff
|
|
35
|
+
uv run ruff format .
|
|
36
|
+
|
|
37
|
+
fmt-check: ## Verify formatting without modifying files
|
|
38
|
+
uv run ruff format --check .
|
|
39
|
+
|
|
40
|
+
type: ## Run mypy in strict mode
|
|
41
|
+
uv run mypy $(PACKAGE)
|
|
42
|
+
|
|
43
|
+
check: lint fmt-check type test ## Run every gate (lint + format check + mypy + tests)
|
|
44
|
+
|
|
45
|
+
ci: check build smoke ## Full local mirror of the GitHub Actions pipeline
|
|
46
|
+
|
|
47
|
+
## ---------- packaging ----------
|
|
48
|
+
|
|
49
|
+
build: ## Build sdist + wheel into dist/
|
|
50
|
+
rm -rf dist
|
|
51
|
+
uv build
|
|
52
|
+
|
|
53
|
+
smoke: build ## Install the freshly built wheel in a clean venv and import the top-level surface
|
|
54
|
+
@rm -rf /tmp/$(PACKAGE)-smoke
|
|
55
|
+
uv venv --python $(PYTHON_VERSION) /tmp/$(PACKAGE)-smoke
|
|
56
|
+
uv pip install --python /tmp/$(PACKAGE)-smoke/bin/python --quiet "$$(ls dist/*.whl)[all]"
|
|
57
|
+
/tmp/$(PACKAGE)-smoke/bin/python -c "import $(PACKAGE) as m; \
|
|
58
|
+
assert m.__version__, 'no __version__'; \
|
|
59
|
+
assert m.BaseModel and m.BaseRepository and m.AsyncDatabaseManager, 'core primitives missing'; \
|
|
60
|
+
assert m.AlembicHelper and m.NAMING_CONVENTION, 'alembic helpers missing'; \
|
|
61
|
+
assert m.PasswordUtils and m.JWTUtils and m.EmailUtils and m.UploadUtils, 'utils missing'; \
|
|
62
|
+
assert m.is_valid_cpf and m.is_valid_cnpj and m.is_valid_phone_br, 'BR regex helpers missing'; \
|
|
63
|
+
print('Smoke OK · version =', m.__version__)"
|
|
64
|
+
@rm -rf /tmp/$(PACKAGE)-smoke
|
|
65
|
+
|
|
66
|
+
version: ## Print the version recorded in pyproject.toml and __init__.py
|
|
67
|
+
@printf "pyproject.toml: "
|
|
68
|
+
@grep -E '^version =' pyproject.toml | head -1
|
|
69
|
+
@printf "__init__.py: "
|
|
70
|
+
@grep -E "^__version__" $(PACKAGE)/__init__.py | head -1
|
|
71
|
+
|
|
72
|
+
## ---------- release ----------
|
|
73
|
+
|
|
74
|
+
tag: ## Tag the current commit with the project version (no push)
|
|
75
|
+
@VER=$$(grep -E '^version =' pyproject.toml | head -1 | sed -E 's/.*"([^"]+)".*/\1/'); \
|
|
76
|
+
git tag "v$$VER" && echo "Tagged v$$VER (run \`git push origin v$$VER\` when ready)"
|
|
77
|
+
|
|
78
|
+
release: ## Bump versions, commit, tag and push. Usage: make release VERSION=0.2.0
|
|
79
|
+
@test -n "$(VERSION)" || (echo "Usage: make release VERSION=0.2.0"; exit 1)
|
|
80
|
+
@if [ -n "$$(git status --porcelain)" ]; then \
|
|
81
|
+
echo "Working tree dirty. Commit or stash first."; exit 1; \
|
|
82
|
+
fi
|
|
83
|
+
@echo "Bumping pyproject.toml and $(PACKAGE)/__init__.py to $(VERSION)"
|
|
84
|
+
sed -i -E 's/^version = "[^"]+"/version = "$(VERSION)"/' pyproject.toml
|
|
85
|
+
sed -i -E 's/^__version__: str = "[^"]+"/__version__: str = "$(VERSION)"/' $(PACKAGE)/__init__.py
|
|
86
|
+
$(MAKE) check
|
|
87
|
+
git add pyproject.toml $(PACKAGE)/__init__.py
|
|
88
|
+
git commit -m "chore: release v$(VERSION)"
|
|
89
|
+
git tag "v$(VERSION)"
|
|
90
|
+
@echo
|
|
91
|
+
@echo "Ready to push. Review with \`git show v$(VERSION)\` then:"
|
|
92
|
+
@echo " git push origin main"
|
|
93
|
+
@echo " git push origin v$(VERSION)"
|
|
94
|
+
|
|
95
|
+
## ---------- housekeeping ----------
|
|
96
|
+
|
|
97
|
+
clean: ## Remove caches, build artifacts and coverage data
|
|
98
|
+
rm -rf dist build *.egg-info
|
|
99
|
+
rm -rf .pytest_cache .mypy_cache .ruff_cache htmlcov
|
|
100
|
+
rm -f .coverage .coverage.*
|
|
101
|
+
find . -type d -name __pycache__ -prune -exec rm -rf {} +
|