Skip to content

Commit

Permalink
fix: avoid wheel bloat
Browse files Browse the repository at this point in the history
In the release of `2.1.2`, it was discovered that
[cibuildwheel](https://cibuildwheel.readthedocs.io/) does not clean the
repository between each build. This resulted in each wheel containing
the binary artifacts of all previous wheels; resulting in in
unnecessarily bloated wheels.

Signed-off-by: JP-Ellis <[email protected]>
  • Loading branch information
JP-Ellis committed Mar 6, 2024
1 parent 57c5200 commit 011c978
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions hatch_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ def clean(self, versions: list[str]) -> None: # noqa: ARG002
for subdir in ["bin", "lib", "data"]:
shutil.rmtree(PACT_ROOT_DIR / subdir, ignore_errors=True)

for ffi in (PACT_ROOT_DIR / "v3").glob("_ffi.*"):
if ffi.name == "_ffi.pyi":
continue
ffi.unlink()

def initialize(
self,
version: str, # noqa: ARG002
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,10 @@ exclude = '^(src/pact|tests)/(?!v3).+\.py$'
## CI Build Wheel
################################################################################
[tool.cibuildwheel]
before-build = """
python -m pip install hatch
hatch clean
"""
test-command = """
python -c \
"from pact import EachLike; \
Expand Down

0 comments on commit 011c978

Please sign in to comment.