uv-refresh
Rebuilds a uv project's pyproject.toml so every dependency gets freshly
resolved instead of dragging along old version pins.
How it works
- Read
pyproject.toml, collect the dependencies without their version specifiers (extras and environment markers are kept;include-groupentries independency-groupsare resolved, not dropped) - Back up
pyproject.tomlanduv.lockinto.uv-refresh-backup/<timestamp>/ - Run
uv init --bare+uv add <packages>in a temp directory next to the project -- the realpyproject.tomlstays untouched the whole time - Merge only
dependencies/optional-dependencies/dependency-groupsfrom the result into a copy of the ORIGINALpyproject.toml-- everything else stays untouched - Atomically swap the result in place of the old
pyproject.toml/uv.lock
If any step fails -- including Ctrl+C -- the real pyproject.toml was never
touched, since the whole build happened in the temp directory. The backup
is kept around as an extra reference regardless.
Installation
uv tool install uv-refresh
Makes uv-refresh permanently available as a command (globally on PATH).
For a one-off test run, without installing anything:
uvx uv-refresh --dry-run
Or straight from the repo, e.g. to try an unreleased version:
uv tool install git+https://github.com/Zorakidd/uv-refresh
Usage
uv-refresh --dry-run # just show what would happen, change nothing
uv-refresh # runs with a confirmation prompt
uv-refresh -y # no confirmation prompt
Options
| Flag | Effect |
|---|---|
--path PATH |
different project directory (default: current) |
--dry-run |
only show what would happen, touch nothing |
-y, --yes |
run without asking for confirmation |
-v, --verbose |
print the full new pyproject.toml at the end |
-q, --quiet |
only print warnings/errors, no status output |
--timeout SECONDS |
timeout per uv call, default 300s |
--raw |
add packages with no version bound at all |
--bounds {lower,major,minor,exact} |
kind of version bound uv add sets |
--keep-lock |
keep uv.lock (uv will then prefer the old versions!) |
--keep-backups N |
how many past backups to keep, oldest deleted first (default: 5, 0 keeps all) |
--no-groups |
ignore optional-dependencies and dependency-groups |
--full |
also bump requires-python and re-pin .python-version to the newest installed Python |
--drop-extras |
shrink fastapi[standard] down to fastapi |
--drop-markers |
drop environment markers |
--version |
show the uv-refresh version |
Note
Only dependencies, optional-dependencies and dependency-groups are
rewritten. Everything else -- description, readme, license,
authors, keywords, [project.urls], [project.scripts],
[build-system], [tool.*] and so on -- stays unchanged, because it's
never deleted: the tool only builds a minimal pyproject.toml temporarily
to resolve versions, then takes just the freshly resolved dependency lists
from it and writes those back into a copy of the original file.
One exception: with --no-groups, any existing
optional-dependencies/dependency-groups are intentionally removed (the
tool warns beforehand). Individual entries that can't be interpreted as a
PEP 508 string are skipped and reported per entry.
--full additionally bumps requires-python to the newest already
installed Python it can find (uv python list --only-installed -- it
never triggers a download on its own), e.g. >=3.11 becomes >=3.13. That
bump is part of the same atomic pyproject.toml rebuild as the dependency
refresh, so it's covered by the same backup/all-or-nothing guarantee.
Only once that rebuild has landed does --full re-pin .python-version via
uv python pin to that same version. This runs after the rebuild on
purpose: uv python pin refuses to write anything if the target version
doesn't satisfy requires-python, and by pinning after the bump above, it's
checked against the new requires-python -- so jumping to a newer Python
than the project previously allowed still works. If the pin itself then
fails, the dependency refresh and requires-python bump are kept regardless
(they already succeeded); only .python-version is left as it was.
Metadata
Release files for uv-refresh 0.1.12
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| uv_refresh-0.1.12.tar.gz | 11.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| uv_refresh-0.1.12-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 25.4 kB
Release files / uv_refresh-0.1.12.tar.gz
| Download URL | uv_refresh-0.1.12.tar.gz |
|---|---|
| Size | 11.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8e7b4c6e133ff1637c417580e769de8bbb7ffa16851e7f325f5d632e3dedab58
|
|
BLAKE2b-256 checksum How to use checksums |
29046dee2955949477d6b5dda33f62117ee148a5e02839a6e6e49da8520552b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 21, 2026.
Transparency logRelease files / uv_refresh-0.1.12-py3-none-any.whl
| Download URL | uv_refresh-0.1.12-py3-none-any.whl |
|---|---|
| Size | 13.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a70eedfe77bb5fc2e5e2967ee125e0be40e8473c7acdebed025947822908fc19
|
|
BLAKE2b-256 checksum How to use checksums |
33471a446d37642cd4e526ff45758b7cbf3be3799a2298fa344f86087afb6cdc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 21, 2026.
Transparency log