Skip to content
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

FRs: Commit lint and changelog generation #6440

Open
chrisrodrigue opened this issue Aug 22, 2024 · 4 comments
Open

FRs: Commit lint and changelog generation #6440

chrisrodrigue opened this issue Aug 22, 2024 · 4 comments
Labels
projects Related to project management capabilities wish Not on the immediate roadmap

Comments

@chrisrodrigue
Copy link

chrisrodrigue commented Aug 22, 2024

This issue is an extension of #6298 (version bumping) for related enhancements. Combining into one issue so as not to inundate the team (but can split into multiple issues if that is preferred).

Standards-compliant project management actions like auto-version bumping (SemVer), changelog generation (Keep a Changelog) and commit message linting (Conventional Commits) might be good tasks for the project management tool to tackle and promote best practices for development. It would consolidate the tooling even further, save time for the developer, and reduce the cognitive load. Defining the rules and formats in pyproject.toml could provide consistency and configurability for any codebase.

Example

pyproject.toml

[tool.uv.bump]
version-files = ["src/project/__init__.py:__version__"]
version-format = "semver2"

[tool.uv.commit]
lint-commits = true
commit-format = "conventional-commits"

[tool.uv.changelog]
generate-on-bump = true
include-date = true
date-format = "iso8601"

[tool.uv.changelog-map]
feat = "⭐ Features"
fix = "🐛 Bug Fixes"
chore = "🧹 Chores"
ci = "🚀 Continuous Integration"
docs = "📚 Documentation"
perf = "🔥 Performance Improvements"
refactor = "🔨 Refactoring"
revert = "🔄 Reverts"
style = "🎨 Styling"
test = "🧪 Tests"

Command line usage

Commiting via uv will lint the commit message for applicable conventional commit tags and reject if there isn’t one. This can just shell out to git detected on the path.

uv commit “fix: Always invoke found interpreter when `uv run python` is used (#6363)”

or

uv commit fix “Always invoke …”

Bumping will bump versions for all listed files or file sections (e.g. __version__.py or __init__.py:__version__). Not sure if there’s a consensus on the best place to put the version so version-files provides flexibility.

uv bump

Changelog generation can also be its own command if generate-on-bump is not desired.

uv changelog

Generated changelog

CHANGELOG.md

# Changelog

## 0.3.1 (2024-08-21)

### 🐛 Bug Fixes

- Always invoke found interpreter when `uv run python` is used ([#6363](https://github.com/astral-sh/uv/pull/6363))

### 📚 Documentation 

- Remove the preview default value of `python-preference` ([#6301](https://github.com/astral-sh/uv/pull/6301))
- Update env vars doc about `XDG_*` variables on macOS ([#6337](https://github.com/astral-sh/uv/pull/6337))
@chrisrodrigue
Copy link
Author

See also: Commitizen, a tool that provides these capabilities.

@zanieb zanieb added wish Not on the immediate roadmap projects Related to project management capabilities labels Aug 22, 2024
@zanieb
Copy link
Member

zanieb commented Aug 22, 2024

This would be cool, of course. We use rooster right now, but it's not polished at all.

I think we need to focus on a lot of other things before this though.

@DeadNews
Copy link

By the way, there is git-cliff, and it works for any projects, not just python ones.

@phi-friday
Copy link

#6298 (comment)

Using uvx hatch version ... is mostly fine, but I can't use it when it's a stub only package because there is no *.py.

I need a way to work around this case.
It would be great if this was considered.
As someone else pointed out, it can be solved by doing the following, but it's ugly.
#6298 (comment)

As a workaround, I use this in my project:
sed -i -e "s/0.0.0/${GITHUB_REF#refs/*/}/" pyproject.toml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
projects Related to project management capabilities wish Not on the immediate roadmap
Projects
None yet
Development

No branches or pull requests

4 participants