Skip to content

Prepare for 4.0.0 release#98

Merged
jcarbaugh merged 3 commits into
mainfrom
APR-31-prepare-project-for-new-release
May 20, 2026
Merged

Prepare for 4.0.0 release#98
jcarbaugh merged 3 commits into
mainfrom
APR-31-prepare-project-for-new-release

Conversation

@jcarbaugh
Copy link
Copy Markdown
Member

@jcarbaugh jcarbaugh commented May 20, 2026

Summary

This PR modernizes the project's packaging, tooling, and CI configuration in preparation for the 4.0.0 release — the first new release in several years.

The project was already in good shape (uv, ruff, GitHub Actions, OIDC publishing to PyPI) so this is a targeted cleanup pass rather than a full overhaul.

Changes

Packaging (pyproject.toml)

  • Added missing build-backend = "setuptools.build_meta" to [build-system] (required by PEP 517)
  • Moved from dynamic = ["version"] (setuptools attribute lookup) to a static version = "4.0.0.dev0" — cleaner and compatible with uv version for release automation

Version module (us/version.py)

  • Replaced hardcoded __version__ string with importlib.metadata.version("us") so the reported version always matches the installed package
  • Added a try/except fallback to "unknown" for environments where the package metadata isn't available

Release workflow (.github/workflows/publish.yml)

  • Replaced the fragile sed regex that patched version.py at release time with uv version "${GITHUB_REF#refs/tags/v}", which sets the version directly in pyproject.toml
  • To release: push a tag v4.0.0 → CI runs tests → uv version sets the version → uv build → publishes to PyPI via Trusted Publishing (no API token needed)

Documentation

  • README.md: fixed uv install us (not a valid command) → uv add us; replaced uv run black --check us with the correct ruff commands
  • CONTRIBUTING.md: updated formatting tool reference from black to ruff

  release in many years

  - Add build-backend to [build-system] in
  pyproject.toml (PEP 517)
  - Move from dynamic to static version in
  pyproject.toml (4.0.0.dev0)
  - Switch us/version.py to importlib.metadata
  with unknown fallback
  - Replace sed-based version replacement in
  publish.yml with uv version
  - Bump astral-sh/setup-uv from v7 to v8 across
   all CI jobs
  - Fix README: uv install -> uv add, black ->
  ruff in dev section
  - Fix CONTRIBUTING.md: black -> ruff
@jcarbaugh
Copy link
Copy Markdown
Member Author

jcarbaugh commented May 20, 2026

Changes to focus on in review:

  • us/version.py — switched from a hardcoded string to importlib.metadata.version("us") with a try/except fallback. Worth a second look: the fallback returns "unknown" rather than raising, which is intentional for environments where the package isn't installed (e.g. bare sys.path import without uv sync).

  • publish.yml — the sed version-patching step is replaced by uv version "${GITHUB_REF#refs/tags/v}". This modifies pyproject.toml in-place during the CI run (not committed back). uv build reads it fresh, so the published wheel picks up the correct version.

  • pyproject.tomlversion is now static (4.0.0.dev0); dynamic = ["version"] and [tool.setuptools.dynamic] are removed. The build-backend was also missing and is now added.

@jcarbaugh jcarbaugh changed the title Prepare project for first new release in many years Prepare for 4.0.0 release May 20, 2026
@jcarbaugh jcarbaugh merged commit 2641f2e into main May 20, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant