Skip to content

Conversation

@seansica
Copy link
Contributor

@seansica seansica commented Dec 23, 2025

Changes

  • Replace poetry with uv
  • Add pre-commit
    • pre-commit runs ruff-format for formatting files
      • The changes to Python files in this PR are just ruff formatting applied
    • pre-commit runs commitizen for enforcing conventional commit syntax before commits are accepted
  • Add Python Semantic Release (PSR) for automating SemVer tagging and GitHub releases
    • Note: PSR is a highly popular fork of the original semantic-release tool
    • Though semantic-release can 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 or uv; neither of which have many GitHub Stars.
    • PSR, on the other hand, seems to have a thriving community, and is purpose-built specifically for Python.
    • PSR can run locally and on CI/CD pipelines.
    • The only thing that PSR cannot do is commit linting (e.g., "check every commit since the last release"). For this, we use commitizen. This is the equivalent of using semantic-release and commitlint in our other JS-oriented projects.
  • Refactor CI/CD pipeline to build/publish with uv and PSR (un-tested)
  • Add Justfile for streamlining common functions (equivalent of npm run ... $$\rightarrow$$ just ...)

- 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
@seansica seansica self-assigned this Dec 23, 2025
Copy link
Contributor

@jondricek jondricek left a 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
Copy link
Contributor

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.

https://www.conventionalcommits.org/en/v1.0.0/#do-all-my-contributors-need-to-use-the-conventional-commits-specification

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.

- pip install poetry
post_install:
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH poetry install --with docs
commands:
Copy link
Contributor

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

Copy link
Contributor Author

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",
Copy link
Contributor

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

@sonarqubecloud
Copy link

Copy link
Contributor

@jondricek jondricek left a 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

Comment on lines +23 to +30
- 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 }}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- 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 }}

Comment on lines +50 to +57
- 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 }}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- 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 }}

Comment on lines +75 to +82
- 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 }}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- 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 }}

Comment on lines +127 to +134
- name: Setup | Install uv
uses: astral-sh/setup-uv@v5
with:
version: "latest"

- name: Setup | Install Python
run: uv python install ${{ matrix.python-version }}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- 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 }}

Comment on lines +102 to +111
[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

Copy link
Contributor

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

Suggested change
[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"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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"]

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.

3 participants