-
Notifications
You must be signed in to change notification settings - Fork 151
Migrate to uv and integrate PSR for automated releases #218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Replace Poetry with uv for dependency management and packaging - Add pre-commit hooks for ruff (lint/format) and commitizen (commit-msg) - Configure Python Semantic Release (PSR) for automated versioning - Add commitizen for local commit message validation - Create unified CI workflow with lint, test, and release jobs - Add Justfile for common development workflows
jondricek
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, here's my overarching review. It is definitely going in the right direction but has a few edges that need sanding off.
|
|
||
| - name: Check commit messages | ||
| run: | | ||
| if [ "${{ github.event_name }}" = "pull_request" ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to make sure we make it as easy as possible for external contributors to contribute. This makes me think of this FAQ from the Conventional Commits site.
Do all my contributors need to use the Conventional Commits specification?
No! If you use a squash based workflow on Git lead maintainers can clean up the commit messages as they’re merged—adding no workload to casual committers. A common workflow for this is to have your git system automatically squash commits from a pull request and present a form for the lead maintainer to enter the proper git commit message for the merge.
I think it might be better to squash commits from pull requests somehow instead and only validate commit messages that we ourselves write, to not make it an overly arduous process for external contribs.
.readthedocs.yaml
Outdated
| - pip install poetry | ||
| post_install: | ||
| - VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH poetry install --with docs | ||
| commands: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
according to the readthedocs docs, we should lean towards using build.jobs stuff instead
https://docs.readthedocs.com/platform/stable/config-file/v2.html#build-commands
we recommend using build.jobs instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I implemented build.jobs correctly but it's possible I assigned the commands to the incorrect build stages.
https://docs.readthedocs.com/platform/stable/builds.html
https://docs.readthedocs.com/platform/stable/build-customization.html
| "check-wheel-contents>=0.6.1", | ||
| "commitizen>=4.9.1", | ||
| "pre-commit>=4.0.0", | ||
| "pytest>=8.4.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pytest is 9.0.2 on PyPI
I think in general we should run uv sync --upgrade after this pull request is merged to update package dependencies that can be upgraded
A few more findings
|
jondricek
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, interesting - it didn't share these comments yet
| - name: Install the latest version of uv | ||
| uses: astral-sh/setup-uv@v7 | ||
| with: | ||
| version: "latest" | ||
|
|
||
| - name: Set up Python | ||
| run: uv python install ${{ matrix.python-version }} | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| - name: Install the latest version of uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| version: "latest" | |
| - name: Set up Python | |
| run: uv python install ${{ matrix.python-version }} | |
| - name: Install the latest version of uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install the latest version of uv | ||
| uses: astral-sh/setup-uv@v7 | ||
| with: | ||
| version: "latest" | ||
|
|
||
| - name: Set up Python | ||
| run: uv python install ${{ matrix.python-version }} | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| - name: Install the latest version of uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| version: "latest" | |
| - name: Set up Python | |
| run: uv python install ${{ matrix.python-version }} | |
| - name: Install the latest version of uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install the latest version of uv | ||
| uses: astral-sh/setup-uv@v7 | ||
| with: | ||
| version: "latest" | ||
|
|
||
| - name: Set up Python | ||
| run: uv python install ${{ matrix.python-version }} | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| - name: Install the latest version of uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| version: "latest" | |
| - name: Set up Python | |
| run: uv python install ${{ matrix.python-version }} | |
| - name: Install the latest version of uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Setup | Install uv | ||
| uses: astral-sh/setup-uv@v5 | ||
| with: | ||
| version: "latest" | ||
|
|
||
| - name: Setup | Install Python | ||
| run: uv python install ${{ matrix.python-version }} | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| - name: Setup | Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| version: "latest" | |
| - name: Setup | Install Python | |
| run: uv python install ${{ matrix.python-version }} | |
| - name: Setup | Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| [tool.semantic_release.branches.main] | ||
| match = "(main|master)" | ||
| prerelease = false | ||
|
|
||
| [tool.semantic_release.remote] | ||
| type = "github" | ||
|
|
||
| [tool.semantic_release.publish] | ||
| upload_to_vcs_release = true | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can safely delete these sections since they are very close to the defaults (or exactly the defaults) already, and I don't think we're doing anything special with the prerelease_token
https://python-semantic-release.readthedocs.io/en/latest/configuration/configuration.html#branches
| [tool.semantic_release.branches.main] | |
| match = "(main|master)" | |
| prerelease = false | |
| [tool.semantic_release.remote] | |
| type = "github" | |
| [tool.semantic_release.publish] | |
| upload_to_vcs_release = true |
| [tool.semantic_release.commit_parser_options] | ||
| minor_tags = ["feat"] | ||
| patch_tags = ["fix", "perf"] | ||
| allowed_tags = ["feat", "fix", "perf", "build", "chore", "ci", "docs", "style", "refactor", "test"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| allowed_tags = ["feat", "fix", "perf", "build", "chore", "ci", "docs", "style", "refactor", "test"] | |
| allowed_tags = ["feat", "fix", "perf", "build", "chore", "ci", "docs", "style", "refactor", "revert", "test"] |



Changes
poetrywithuvpre-commitpre-commitrunsruff-formatfor formatting filespre-commitrunscommitizenfor enforcing conventional commit syntax before commits are acceptedsemantic-releasetoolsemantic-releasecan technically be used within any language environment, it relies on community plugins, and there are only two plugins listed on the official plugins page that support Python oruv; neither of which have many GitHub Stars.commitizen. This is the equivalent of usingsemantic-releaseandcommitlintin our other JS-oriented projects.uvand PSR (un-tested)Justfilefor streamlining common functions (equivalent ofnpm run ...just ...)