Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
* feature/root-answers-file: generated projects keep their Copier answers in `.copier-py-answers.yml` at the root rather than in `.copier-generic-project/`; existing projects move the file once before their next update.
* fix/devcontainer-timezone: the dev container, and CI with it, starts on hosts that have no /etc/timezone.
* fix/bash-history-mount: shell history in the dev container persists between sessions.
* feature/version-file: generated projects take their package version from VERSION; existing projects run `uv lock` once after updating.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ Projects generated before the answers file moved keep it in `.copier-generic-pro
$ git mv .copier-generic-project/.copier-py-answers.yml .copier-py-answers.yml
```

Projects generated before v2.2.0 hold a fixed version in `uv.lock`. After the update that takes `pyproject.toml` to the version in `VERSION`, refresh the lock once and commit it, or `make build` fails on the out-of-date lock:

```bash
$ uv lock
```


### Versioning and CI

Expand All @@ -73,7 +79,7 @@ Every generated project has a `Makefile` at its root:
* `make build` installs the locked dependencies and byte-compiles the package.
* `make format` formats the Python sources with ruff; `make format-dry-run` lists unformatted files and fails if there are any.
* `make test` runs the tests with pytest.
* `make release` builds a wheel and an sdist into `dist/`.
* `make release` builds a wheel and an sdist into `dist/`, versioned from the project's `VERSION` file.


### GitHub CI
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2.1.2
v2.2.0
2 changes: 2 additions & 0 deletions template/README.md.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ $ make format-dry-run # list files that need formatting

`make release` builds a wheel and an sdist into `dist/`. They install on any platform with Python 3.13.

The package version is read from `VERSION`, the same version CI releases, so bump only that file.



## Copier Update
Expand Down
15 changes: 14 additions & 1 deletion template/pyproject.toml.jinja
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
[build-system]
requires = ["setuptools>=80"]
build-backend = "setuptools.build_meta"

[project]
name = "{{ project_slug }}"
version = "0.1.0"
dynamic = ["version"]
description = "{{ project_description }}"
authors = [
{ name = "{{ user_name }}"{% if user_email %}, email = "{{ user_email }}"{% endif %} },
Expand All @@ -23,8 +27,17 @@ dependencies = [
[project.scripts]
main = "{{ module_slug }}.main:main"

# setuptools reads VERSION, the version CI releases, and drops the leading v
[tool.setuptools.dynamic]
version = { file = "VERSION" }

[tool.setuptools.packages.find]
include = ["{{ module_slug }}*"]

[tool.uv]
package = true
# rebuild the installed project when VERSION changes, so its metadata stays current
cache-keys = [{ file = "pyproject.toml" }, { file = "VERSION" }]

[dependency-groups]
dev = [
Expand Down