From 245f9c49ec282fc31fe10ce7a13ac56b4e64a9d3 Mon Sep 17 00:00:00 2001 From: Mark Dickinson Date: Sun, 2 Nov 2025 12:55:08 +0000 Subject: [PATCH 1/5] Update release workflow to use uv --- .github/workflows/on-release.yml | 23 +++++++---------------- .gitignore | 6 +----- requirements/publish.txt | 2 -- 3 files changed, 8 insertions(+), 23 deletions(-) delete mode 100644 requirements/publish.txt diff --git a/.github/workflows/on-release.yml b/.github/workflows/on-release.yml index 468abb1..53b1f7d 100644 --- a/.github/workflows/on-release.yml +++ b/.github/workflows/on-release.yml @@ -2,6 +2,7 @@ name: on-release on: workflow_dispatch: + pull_request: release: types: [published] @@ -13,20 +14,10 @@ jobs: - uses: actions/checkout@v5 with: fetch-depth: 0 - - name: Set up Python 3.13 - uses: actions/setup-python@v6 + - uses: astral-sh/setup-uv@v6 with: - python-version: '3.13' - cache: 'pip' - cache-dependency-path: 'requirements/publish.txt' - - name: Install dependencies - run: python -m pip install -r requirements/publish.txt - - name: Build sdist and wheel - run: python -m build - - name: Publish to PyPI - env: - TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} - TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} - run: | - python -m twine check --strict dist/* - python -m twine upload dist/* + version: "0.9.7" + - name: Build package + run: uv build + - name: Publish package + run: uv publish --dry-run diff --git a/.gitignore b/.gitignore index 6c2611a..98094d3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,5 @@ # Python bytecode -*.pyc +__pycache__/ # Coverage database .coverage - -# Build and distribution -/dist/ -/src/*.egg-info/ diff --git a/requirements/publish.txt b/requirements/publish.txt deleted file mode 100644 index e47b6e9..0000000 --- a/requirements/publish.txt +++ /dev/null @@ -1,2 +0,0 @@ -build -twine From 1c6d1c7a24b2f9e3debc07bdbc9e4743f451bd03 Mon Sep 17 00:00:00 2001 From: Mark Dickinson Date: Sun, 2 Nov 2025 13:51:10 +0000 Subject: [PATCH 2/5] Add permissions to workflow so that it can use trusted publishing --- .github/workflows/on-release.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/on-release.yml b/.github/workflows/on-release.yml index 53b1f7d..932fce5 100644 --- a/.github/workflows/on-release.yml +++ b/.github/workflows/on-release.yml @@ -8,7 +8,11 @@ on: jobs: build-and-upload: + name: Build and upload release to PyPI runs-on: ubuntu-latest + environment: release + permissions: + id-token: write steps: - uses: actions/checkout@v5 From 2a5e99cd8238a072633c1bc4dff26929c5282595 Mon Sep 17 00:00:00 2001 From: Mark Dickinson Date: Sun, 2 Nov 2025 14:01:20 +0000 Subject: [PATCH 3/5] Add notes on making a release --- DEVELOP.md | 19 +++++++++++++++++++ pyproject.toml | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/DEVELOP.md b/DEVELOP.md index 8fec6e0..3daf1f3 100644 --- a/DEVELOP.md +++ b/DEVELOP.md @@ -12,3 +12,22 @@ From the root directory of the repository: - Run `uv run coverage run` to execute the test suite under coverage. - Run `uvx ruff check` for linting checks. - Run `uvx ruff format` to format the code. + +## Making a release + +There's a GitHub Actions workflow that will automatically publish a release to +PyPI when a GitHub release is created. + +Steps to make a release: + +- Bump the version number in the `pyproject.toml` file if necessary, for example using + `uv version --bump minor` for a minor release. (Note: this also updates the lockfile.) + Make a PR for the version bump. +- Ensure that the lockfile has been updated. (Not necessary if you used `uv version`.) +- Prepare release notes in a (temporary) markdown file. +- Tag the release commit with an annotated tag (e.g. `git tag -a 2.3.4`); include the + prepared release notes in the commit message body. +- Go to the GitHub releases page: https://github.com/mdickinson/simplefractions/releases +- Create a new release, using the previously prepared release notes. +- Double-check that the release workflow succeeded and that the new release is present + on PyPI at https://pypi.org/project/simplefractions. diff --git a/pyproject.toml b/pyproject.toml index a93183b..1fff2b9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "uv_build" [project] name = 'simplefractions' -version = '1.4.0' +version = "1.4.0" description = 'Find the simplest fraction for a given float or interval' readme = 'README.md' requires-python = '>=3.10' From 1e8773aa58086447fd03f4f2da5de74cb01d0859 Mon Sep 17 00:00:00 2001 From: Mark Dickinson Date: Sun, 2 Nov 2025 14:02:12 +0000 Subject: [PATCH 4/5] Tweak wording --- DEVELOP.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DEVELOP.md b/DEVELOP.md index 3daf1f3..0c47a1e 100644 --- a/DEVELOP.md +++ b/DEVELOP.md @@ -25,8 +25,8 @@ Steps to make a release: Make a PR for the version bump. - Ensure that the lockfile has been updated. (Not necessary if you used `uv version`.) - Prepare release notes in a (temporary) markdown file. -- Tag the release commit with an annotated tag (e.g. `git tag -a 2.3.4`); include the - prepared release notes in the commit message body. +- Tag the release commit with an annotated tag matching the version (e.g. `git tag -a + 2.3.4`); include the prepared release notes in the commit message body. - Go to the GitHub releases page: https://github.com/mdickinson/simplefractions/releases - Create a new release, using the previously prepared release notes. - Double-check that the release workflow succeeded and that the new release is present From 5a4b1af6e104d6b150f1b94fbf6b0b107a8f21a0 Mon Sep 17 00:00:00 2001 From: Mark Dickinson Date: Sun, 2 Nov 2025 14:02:54 +0000 Subject: [PATCH 5/5] Remove the debugging pull_request trigger; remove the --dry-run option --- .github/workflows/on-release.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/on-release.yml b/.github/workflows/on-release.yml index 932fce5..e897c28 100644 --- a/.github/workflows/on-release.yml +++ b/.github/workflows/on-release.yml @@ -2,7 +2,6 @@ name: on-release on: workflow_dispatch: - pull_request: release: types: [published] @@ -24,4 +23,4 @@ jobs: - name: Build package run: uv build - name: Publish package - run: uv publish --dry-run + run: uv publish