Skip to content

Support .python-version files as input to with python-version #211

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

Open
JacobHayes opened this issue Dec 24, 2024 · 2 comments
Open

Support .python-version files as input to with python-version #211

JacobHayes opened this issue Dec 24, 2024 · 2 comments
Labels
venv-activation Temporay label to track issues with first venv activation

Comments

@JacobHayes
Copy link

In simple projects, I use a .python-version file to set the version and don't use GHA matrix builds across python versions (ie: no python version ref in workflow file).

I would like to use setup-uv's python installation and particularly the automatic venv activation, but don't want to duplicate the python version in both the .python-version file _and_ the GHA workflow. Right now, I just use setup-uvand then runuv sync --frozenin the next step (which will implicitly install from.python-version`), which works fine but doesn't handle the venv activation for subsequent steps.

The presence of a .python-version file probably shouldn't automatically trigger the python install / venv activation, but perhaps the python-version flag could be extended to support a reference to the file?

@kb-beebucket
Copy link

maybe we need

with: 
    sync: true/<specific-extra>/all-extras

and

with:
    activate-venv: true/<path>

in addition to with: python-version which specifies the first two options implicitly.

@eifinger eifinger added the venv-activation Temporay label to track issues with first venv activation label Mar 29, 2025
@rnwolf
Copy link

rnwolf commented Apr 2, 2025

I get the following error:

[Install uv](https://github.com/rnwolf/our-planner/actions/runs/14222047083/job/39852292934#annotation:3:1)
Unexpected input(s) 'python-version-file', valid inputs are ['version', 'pyproject-file', 'uv-file', 'python-version', 'checksum', 'github-token', 'enable-cache', 'cache-dependency-glob', 'cache-suffix', 'cache-local-path', 'prune-cache', 'ignore-nothing-to-cache', 'ignore-empty-workdir', 'tool-dir', 'tool-bin-dir']

This was here I suspect:

      - name: Install uv
        uses: astral-sh/setup-uv@v5
        with:
          python-version-file: ".python-version"
          version: "0.6.11"

And when I setup python environment the first time it was pinned with ".python-version".
As per https://docs.astral.sh/uv/concepts/python-versions/#python-version-files
I don't see a suggestion that we should use "python-version". Would be good to get valid input for this file as well for ".python-version"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
venv-activation Temporay label to track issues with first venv activation
Projects
None yet
Development

No branches or pull requests

4 participants