astral-sh / uv

An extremely fast Python package and project manager, written in Rust.
https://docs.astral.sh/uv
Apache License 2.0
19.85k stars 584 forks source link

An exclude newer extension for PEP 723 #6555

Open hauntsaninja opened 2 weeks ago

hauntsaninja commented 2 weeks ago

This would be a one liner you could add that to make most scripts 99% reproducible using uv's awesome --exclude-newer

hauntsaninja commented 2 weeks ago

I guess two liner because it would probably need to be under [tool.uv]

zanieb commented 2 weeks ago

You should already be able to do this!

charliermarsh commented 2 weeks ago

Yeah I believe this works:

# /// script
# requires-python = ">=3.12"
# dependencies = [
#     "flask",
# ]
#
# [tool.uv]
# exclude-newer = "2023-03-25T00:00:00Z"
# ///
zanieb commented 2 weeks ago

e.g.

# /// script
# requires-python = ">=3.11"
# dependencies = [
#     "httpx",
# ]
#
# [tool.uv]
# exclude-newer = "2022-07-17T00:00:00Z"
# ///

gives

 + anyio==3.6.1
 + certifi==2022.6.15
 + h11==0.12.0
 + httpcore==0.15.0
 + httpx==0.23.0
 + idna==3.3
 + rfc3986==1.5.0
 + sniffio==1.2.0

and without

 + anyio==4.4.0
 + certifi==2024.7.4
 + h11==0.14.0
 + httpcore==1.0.5
 + httpx==0.27.0
 + idna==3.8
 + sniffio==1.3.1
hauntsaninja commented 2 weeks ago

Ah, I should have tried it! https://github.com/astral-sh/uv/pull/6562 adds some things that would be useful :-)