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

Docs: Mention that .python-version is obsolete if project.requires-python is present in pyproject.toml? #8247

Open
jnussbaum opened this issue Oct 16, 2024 · 1 comment
Assignees
Labels
question Asking for clarification or support

Comments

@jnussbaum
Copy link

First a big thumbs up for the great work you're doing with ruff and uv! We have adopted both in our company, and we're overwhelmed!

I have just a quick request for clarification: https://docs.astral.sh/uv/guides/projects/ implies that it is always necessary (or at least best practice) to have the file .python-version checked in. But for standards-compliant projects that define project.requires-python in pyproject.toml, this seems obsolete. I tried it out, and in fact, uv correctly detects project.requires-python and installs the intended python version, even without .python-version.

In our project, I wanted to remove .python-version, so that we don't have the python version defined in 2 separate places. But then I became insecure because of the documentation.

Therefore, I think it would be helpful to add a remark to https://docs.astral.sh/uv/guides/projects/, mentioning that .python-version is obsolete in this case. WDYT?

@charliermarsh
Copy link
Member

The .python-version file is not quite obsolete with requires-python -- they're subtly different. requires-python is the range of versions supported by your project. .python-version is the exact version you want to use when developing. For example, if you're working on a library, your requires-python might be >= "3.10". But when developing on your machine, you might want to use 3.12.4 by default -- so you'd set that in a .python-version.

@charliermarsh charliermarsh added the question Asking for clarification or support label Oct 16, 2024
@charliermarsh charliermarsh self-assigned this Oct 16, 2024
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

2 participants