Skip to content

Add lock files for inline script metadata #7483

@ketozhang

Description

@ketozhang

https://docs.astral.sh/uv/guides/scripts/#declaring-script-dependencies

I find inline script metadata difficult to adopt because it forces all my users to run the script with a compatible runner (e.g., uv or pipx). For backwards compatibility with pip install method, a tradition requirements file is still necessary.

$ uv pip compile --script example.py -o requirements.txt
# Users without uv
$ pip install -r requirements.txt
$ python example.py

Other use cases involve, not relying on uv's venv management. For example, you have many scripts with inline metadata, but want 1 venv to be compatible with all:

$ uv pip compile --scripts scripts/*.py -o requirements.txt

My title could be more specific, but I am opening it up to uv run example.py automatically creating a uv.lock. This could be a future once we have a standard lock file.

Metadata

Metadata

Assignees

Labels

wishNot on the immediate roadmap

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions