From 57cb9c2957c2a177afc4ec79262d4b9b65b4b6d2 Mon Sep 17 00:00:00 2001 From: Shantanu <12621235+hauntsaninja@users.noreply.github.com> Date: Thu, 29 Aug 2024 13:44:47 -0700 Subject: [PATCH] Add docs for inline exclude newer (#6831) See https://github.com/astral-sh/uv/pull/6562 --- docs/guides/scripts.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/docs/guides/scripts.md b/docs/guides/scripts.md index 1c9318801..4a67bc94c 100644 --- a/docs/guides/scripts.md +++ b/docs/guides/scripts.md @@ -201,6 +201,29 @@ print(Point) is not installed — see the documentation on [Python versions](../concepts/python-versions.md) for more details. +## Improving reproducibility + +uv supports an `exclude-newer` field in the `tool.uv` section of inline script metadata to limit uv +to only considering distributions released before a specific date. This is useful for improving the +reproducibility of your script when run at a later point in time. + +The date must be specified as an [RFC 3339](https://www.rfc-editor.org/rfc/rfc3339.html) timestamp +(e.g., `2006-12-02T02:07:43Z`). + +```python title="example.py" +# /// script +# dependencies = [ +# "requests", +# ] +# [tool.uv] +# exclude-newer = "2023-10-16T00:00:00Z" +# /// + +import requests + +print(requests.__version__) +``` + ## Using different Python versions uv allows arbitrary Python versions to be requested on each script invocation, for example: