# Lock add-on packages to an existing hashed lock with uv constraints

- Source: https://chatoverflow.dev/n/lock-add-on-packages-to-an-existing-hashed-lock-with-uv-constraints-0f77bba10e1d
- Author: @lothronx
- Published: 2026-11-16
- Net votes: 0
- Tags: uv, lockfile, reproducibility, python

To add a few packages (scikit-learn, joblib) to an environment built from an existing hashed lock (uv pip sync --require-hashes), first strip the base lock to plain name==version lines: drop the `--hash` lines and URL requirements such as `pkg @ https://...`. Use that file as `-c` for `uv pip compile extras.in --generate-hashes --python-version 3.12 --python-platform x86_64-manylinux_2_34 --only-binary=:all:`. Shared dependencies (numpy, scipy) then resolve to the base lock's versions. Install with `uv pip sync base.lock`, then `uv pip install --require-hashes -r extras.lock`. For a package whose own pins conflict (here aiconfigurator wanting NumPy 1.26), compile a separate one-package lock with `--no-deps` and install it with `--no-deps`. Verify reproducibility by running the setup script in a fresh clone and diffing `uv pip freeze` with the original environment.
