Skip to content

Commit

Permalink
Set PyRTL's Python package version from git tag.
Browse files Browse the repository at this point in the history
This avoid keeping the latest version number in two places, `pyproject.toml`
and `git tag`. Simplify instructions in release/README.md.

Rename some GitHub workflow jobs to clarify their purpose.
  • Loading branch information
fdxmw committed Apr 22, 2024
1 parent ac9bfbb commit 3a91c1b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 17 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/python-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ on: push
jobs:
# Verify that distribution archives can be built on every push.
build:
name: Build and upload distribution archives
runs-on: ubuntu-latest

steps:
Expand All @@ -35,8 +34,7 @@ jobs:
compression-level: 0

# Publish distribution archive to TestPyPI on tag pushes.
publish-to-testpypi:
name: Publish distribution archives on TestPyPI
publish-testpypi:
# Only publish to TestPyPI on tag pushes.
if: startsWith(github.ref, 'refs/tags/')
needs:
Expand All @@ -62,8 +60,7 @@ jobs:

# Publish distribution archive to PyPI on tag pushes. The 'pypi' environment
# requires manual approval on GitHub, so this job won't start automatically.
publish-to-pypi:
name: Publish distribution archives on PyPI
publish-pypi:
# Only publish to PyPI on tag pushes.
if: startsWith(github.ref, 'refs/tags/')
needs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
- pull_request

jobs:
build:
test:
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down
11 changes: 8 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@
# This file configures PyRTL's distribution archives, which are built and
# uploaded to PyPI with GitHub actions.
#
# This configuration is based on the "Packaging Python Projects" tutorial at
# This configuration is roughly based on the "Packaging Python Projects"
# tutorial at
# https://packaging.python.org/en/latest/tutorials/packaging-projects/

[build-system]
requires = ["hatchling"]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

[project]
name = "pyrtl"
version = "0.11.0rc1"
# hatch-vcs determines the version number from the latest git tag.
dynamic = ["version"]
authors = [
{name="Timothy Sherwood", email="[email protected]"},
{name="John Clow"},
Expand Down Expand Up @@ -46,3 +48,6 @@ svg = ["graphviz"]
Homepage = "http://ucsbarchlab.github.io/PyRTL/"
GitHub = "https://github.com/UCSBarchlab/PyRTL"
Documentation = "https://pyrtl.readthedocs.io/"

[tool.hatch.version]
source = "vcs"
10 changes: 2 additions & 8 deletions release/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,11 @@ numbers.
$ git clone [email protected]:UCSBarchlab/PyRTL.git pyrtl
$ cd pyrtl
```
2. Edit `pyproject.toml` by updating the `version =` line to `version =
"$NEW_VERSION"`
3. Commit this change:
```shell
$ git commit pyproject.toml
```
4. Tag the new version:
2. Tag the new version:
```shell
$ git tag $NEW_VERSION
```
5. Push this change to GitHub. Tags are not pushed by default, so use:
3. Push this change to GitHub. Tags are not pushed by default, so use:
```shell
$ git push origin $NEW_VERSION
```
Expand Down

0 comments on commit 3a91c1b

Please sign in to comment.