-
Notifications
You must be signed in to change notification settings - Fork 959
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 command to read and update (i.e., bump) the project version, e.g., uv version
#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 |
Bumpver would be a good project for inspiration. I submitted mbarkhau/bumpver#239, but it was closed as a duplicate of mbarkhau/bumpver#193, which seems like it's a ways off. |
Looks a bit older compared to: https://github.com/callowayproject/bump-my-version but I assume uv maintainers already have good references 😃 |
pyproject.toml
Retitled to try to improve discoverability. We get a lot of duplicates of this one. |
fwiw - when I first used |
So, imagine we have dozens of |
I resolved this issue with this temporary workaround: This approach was inspired by the workaround shared #6298 (comment). The key is to pass the version as a build arg (e.g., from a Git tag) to your build tool, in my case, Kaniko. |
I use this as a workaround: |
Personally I do this with a version of Python that includes version=$(python -c 'import tomllib;fp=open("pyproject.toml","rb");print(tomllib.load(fp)["project"]["version"]);fp.close()') |
pyproject.toml
uv version
This is basically the only thing which blocks me porting all my projects over to UV right now. |
My 2 cents on the issue: I don't think there are many places where there is a dependency on a
It's just something I thought of and any part could be changed/tweaked to better fit the desired outcome. |
- Use justfile instead of Makefile, since the release script can be integrated natively: `just release patch`. Might be possible to even include this in pyproject.toml since `uv` will provide a task runner (astral-sh/uv#5903) that might be based on just. - Adjust the linting checks in the CI to run against the whole project. - Add commitizen for bumping the release. This was provided by poetry in the past. I make too many mistakes without a tool here. In the future, this will be covered by uv as well: astral-sh/uv#6298 - next… let's try to release a dev release and let's have a look if the pipeline works correctly.
- Use justfile instead of Makefile, since the release script can be integrated natively: `just release patch`. Might be possible to even include this in pyproject.toml since `uv` will provide a task runner (astral-sh/uv#5903) that might be based on just. - Adjust the linting checks in the CI to run against the whole project. - Add commitizen for bumping the release. This was provided by poetry in the past. I make too many mistakes without a tool here. In the future, this will be covered by uv as well: astral-sh/uv#6298 - next… let's try to release a dev release and let's have a look if the pipeline works correctly.
- Use justfile instead of Makefile, since the release script can be integrated natively: `just release patch`. Might be possible to even include this in pyproject.toml since `uv` will provide a task runner (astral-sh/uv#5903) that might be based on just. - Adjust the linting checks in the CI to run against the whole project. - Use the just runner in CI to avoid differing invocations in the project. - Add commitizen for bumping the release. This was provided by poetry in the past. I make too many mistakes without a tool here. In the future, this will be covered by uv as well: astral-sh/uv#6298 - next… let's try to release a dev release and let's have a look if the pipeline works correctly.
- Use justfile instead of Makefile, since the release script can be integrated natively: `just release patch`. Might be possible to even include this in pyproject.toml since `uv` will provide a task runner (astral-sh/uv#5903) that might be based on just. - Adjust the linting checks in the CI to run against the whole project. - Use the just runner in CI to avoid differing invocations in the project. - Add commitizen for bumping the release. This was provided by poetry in the past. I make too many mistakes without a tool here. In the future, this will be covered by uv as well: astral-sh/uv#6298 - next… let's try to release a dev release and let's have a look if the pipeline works correctly.
- Use justfile instead of Makefile, since the release script can be integrated natively: `just release patch`. Might be possible to even include this in pyproject.toml since `uv` will provide a task runner (astral-sh/uv#5903) that might be based on just. - Adjust the linting checks in the CI to run against the whole project. - Use the just runner in CI to avoid differing invocations in the project. - Add commitizen for bumping the release. This was provided by poetry in the past. I make too many mistakes without a tool here. In the future, this will be covered by uv as well: astral-sh/uv#6298 - next… let's try to release a dev release and let's have a look if the pipeline works correctly.
- Use justfile instead of Makefile, since the release script can be integrated natively: `just release patch`. Might be possible to even include this in pyproject.toml since `uv` will provide a task runner (astral-sh/uv#5903) that might be based on just. - Adjust the linting checks in the CI to run against the whole project. - Use the just runner in CI to avoid differing invocations in the project. - Add commitizen for bumping the release. This was provided by poetry in the past. I make too many mistakes without a tool here. In the future, this will be covered by uv as well: astral-sh/uv#6298 - next… let's try to release a dev release and let's have a look if the pipeline works correctly.
Hello uv team! The "uv version" feature for updating project versions is crucial for projects with frequent alpha/dev releases. Currently, Poetry's simple command Is there a roadmap or timeline for implementing this functionality in uv? Thanks |
✅ 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: