ebump 0.2.2__tar.gz → 0.2.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.
- ebump-0.2.3/.env.test +1 -0
- ebump-0.2.3/.github/workflows/qa.yml +14 -0
- ebump-0.2.3/.github/workflows/release.yml +40 -0
- ebump-0.2.3/.gitignore +220 -0
- ebump-0.2.3/.pre-commit-config.yaml +23 -0
- ebump-0.2.3/.python-version +1 -0
- ebump-0.2.3/AGENTS.md +47 -0
- ebump-0.2.3/CODEOWNERS +1 -0
- ebump-0.2.3/DEVELOPMENT.md +319 -0
- ebump-0.2.3/Makefile +51 -0
- {ebump-0.2.2 → ebump-0.2.3}/PKG-INFO +57 -27
- ebump-0.2.2/src/ebump.egg-info/PKG-INFO → ebump-0.2.3/README.md +52 -32
- ebump-0.2.3/assets/logo.svg +4 -0
- {ebump-0.2.2 → ebump-0.2.3}/pyproject.toml +48 -35
- ebump-0.2.3/scripts/create_remote.py +230 -0
- ebump-0.2.3/scripts/worktree.sh +225 -0
- ebump-0.2.3/src/ebump/__init__.py +1 -0
- {ebump-0.2.2 → ebump-0.2.3}/src/ebump/bump.py +5 -12
- {ebump-0.2.2 → ebump-0.2.3}/src/ebump/config.py +3 -9
- {ebump-0.2.2 → ebump-0.2.3}/src/ebump/main.py +4 -3
- {ebump-0.2.2 → ebump-0.2.3}/src/ebump/rewrite.py +9 -15
- {ebump-0.2.2 → ebump-0.2.3}/src/ebump/version.py +5 -3
- ebump-0.2.3/tests/conftest.py +107 -0
- {ebump-0.2.2 → ebump-0.2.3}/tests/test_cli.py +1 -4
- {ebump-0.2.2 → ebump-0.2.3}/tests/test_config.py +3 -7
- {ebump-0.2.2 → ebump-0.2.3}/tests/test_patterns.py +1 -3
- {ebump-0.2.2 → ebump-0.2.3}/tests/test_version.py +1 -1
- ebump-0.2.3/uv.lock +702 -0
- ebump-0.2.2/README.md +0 -130
- ebump-0.2.2/setup.cfg +0 -4
- ebump-0.2.2/src/ebump/__init__.py +0 -1
- ebump-0.2.2/src/ebump.egg-info/SOURCES.txt +0 -21
- ebump-0.2.2/src/ebump.egg-info/dependency_links.txt +0 -1
- ebump-0.2.2/src/ebump.egg-info/entry_points.txt +0 -2
- ebump-0.2.2/src/ebump.egg-info/top_level.txt +0 -1
- {ebump-0.2.2 → ebump-0.2.3}/LICENSE +0 -0
- {ebump-0.2.2 → ebump-0.2.3}/src/ebump/py.typed +0 -0
- {ebump-0.2.2 → ebump-0.2.3}/src/ebump/utils.py +0 -0
- {ebump-0.2.2 → ebump-0.2.3}/tests/test_rewrite.py +0 -0
ebump-0.2.3/.env.test
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# ebump reads no environment variables; the test suite loads this file through pytest-env.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
name: QA
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
push:
|
|
6
|
+
branches: [main]
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
qa:
|
|
10
|
+
uses: gvieralopez/cookie-pyrate/.github/workflows/reusable-qa.yml@v1.1.0
|
|
11
|
+
with:
|
|
12
|
+
cookie-pyrate-ref: v1.1.0
|
|
13
|
+
python-version: "3.11"
|
|
14
|
+
test-python-versions: '["3.12", "3.13", "3.14", "3.15"]'
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_run:
|
|
5
|
+
workflows: ["QA"]
|
|
6
|
+
branches: [main]
|
|
7
|
+
types: [completed]
|
|
8
|
+
|
|
9
|
+
concurrency:
|
|
10
|
+
group: release
|
|
11
|
+
cancel-in-progress: false
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
release:
|
|
15
|
+
if: github.event.workflow_run.conclusion == 'success'
|
|
16
|
+
uses: gvieralopez/cookie-pyrate/.github/workflows/reusable-release.yml@v1.1.0
|
|
17
|
+
permissions:
|
|
18
|
+
contents: write
|
|
19
|
+
with:
|
|
20
|
+
cookie-pyrate-ref: v1.1.0
|
|
21
|
+
create-github-release: true
|
|
22
|
+
attach-distribution: false
|
|
23
|
+
prepare-next-version: true
|
|
24
|
+
secrets:
|
|
25
|
+
# Created by `make repo`; lets the version bumps land on a protected main.
|
|
26
|
+
RELEASE_SSH_KEY: ${{ secrets.RELEASE_SSH_KEY }}
|
|
27
|
+
|
|
28
|
+
pypi:
|
|
29
|
+
needs: release
|
|
30
|
+
runs-on: ubuntu-latest
|
|
31
|
+
environment:
|
|
32
|
+
name: pypi
|
|
33
|
+
url: https://pypi.org/project/ebump/
|
|
34
|
+
permissions:
|
|
35
|
+
contents: read
|
|
36
|
+
id-token: write
|
|
37
|
+
steps:
|
|
38
|
+
- uses: gvieralopez/cookie-pyrate/.github/actions/publish-to-pypi@v1.1.0
|
|
39
|
+
with:
|
|
40
|
+
sha: ${{ needs.release.outputs.sha }}
|
ebump-0.2.3/.gitignore
ADDED
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py.cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
#Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# UV
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
# uv.lock is intentionally committed for reproducible environments.
|
|
102
|
+
|
|
103
|
+
# poetry
|
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
106
|
+
# commonly ignored for libraries.
|
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
108
|
+
#poetry.lock
|
|
109
|
+
#poetry.toml
|
|
110
|
+
|
|
111
|
+
# pdm
|
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
113
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
114
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
115
|
+
#pdm.lock
|
|
116
|
+
#pdm.toml
|
|
117
|
+
.pdm-python
|
|
118
|
+
.pdm-build/
|
|
119
|
+
|
|
120
|
+
# pixi
|
|
121
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
122
|
+
#pixi.lock
|
|
123
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
124
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
125
|
+
.pixi
|
|
126
|
+
|
|
127
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
128
|
+
__pypackages__/
|
|
129
|
+
|
|
130
|
+
# Celery stuff
|
|
131
|
+
celerybeat-schedule
|
|
132
|
+
celerybeat.pid
|
|
133
|
+
|
|
134
|
+
# Redis
|
|
135
|
+
*.rdb
|
|
136
|
+
*.aof
|
|
137
|
+
*.pid
|
|
138
|
+
|
|
139
|
+
# RabbitMQ
|
|
140
|
+
mnesia/
|
|
141
|
+
rabbitmq/
|
|
142
|
+
rabbitmq-data/
|
|
143
|
+
|
|
144
|
+
# ActiveMQ
|
|
145
|
+
activemq-data/
|
|
146
|
+
|
|
147
|
+
# SageMath parsed files
|
|
148
|
+
*.sage.py
|
|
149
|
+
|
|
150
|
+
# Environments
|
|
151
|
+
.env
|
|
152
|
+
.envrc
|
|
153
|
+
.venv
|
|
154
|
+
env/
|
|
155
|
+
venv/
|
|
156
|
+
ENV/
|
|
157
|
+
env.bak/
|
|
158
|
+
venv.bak/
|
|
159
|
+
|
|
160
|
+
# Spyder project settings
|
|
161
|
+
.spyderproject
|
|
162
|
+
.spyproject
|
|
163
|
+
|
|
164
|
+
# Rope project settings
|
|
165
|
+
.ropeproject
|
|
166
|
+
|
|
167
|
+
# mkdocs documentation
|
|
168
|
+
/site
|
|
169
|
+
|
|
170
|
+
# mypy
|
|
171
|
+
.mypy_cache/
|
|
172
|
+
.dmypy.json
|
|
173
|
+
dmypy.json
|
|
174
|
+
|
|
175
|
+
# Pyre type checker
|
|
176
|
+
.pyre/
|
|
177
|
+
|
|
178
|
+
# pytype static type analyzer
|
|
179
|
+
.pytype/
|
|
180
|
+
|
|
181
|
+
# Cython debug symbols
|
|
182
|
+
cython_debug/
|
|
183
|
+
|
|
184
|
+
# PyCharm
|
|
185
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
186
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
187
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
188
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
189
|
+
.idea/
|
|
190
|
+
|
|
191
|
+
# Abstra
|
|
192
|
+
# Abstra is an AI-powered process automation framework.
|
|
193
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
194
|
+
# Learn more at https://abstra.io/docs
|
|
195
|
+
.abstra/
|
|
196
|
+
|
|
197
|
+
# Visual Studio Code
|
|
198
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
199
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
200
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
201
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
202
|
+
.vscode/
|
|
203
|
+
|
|
204
|
+
# Ruff stuff:
|
|
205
|
+
.ruff_cache/
|
|
206
|
+
|
|
207
|
+
# PyPI configuration file
|
|
208
|
+
.pypirc
|
|
209
|
+
|
|
210
|
+
# Marimo
|
|
211
|
+
marimo/_static/
|
|
212
|
+
marimo/_lsp/
|
|
213
|
+
__marimo__/
|
|
214
|
+
|
|
215
|
+
# Streamlit
|
|
216
|
+
.streamlit/secrets.toml
|
|
217
|
+
|
|
218
|
+
# Checkout of the shared Cookie Pyrate actions, made by the CI workflows in the
|
|
219
|
+
# workspace root. It is a separate repository and is linted where it lives.
|
|
220
|
+
.cookie-pyrate/
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: local
|
|
3
|
+
hooks:
|
|
4
|
+
- id: lint
|
|
5
|
+
name: Ruff Lint
|
|
6
|
+
entry: make lint
|
|
7
|
+
language: system
|
|
8
|
+
types: [python]
|
|
9
|
+
pass_filenames: false
|
|
10
|
+
|
|
11
|
+
- id: format
|
|
12
|
+
name: Ruff Format
|
|
13
|
+
entry: make format
|
|
14
|
+
language: system
|
|
15
|
+
types: [python]
|
|
16
|
+
pass_filenames: false
|
|
17
|
+
|
|
18
|
+
- id: typecheck
|
|
19
|
+
name: Mypy Typecheck
|
|
20
|
+
entry: make typecheck
|
|
21
|
+
language: system
|
|
22
|
+
types: [python]
|
|
23
|
+
pass_filenames: false
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.11
|
ebump-0.2.3/AGENTS.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# ebump
|
|
2
|
+
|
|
3
|
+
Easy version bumping
|
|
4
|
+
|
|
5
|
+
Style, conventions and tooling for this project.
|
|
6
|
+
|
|
7
|
+
## Layout
|
|
8
|
+
|
|
9
|
+
1. `src/ebump/{models,errors,main}.py`; sub-domains as sub-packages (e.g. `validation/`).
|
|
10
|
+
2. Data structures live in `models.py`, error types in `errors.py`, unless the framework in use recommends a different file structure.
|
|
11
|
+
3. Order functions top-down — callers before callees, private helpers (`_name`) last — so the most important read first.
|
|
12
|
+
4. Do not write docstrings or descriptive comments unless the user asks for them or they provide context that cannot be inferred by reading the code.
|
|
13
|
+
|
|
14
|
+
## Design
|
|
15
|
+
|
|
16
|
+
1. Prefer immutable dataclasses for plain data: `@dataclass(frozen=True)` (add `slots=True` when it fits).
|
|
17
|
+
2. Where a framework owns the type — ORM entities, pydantic models, settings objects — follow its idiom instead of forcing a dataclass.
|
|
18
|
+
3. Avoid default arguments in functions.
|
|
19
|
+
4. If a function takes a bool that drives an `if`, prefer splitting into two functions (one delegating to the other, or factoring out shared logic when it saves ≥2 LoC).
|
|
20
|
+
|
|
21
|
+
## Hygiene
|
|
22
|
+
|
|
23
|
+
1. No commented-out code.
|
|
24
|
+
2. Every `# noqa` must specify a rule code, e.g. `# noqa: E501` and should be avoided unless the user asks for it.
|
|
25
|
+
3. Serialise JSON with `indent=2`.
|
|
26
|
+
4. Wrap any disk I/O in `TemporaryDirectory()` and operate via `Path` objects.
|
|
27
|
+
|
|
28
|
+
## Python
|
|
29
|
+
|
|
30
|
+
1. Always use f-strings, `pathlib`, and idiomatic constructs.
|
|
31
|
+
2. Avoid `open()` for reading or writing — use `Path.read_text()` / `Path.write_text()` / `Path.read_bytes()` / `Path.write_bytes()` (ruff `PTH`).
|
|
32
|
+
3. Never use `print` outside `scripts/`. Use `logger = logging.getLogger(__name__)` at module level (ruff `T20`).
|
|
33
|
+
4. Annotate everything; mypy runs with `disallow_untyped_defs = true`. Use modern typing (`list[...]`, `dict[...]`, `X | None`, `collections.abc.MutableMapping`, etc.).
|
|
34
|
+
|
|
35
|
+
## Tests
|
|
36
|
+
|
|
37
|
+
1. Function-based pytest with `@pytest.mark.parametrize`. No test classes.
|
|
38
|
+
2. The test tree mirrors the package tree: a module at `validation/rules.py` is tested by `tests/validation/test_rules.py`.
|
|
39
|
+
3. Shared fixtures, env dicts and fixture-path constants live in `tests/conftest.py`. Test data under `tests/data/` or `tests/fixtures/`.
|
|
40
|
+
4. `.env.test` holds the suite's baseline environment; `pytest-env` loads it before collection. Override a single variable in a single test with `monkeypatch.setenv` / `monkeypatch.delenv` — never assign to `os.environ` directly, so nothing leaks between tests.
|
|
41
|
+
5. Don't lower the `--cov-fail-under` threshold configured in `pyproject.toml`; add tests instead.
|
|
42
|
+
|
|
43
|
+
## Tooling
|
|
44
|
+
|
|
45
|
+
1. Use **ruff + mypy + pytest** with **uv**.
|
|
46
|
+
2. Standard QA invocation: `make qa` — it covers lint, format, type checks and tests. `make test` runs the suite on its own.
|
|
47
|
+
3. Never call `python3` directly in agent scripts; use `uv run` so inline script metadata can declare dependencies.
|
ebump-0.2.3/CODEOWNERS
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
* @jmorgadov @gvieralopez
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
# Development Guide
|
|
2
|
+
|
|
3
|
+
## Prerequisites
|
|
4
|
+
|
|
5
|
+
Before developing this project, ensure you have the following installed:
|
|
6
|
+
|
|
7
|
+
### [uv](https://docs.astral.sh/uv/)
|
|
8
|
+
Python project and environment management.
|
|
9
|
+
Install: [uv docs](https://docs.astral.sh/uv/getting-started/installation/)
|
|
10
|
+
|
|
11
|
+
### [make](https://www.gnu.org/software/make/)
|
|
12
|
+
Run common project tasks via the `Makefile`.
|
|
13
|
+
|
|
14
|
+
#### macOS
|
|
15
|
+
```sh
|
|
16
|
+
xcode-select --install
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
#### Windows
|
|
20
|
+
```powershell
|
|
21
|
+
choco install make
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
#### Linux
|
|
25
|
+
Usually pre-installed. If not:
|
|
26
|
+
```sh
|
|
27
|
+
sudo apt install build-essential # Debian/Ubuntu
|
|
28
|
+
sudo dnf groupinstall "Development Tools" # Fedora
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### [git](https://git-scm.com/downloads)
|
|
32
|
+
Version control, and what `make repo` uses to initialise the repository.
|
|
33
|
+
|
|
34
|
+
### [GitHub CLI](https://cli.github.com)
|
|
35
|
+
Lets `make repo` create the GitHub remote and apply the branch policies.
|
|
36
|
+
Authenticate once with `gh auth login`.
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
## Installation in development mode
|
|
40
|
+
|
|
41
|
+
Install all dependencies including development tools:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
uv sync
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
This creates a `.venv` folder and installs the project and default development
|
|
48
|
+
dependencies from `pyproject.toml` and the committed `uv.lock` file. After changing
|
|
49
|
+
dependencies, use `uv add`/`uv remove`, then run `uv lock` and commit the lockfile.
|
|
50
|
+
|
|
51
|
+
Activate the environment:
|
|
52
|
+
|
|
53
|
+
* **Linux / macOS (bash/zsh):**
|
|
54
|
+
```bash
|
|
55
|
+
source .venv/bin/activate
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
* **Windows (PowerShell):**
|
|
59
|
+
```powershell
|
|
60
|
+
.venv\Scripts\Activate.ps1
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
* **Windows (cmd.exe):**
|
|
64
|
+
```cmd
|
|
65
|
+
.venv\Scripts\activate.bat
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Development Tasks
|
|
69
|
+
|
|
70
|
+
All tasks are defined in the `Makefile` for convenience.
|
|
71
|
+
|
|
72
|
+
### Running the Full Quality Gate
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
make qa
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Runs **Ruff** for linting and formatting, **Mypy** for type checking, and **Pytest** for
|
|
79
|
+
the test suite. Each stage is also available on its own: `make lint`, `make format`,
|
|
80
|
+
`make typecheck` and `make test`.
|
|
81
|
+
|
|
82
|
+
### Running Unit Tests
|
|
83
|
+
|
|
84
|
+
Before running tests, configure environment variables in `.env.test` if needed.
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
make test
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Executes the test suite using **Pytest**, without the lint, format and type checks.
|
|
91
|
+
|
|
92
|
+
### Creating the Repository
|
|
93
|
+
|
|
94
|
+
Initialise the local repository and create its first commit on `main`:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
make repo
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
The same command then creates the GitHub remote, pushes `main`, and applies the branch
|
|
101
|
+
policies. The remote is private by default; to make it public:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
make repo REPO_ARGS=--public
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
To create it under an organization instead of your own account:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
make repo REPO_ARGS="--owner my-org"
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
The README's badges link to your own account; for an organization, replace your username with
|
|
114
|
+
the organization in those links.
|
|
115
|
+
|
|
116
|
+
`main` is protected: changes land through pull requests, merged with a merge commit, once all
|
|
117
|
+
review conversations are resolved, the branch is up to date with `main`, and the `qa / Run QA`
|
|
118
|
+
check is green. No approval is required, except a code owner's when the project has a
|
|
119
|
+
`CODEOWNERS` file; new pushes dismiss earlier approvals. Force pushes and branch deletion are
|
|
120
|
+
rejected. Repository admins and the release deploy key can bypass these rules; the key is how
|
|
121
|
+
the release workflow pushes its version bumps.
|
|
122
|
+
|
|
123
|
+
Branch rulesets are a paid GitHub feature on private repositories. On a free plan the
|
|
124
|
+
command says so, leaves `main` unprotected and finishes the rest; make the repository
|
|
125
|
+
public or upgrade the plan, then re-run `make repo` to apply the policies.
|
|
126
|
+
|
|
127
|
+
It also turns on Dependabot alerts and security updates: when a version pinned in `uv.lock`
|
|
128
|
+
has a published advisory, Dependabot opens a pull request that moves it to a fixed version.
|
|
129
|
+
Routine version updates stay off, since every merge to `main` cuts a release.
|
|
130
|
+
|
|
131
|
+
The local steps need only git; the remote ones need the
|
|
132
|
+
[GitHub CLI](https://cli.github.com) authenticated with `gh auth login`. Without it the
|
|
133
|
+
local repository is still created and nothing is pushed.
|
|
134
|
+
|
|
135
|
+
The command is safe to re-run: each step is skipped if it is already done, so an
|
|
136
|
+
interrupted run can be finished by running it again.
|
|
137
|
+
|
|
138
|
+
### Migrating to Git Worktrees
|
|
139
|
+
|
|
140
|
+
Migrate the repository to a shared bare-repository layout:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
make worktree
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
This creates `.bare` for the shared Git history and a directory for the current
|
|
147
|
+
branch. If the current branch is not the remote default branch, a second directory
|
|
148
|
+
is created for that default branch. The converted repository root contains only
|
|
149
|
+
`.bare`, the `.git` pointer, and the worktree directories. Before converting, it
|
|
150
|
+
copies the complete original repository, including `.git`, to a sibling directory
|
|
151
|
+
named `<repo-name>-legacy-bak`, restores the original files to the current branch
|
|
152
|
+
worktree, and refuses to overwrite an existing backup or worktree layout. If the
|
|
153
|
+
migration fails, the original repository is restored and the temporary backup is
|
|
154
|
+
removed.
|
|
155
|
+
|
|
156
|
+
### Building the Project
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
make build
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Generates a distribution package in the `dist/` directory.
|
|
163
|
+
|
|
164
|
+
### Releasing
|
|
165
|
+
|
|
166
|
+
Every push to `main` that passes QA cuts a release: the version is finalized,
|
|
167
|
+
tagged, and `main` is bumped to the next prerelease. You can control the release
|
|
168
|
+
process with the following options on the `.github/workflows/release.yml` workflow:
|
|
169
|
+
|
|
170
|
+
- `create-github-release` (on by default) — cuts a GitHub release for the new tag.
|
|
171
|
+
- `attach-distribution` (off by default) — builds the distribution and attaches it to the
|
|
172
|
+
GitHub release as downloadable files. Requires `create-github-release` to also be on.
|
|
173
|
+
- `prepare-next-version` (on by default) — bumps `main` to the next prerelease once the
|
|
174
|
+
release is out.
|
|
175
|
+
|
|
176
|
+
#### Publishing to PyPI
|
|
177
|
+
|
|
178
|
+
Set up Trusted Publishing so no API token has to be stored as a secret:
|
|
179
|
+
|
|
180
|
+
1. Go to <https://pypi.org/manage/account/publishing/> (for a project already on PyPI, its own
|
|
181
|
+
"Publishing" settings)
|
|
182
|
+
2. Add a GitHub publisher with this repository, the workflow name `release.yml` and the
|
|
183
|
+
environment name `pypi`
|
|
184
|
+
3. Save. PyPI will now trust publish requests coming from that workflow.
|
|
185
|
+
|
|
186
|
+
Then add a `pypi` job to `.github/workflows/release.yml`, next to the `release` job:
|
|
187
|
+
|
|
188
|
+
```yaml
|
|
189
|
+
pypi:
|
|
190
|
+
needs: release
|
|
191
|
+
runs-on: ubuntu-latest
|
|
192
|
+
environment:
|
|
193
|
+
name: pypi
|
|
194
|
+
url: https://pypi.org/project/ebump/
|
|
195
|
+
permissions:
|
|
196
|
+
contents: read
|
|
197
|
+
id-token: write
|
|
198
|
+
steps:
|
|
199
|
+
- uses: gvieralopez/cookie-pyrate/.github/actions/publish-to-pypi@v1.1.0
|
|
200
|
+
with:
|
|
201
|
+
sha: ${{ needs.release.outputs.sha }}
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
The job has to live in this file: PyPI only trusts the workflow file that defines the uploading
|
|
205
|
+
job, so the upload can't happen inside the reusable release. The action builds the released
|
|
206
|
+
commit and uploads it. It runs once the release is out, so if the upload fails the GitHub release
|
|
207
|
+
is already published: re-run the failed `pypi` job; files PyPI already has are skipped.
|
|
208
|
+
|
|
209
|
+
To try it on TestPyPI first, register the publisher on <https://test.pypi.org> instead and add
|
|
210
|
+
`index: testpypi` under `with:`. A build that needs `system-dependencies` or a `setup-command`
|
|
211
|
+
takes them under `with:` too; secrets the setup command needs go in the step's `env:`.
|
|
212
|
+
|
|
213
|
+
#### Extra release files
|
|
214
|
+
|
|
215
|
+
Files the reusable release doesn't build (executables, wheels compiled per OS, PDFs, archives)
|
|
216
|
+
come from jobs you add to `.github/workflows/release.yml`, after the `release` job. It hands them
|
|
217
|
+
the released `version`, `tag` and `sha`, so they build exactly the released commit and attach to
|
|
218
|
+
exactly that release:
|
|
219
|
+
|
|
220
|
+
```yaml
|
|
221
|
+
windows-exe:
|
|
222
|
+
needs: release
|
|
223
|
+
runs-on: windows-latest
|
|
224
|
+
permissions:
|
|
225
|
+
contents: write
|
|
226
|
+
steps:
|
|
227
|
+
- uses: actions/checkout@v7
|
|
228
|
+
with:
|
|
229
|
+
ref: ${{ needs.release.outputs.sha }}
|
|
230
|
+
# ...build the files into dist/...
|
|
231
|
+
- uses: softprops/action-gh-release@v3
|
|
232
|
+
with:
|
|
233
|
+
tag_name: ${{ needs.release.outputs.tag }}
|
|
234
|
+
files: dist/*.exe
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
The release is already published when these jobs start, so its extra files appear a few
|
|
238
|
+
minutes later.
|
|
239
|
+
|
|
240
|
+
### Extra CI steps
|
|
241
|
+
|
|
242
|
+
The reusable workflows take two optional inputs for what lint, types and tests don't cover.
|
|
243
|
+
Add them under `with:` in `.github/workflows/qa.yml` (`setup-command` also in `release.yml`):
|
|
244
|
+
|
|
245
|
+
- `setup-command`: bash run before the dependencies are installed, for files the install needs,
|
|
246
|
+
such as the wheels of a private dependency. In releases it also runs before the distribution
|
|
247
|
+
and the Docker image are built.
|
|
248
|
+
- `extra-checks`: bash run after the tests; a failure fails QA. For example import contracts
|
|
249
|
+
(`uv run lint-imports`) or a strict docs build.
|
|
250
|
+
|
|
251
|
+
A setup command that needs secrets gets them through the `SETUP_ENV` secret: `NAME=value`
|
|
252
|
+
lines, one per variable, that the calling job builds from the repository's own secrets. Each
|
|
253
|
+
value is masked in the logs and set as an environment variable for the setup command only; the
|
|
254
|
+
install, checks, tests and builds that follow don't see it. Values are single lines.
|
|
255
|
+
`secrets: inherit` doesn't work here: GitHub only passes inherited secrets to workflows of the
|
|
256
|
+
same account or organization, and these live in `gvieralopez/cookie-pyrate`. The secrets you
|
|
257
|
+
pass run through Cookie Pyrate's code at the version you pin.
|
|
258
|
+
|
|
259
|
+
Dependabot's pull requests only get Dependabot secrets, so a secret QA needs must also be added
|
|
260
|
+
as a Dependabot secret (`gh secret set NAME --app dependabot`), or its security fixes fail QA.
|
|
261
|
+
In an organization, set it once as an organization secret for both Actions and Dependabot.
|
|
262
|
+
|
|
263
|
+
```yaml
|
|
264
|
+
jobs:
|
|
265
|
+
qa:
|
|
266
|
+
uses: gvieralopez/cookie-pyrate/.github/workflows/reusable-qa.yml@v1.1.0
|
|
267
|
+
with:
|
|
268
|
+
cookie-pyrate-ref: v1.1.0
|
|
269
|
+
python-version: "3.11"
|
|
270
|
+
setup-command: uv run --no-project --with requests scripts/download_wheels.py
|
|
271
|
+
extra-checks: |
|
|
272
|
+
uv run lint-imports
|
|
273
|
+
secrets:
|
|
274
|
+
SETUP_ENV: |
|
|
275
|
+
WHEELS_TOKEN=${{ secrets.WHEELS_TOKEN }}
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
In `release.yml`, add `SETUP_ENV` next to `RELEASE_SSH_KEY` under `secrets:`.
|
|
279
|
+
|
|
280
|
+
Commands run with `bash -eo pipefail`, on Windows runners too, and stop at the first failure.
|
|
281
|
+
|
|
282
|
+
### Cleaning Up
|
|
283
|
+
|
|
284
|
+
```bash
|
|
285
|
+
make clean
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
Removes build artifacts, caches, and temporary files.
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
## Pre-Commit Hooks
|
|
296
|
+
|
|
297
|
+
This project uses [pre-commit](https://pre-commit.com/) to run code quality checks automatically before each commit.
|
|
298
|
+
|
|
299
|
+
### Setup
|
|
300
|
+
|
|
301
|
+
Install the hooks:
|
|
302
|
+
|
|
303
|
+
```bash
|
|
304
|
+
make repo # if you haven't already
|
|
305
|
+
uv run pre-commit install
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
Checks will now run automatically on every commit.
|
|
309
|
+
|
|
310
|
+
### Manual Execution
|
|
311
|
+
|
|
312
|
+
Trigger all hooks manually:
|
|
313
|
+
|
|
314
|
+
```bash
|
|
315
|
+
uv run pre-commit run --all-files
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
This runs the same lint, format and type checks as `make qa`, without the tests.
|
|
319
|
+
|