Skip to content

feat(py_image_layer): configurable default layer compression#1220

Open
thirtyseven wants to merge 1 commit into
aspect-build:1.xfrom
thirtyseven:feat/layer-compression-flag-1x
Open

feat(py_image_layer): configurable default layer compression#1220
thirtyseven wants to merge 1 commit into
aspect-build:1.xfrom
thirtyseven:feat/layer-compression-flag-1x

Conversation

@thirtyseven

Copy link
Copy Markdown

Targets the 1.x branch.

Motivation

py_image_layer exposes a per-target compress attribute (default gzip), but there's no way to change the default across a build — you have to set compress = "zstd" on every target.

Change

Adds a //py:layer_compression string_flag (gzip|zstd, default gzip) and a :layer_compression_zstd config_setting. py_image_layer's compress now defaults to a select() over that flag instead of a hard-coded "gzip":

bazel build //path:layers --@aspect_rules_py//py:layer_compression=zstd
  • An explicit compress = "..." on the target still wins (the macro only applies the flag-driven default when compress is unset).
  • Default behavior is unchanged: gzip.

Test

  • buildifier --lint=warn clean on both files.
  • //py:layer_compression and //py:layer_compression_zstd analyze successfully.
  • Verified the select() resolves from a downstream package and flips with the flag (default → gzip branch, --@aspect_rules_py//py:layer_compression=zstd → zstd branch).

Note: the full //cases/oci/py_image_layer e2e build couldn't be exercised in my environment due to an unrelated Apple SDK download 403 in the venv-tool toolchain; CI should cover it.

Add a //py:layer_compression string_flag (gzip|zstd, default gzip) plus a
:layer_compression_zstd config_setting. py_image_layer's `compress` now
defaults to a select() over that flag instead of a hard-coded "gzip", so the
default compression can be flipped globally with
--@aspect_rules_py//py:layer_compression=zstd without setting `compress` on
every target. An explicit `compress` attr still wins.
@xangcastle xangcastle self-requested a review June 30, 2026 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant