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 for Retrieving Project Version (Equivalent to poetry version) #11475

Closed
shoaibkhanz opened this issue Feb 13, 2025 · 2 comments
Closed
Labels
question Asking for clarification or support

Comments

@shoaibkhanz
Copy link

Question

Currently, uv version does not return the project version but instead returns the version of UV itself. In Poetry, we can use poetry version to retrieve the project’s version as defined in pyproject.toml. This is useful for dynamically tagging builds, such as appending dev versions in CI with git rev-parse --short $GITHUB_SHA.

here is an example one that is used with poetry, can something similar be achieved with uv or planned feature.

publish:
      runs-on: ubuntu-latest
      needs: test
      steps:
        - uses: actions/checkout@v2
        - name: Set up Python
          uses: actions/setup-python@v2
          with:
            python-version: '3.12'
        - name: Install Poetry
          run: |
            pip install poetry
        - name: Snapshot Version
          if: ${{ github.ref_type == 'branch' }}
          run: |
            VERSION=$(poetry version --short)
            poetry version "${VERSION}.dev0+$(git rev-parse --short "$GITHUB_SHA")"
        - name: Build and Publish Release
          env:
            POETRY_HTTP_BASIC_NEXUS_UPLOAD_USERNAME: ${{ secrets.NEXUS_USERNAME }}
            POETRY_HTTP_BASIC_NEXUS_UPLOAD_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
          run: |
            poetry config repositories.nexus-upload https://nexus.abc.com/repository/pypi/
            poetry publish --build --repository="nexus-upload"

Platform

macos (Darwin 24.3.0 arm64)

Version

uv 0.5.29 (Homebrew 2025-02-06)

@shoaibkhanz shoaibkhanz added the question Asking for clarification or support label Feb 13, 2025
@konstin
Copy link
Member

konstin commented Feb 13, 2025

Is this covered by #6298?

@charliermarsh
Copy link
Member

I believe so, yeah.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Asking for clarification or support
Projects
None yet
Development

No branches or pull requests

3 participants