-
Notifications
You must be signed in to change notification settings - Fork 678
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
Add a subcommand for reading/bumping the version in pyproject.toml #6298
Comments
Would maintaining version identifiers outside of Or, even better, support a dynamic version like hatch does with a [project]
dynamic = ["version"]
[tool.hatch.version]
path = "src/package/__init__.py" |
It's most convenient to me to have https://github.com/mtkennerly/poetry-dynamic-versioning I would love to have this functionality. |
Would also love to see this... I'm currently using poetry-version-plugin in versioned projects and want to switch them to uv |
Also very interested in this feature. This kind of read/update version command seems very common (not only Poetry but npm, etc) and it'd make migration to uv from other tools that much more straightforward.
@JonZeolla I've used PDM's dynamic versioning in the past (which is essentially the same as the Hatch example you provide) but have found it kind of annoying in practice. IMO it's preferable to have the version in pyproject.toml be the source of truth. That version can be exposed in the Python package using [tool.poetry]
name = "my-package"
version = "1,2,3" # my_package/__init__.py
from importlib.metadata import version
__version__ = version("my_package") |
Personally I also like the idea of basing the version on the current git tag when using together with CI/CD. |
Covering what bump-my-version (and previously bumpversion) do would cover that (including customizing the git tag and commit message format) An interesting addition would be to have a way to trigger a custom An even better but probably too opinionated option could be to add a CHANGELOG management system (like changie) but it might be out of scope of uv? |
For others who need this. uvx --from=toml-cli toml set --toml-path=pyproject.toml project.version $VERSION I'm using it like this in github action. VERSION=$(uvx dunamai from any --no-metadata --style pep440)
uvx --from=toml-cli toml set --toml-path=pyproject.toml project.version $VERSION
uv build |
Consider how My workflow looks like this: # Show current version
poetry version
# Bump version
poetry version minor
# Add a git tag with a matching version to what's in pyproject.toml
git tag "v$(poetry version -s)" Poetry tries to be clever to avoid needing an option to specify whether you are auto-bumping or manually setting a version:
This assumes that no-one will ever want to use one of those strings as a version, but that seems like a reasonably safe assumption. |
With hatch even when you have the |
Using |
I'd love to see something like this as well - I currently use |
As a workaround, I use this in my project:
|
Exactly what I did, I just wasn't comfortable w/ it |
Is there a reason why this won't/can't be implemented? |
The Basically, that part isn't trivial and we're doing a lot of other things. |
@sam57719 that doesn't mean it's not a breaking change to switch the functionality. There is downstream code that will break if we change it. |
Maybe we could just have a way to bump by updating the .toml file?
Maybe someone already thought of that, I'm new to |
Related: #6440 |
Here's a workaround that may help wait for the feature: $ uv tree --depth 0
Resolved 66 packages in 1ms
mass-driver v0.18.0a1 Noting the "Resolved 66 packages in 1ms" is coming on stderr (debug message), so with a bit of fanciful shell: $ uv tree --depth=0 2> /dev/null | awk '{print $2}'
v0.18.0a1 Not perfect, but it's a start! PS: Still would love the feature, and personally believe the breakage/change of semantics of |
That |
✅ Both Rye and Poetry have this, and it's quite useful both...
pyproject.toml
file serve as the single source of truth for a project's version, easily accessible (viauv
) in CI workflows, etc.🛑 The latter is where my personal interests lie: I have a CI workflow that tags and deploys releases when the version is bumped, currently using Poetry for it. I don't really want to pull in an additional tool to parse the project specs, so it's currently keeping me from considering migrating to
uv
.📜 My proposal is replacing the current functionality of the
version
subcommand with this, sinceuv
's version can already be accessed via the-V | --version
option, and other project management currently exist as "root" subcommands.ℹ️ I'm willing to give this one a go myself if maintainers greenlight the proposal.
The text was updated successfully, but these errors were encountered: