Skip to content

Use uv init to lock to a particular Python version #6780

@SamEdwardes

Description

@SamEdwardes

First of all, awesome work uv team! I am really enjoying using uv :)

Background

I have one idea for the uv init command. Take this example:

uv init --app --python 3.12.5

It will generate the following:

[project]
name = "example-project"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.12.5"
dependencies = []

I would like to have a way to specify a specific Python version. E.g. requires-python = "==3.12.5".

[project]
name = "example-project"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = "==3.12.5"
dependencies = []

Why

Why do I think this would be helpful?

  • in --app mode I am not targeting to support a matrix of Python versions and package versions. I want to deploy my app in the most stable way possible. I should always get the same Python packages (uv.lock handles this) and the same Python version.

Possible solutions

  • Support adding version specifiers to uv init. E.g. uv init --app --python ==3.12.5
  • When using --app mode default to locking in a single version of Python (my guess is that this is what most people want, but I could be wrong!).

Metadata

Metadata

Assignees

No one assigned

    Labels

    projectsRelated to project management capabilities

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions