Skip to content
Closed
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 .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.10
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
include Makefile
include .coveragerc
include .editorconfig
include .python-version
include *.cfg
include *.ini
include *.md
Expand Down
16 changes: 15 additions & 1 deletion cicd_utils/cicd/scripts/extract_latest_release_notes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
#!/usr/bin/env python
#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.10"
# dependencies = [
# "markdown-it-py",
# "mdit-py-plugins",
# "mdformat",
# "mdformat-footnote",
# ]
# ///
# NOTE: The PEP 723 inline metadata above is used when running this
# script standalone (e.g. via `uv run` or the `release-notes`
# tox env). The same dependencies are also declared in the
# `cicd_utils` dependency group in pyproject.toml, which is
# needed for the unit tests that import this module.
"""Extract the latest release notes

Execution steps:
Expand Down
3 changes: 3 additions & 0 deletions docs/reference/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ Unreleased changes
### Developer Experience

- Migrate all development dependencies from `requirements/*.txt` files to PEP 735 dependency groups in `pyproject.toml` ({gh-pr}`388`)
- Declare the release notes script's dependencies as PEP 723 inline metadata and run it with `uv run` ({gh-pr}`392`)
- Use `uv build` to build the source and binary distributions ({gh-pr}`392`)
- Add a `.python-version` file pinning the default development interpreter to Python 3.10 ({gh-pr}`392`)

### CI/CD

Expand Down
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ cicd_utils = [
# manylinux2014_armv7l wheel, which breaks universal
# (multi-platform) resolution with `uv sync`/`uv lock`
"kaleido<0.4,!=0.2.1.post1",
# ./cicd_utils/cicd/scripts/extract_latest_release_notes.py
# Deps for ./cicd_utils/cicd/scripts/extract_latest_release_notes.py
# NOTE: these are also declared in the script's PEP 723 inline
# metadata (used by `uv run`); they are duplicated here so
# that the unit tests can import the script's module
"markdown-it-py",
"mdit-py-plugins",
"mdformat",
Expand Down
4 changes: 3 additions & 1 deletion tests/cicd_utils/test_scripts/test_scripts_are_executable.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,6 @@ def test_py_scripts_are_executable(script_path: Path) -> None:
def test_py_scripts_have_py_shebang(script_path: Path) -> None:
with script_path.open("r") as f:
first_line = f.readline()
assert first_line.startswith("#!/usr/bin/env python")
# Scripts are either run directly with python or, when they declare
# PEP 723 inline metadata, through `uv run --script`
assert first_line.startswith(("#!/usr/bin/env python", "#!/usr/bin/env -S uv run --script"))
15 changes: 8 additions & 7 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,17 @@ commands =
[testenv:release-notes]
description = extract release notes from docs/reference/changelog.md
skip_install = true
dependency_groups = cicd_utils
commands = python cicd_utils/cicd/scripts/extract_latest_release_notes.py
allowlist_externals = uv
# The script's dependencies are declared as PEP 723 inline metadata,
# which `uv run` resolves into an isolated (cached) script environment
commands = uv run --no-project --script cicd_utils/cicd/scripts/extract_latest_release_notes.py

[testenv:build-dists]
description = build source (sdist) and binary (wheel) distributions
deps =
build
twine
allowlist_externals = rm
skip_install = true
deps = twine
allowlist_externals = rm, uv
commands =
rm -rf dist/
python -m build
uv build
twine check --strict dist/*
Loading