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

Support getting the project version (like Rye and poetry) from the pyproject.toml #7785

Closed
itamark-ug opened this issue Sep 29, 2024 · 5 comments
Labels
duplicate This issue or pull request already exists

Comments

@itamark-ug
Copy link

itamark-ug commented Sep 29, 2024

Hi,
In both poetry and Rye there is an option to run poetry version or rye version and get the project version from the pyproject.toml.

Here is a link to the rye docs:
https://rye.astral.sh/guide/commands/version/

Here is a link to the poetry docs:
https://python-poetry.org/docs/cli/#version

for example, for a project named my-little-helper with a version 2.0.22 the command will emit:
my-little-helper 2.0.22
In poetry there is also an option to add the --short option and the result will be 2.0.22

The motivation for that is to be able to extract the version for automatic tagging a successful package build in a github action.
But I can think of other useful scenarios.

Thanks

@danyeaw
Copy link

danyeaw commented Oct 5, 2024

I agree that this would be really useful. A workaround to get the version could be:

uv tool install pyproject-parser[cli]
pyproject-info project.version

@itamark-ug
Copy link
Author

I agree that this would be really useful. A workaround to get the version could be:

uv tool install pyproject-parser[cli]
pyproject-info project.version

Thanks, we are already using it in our code, for now (till uv will support it) I will use your workaround in our build action. Thanks

@zanieb
Copy link
Member

zanieb commented Oct 6, 2024

Duplicate of #6298

@zanieb zanieb marked this as a duplicate of #6298 Oct 6, 2024
@zanieb zanieb closed this as not planned Won't fix, can't repro, duplicate, stale Oct 6, 2024
@zanieb zanieb added the duplicate This issue or pull request already exists label Oct 6, 2024
@zanieb
Copy link
Member

zanieb commented Oct 6, 2024

We're interested, but need to design the interface.

@david-waterworth
Copy link

Note pyproject-info project.version returns the version with the surrounding quotes, I used pyproject-info project.version | xargs to remove them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

4 participants