From c6baaf871ac4c8462c325de44105e193bb2e1e93 Mon Sep 17 00:00:00 2001 From: Antonio Paolillo Date: Tue, 5 May 2026 17:08:34 +0200 Subject: [PATCH] build: Exclude venv dirs from sdist/wheel The previous configuration only excluded venv directories via the wheel target's exclude list. Since hatchling's sdist target defaults to including everything not in .gitignore, a `.venv-release/` created in the project root during the release procedure leaked into the tarball. Mirror pythainer's fix: - add a top-level [tool.hatch.build] exclude for venv/env/cache/git dirs that both targets inherit; - add an explicit [tool.hatch.build.targets.sdist] exclude block (the actual fix); - harmonize the wheel exclude patterns to use root-anchored globs. Signed-off-by: Antonio Paolillo --- pyproject.toml | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 45c0a339..2af7650c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,6 +28,24 @@ benchkit = "benchkit.cli:main" requires = ["hatchling"] build-backend = "hatchling.build" +[tool.hatch.build] +exclude = [ + "/.venv*", + "/venv*", + "/env*", + "/__pycache__", + "*.pyc", + "/.git", + "/.github", +] + +[tool.hatch.build.targets.sdist] +exclude = [ + "/.venv*", + "/venv*", + "/env*", +] + [tool.hatch.build.targets.wheel] include = [ "benchkit/", @@ -38,8 +56,9 @@ include = [ "tutorials/", ] exclude = [ - "venv*/", - ".venv*/", + "/.venv*", + "/venv*", + "/env*", ] [tool.black]