Suppose you have some dependencies in pyproject.toml, e.g.
dependencies = [
"pyyaml==6.0.2",
]
When I run uv pip compile, I get nicely sorted list of hashes:
❯ uv pip compile --generate-hashes pyproject.toml
Resolved 1 package in 292ms
# This file was autogenerated by uv via the following command:
# uv pip compile --generate-hashes pyproject.toml
pyyaml==6.0.2 \
--hash=sha256:01179a4a8559ab5de078078f37e5c1a30d76bb88519906844fd7bdea1b7729ff \
--hash=sha256:0833f8694549e586547b576dcfaba4a6b55b9e96098b36cdc7ebefe667dfed48 \
...
--hash=sha256:f753120cb8181e736c57ef7636e83f31b9c0d1722c516f7e86cf15b7aa57ff12 \
--hash=sha256:ff3824dc5261f50c9b0dfb3be22b4567a6f938ccce4587b38952d85fd9e9afe4
# via uv-export-order (pyproject.toml)
However, when I run uv export, the order of the hashes is "random".
❯ uv export
Using CPython 3.13.0
Resolved 2 packages in 1ms
# This file was autogenerated by uv via the following command:
# uv export
pyyaml==6.0.2 \
--hash=sha256:d584d9ec91ad65861cc08d42e834324ef890a082e591037abe114850ff7bbc3e \
--hash=sha256:efdca5630322a10774e8e98e1af481aad470dd62c3170801852d752aa7a783ba \
...
--hash=sha256:bc2fa7c6b47d6bc618dd7fb02ef6fdedb1090ec036abab80d4681424b84c1183 \
--hash=sha256:8388ee1976c416731879ac16da0aff3f63b286ffdd57cdeb95f3f2e085687563
Of course, the ordering becomes clear when looking at the uv.lock file
[[package]]
name = "pyyaml"
version = "6.0.2"
source = { registry = "https://pypi.org/simple" }
sdist = { url = "https://files.pythonhosted.org/packages/54/ed/79a089b6be93607fa5cdaedf301d7dfb23af5f25c398d5ead2525b063e17/pyyaml-6.0.2.tar.gz", hash = "sha256:d584d9ec91ad65861cc08d42e834324ef890a082e591037abe114850ff7bbc3e", size = 130631 }
wheels = [
{ url = "https://files.pythonhosted.org/packages/ef/e3/3af305b830494fa85d95f6d95ef7fa73f2ee1cc8ef5b495c7c3269fb835f/PyYAML-6.0.2-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:efdca5630322a10774e8e98e1af481aad470dd62c3170801852d752aa7a783ba", size = 181309 },
# ...
{ url = "https://files.pythonhosted.org/packages/14/0d/e2c3b43bbce3cf6bd97c840b46088a3031085179e596d4929729d8d68270/PyYAML-6.0.2-cp313-cp313-win32.whl", hash = "sha256:bc2fa7c6b47d6bc618dd7fb02ef6fdedb1090ec036abab80d4681424b84c1183", size = 140527 },
{ url = "https://files.pythonhosted.org/packages/fa/de/02b54f42487e3d3c6efb3f89428677074ca7bf43aae402517bc7cca949f3/PyYAML-6.0.2-cp313-cp313-win_amd64.whl", hash = "sha256:8388ee1976c416731879ac16da0aff3f63b286ffdd57cdeb95f3f2e085687563", size = 156446 },
]
However, for comparability, it would be good to sort the hashes also when exporting. Maybe optionally using an option like --sort-hashes?
(Running uv 0.5.2 on WSL2 Ubuntu noble.)
Suppose you have some dependencies in
pyproject.toml, e.g.When I run
uv pip compile, I get nicely sorted list of hashes:However, when I run
uv export, the order of the hashes is "random".Of course, the ordering becomes clear when looking at the
uv.lockfileHowever, for comparability, it would be good to sort the hashes also when exporting. Maybe optionally using an option like
--sort-hashes?(Running uv 0.5.2 on WSL2 Ubuntu noble.)