serhii.net

In the middle of the desert you can say anything you want

13 Jul 2026

Exclude directories when building UV packages

My package was 156mb because my tests/ were 120mb.

Uv uses hatchling

TL;DR add this to pyproject.toml

[tool.hatch.build.targets.sdist]
exclude = [
  "tests/"
]

Before/after:

# before
-rw-r--r--  1 sh sh 156M Jul 13 13:20 pkg-9.2.0.tar.gz
# after
-rw-r--r--  1 sh sh 8.3M Jul 13 13:15 pkg-9.3.0.tar.gz

# yay!
Nel mezzo del deserto posso dire tutto quello che voglio.
comments powered by Disqus