Skip to content

api: Export Starlark helpers through namespace structs - #379

Merged
daandemeyer merged 7 commits into
amutable:mainfrom
daandemeyer:distribution-api
Nov 2, 2026
Merged

daandemeyer merged 7 commits into
amutable:mainfrom
daandemeyer:distribution-api

Conversation

@daandemeyer

Copy link
Copy Markdown
Member

Some distribution, Python and platform helpers still export individual
names. Let's export a namespace struct from each public facade and use the
public box facade where it introduces no load cycles. Internal modules and
the dependencies of a facade keep direct imports. The platform directory
matches its singular namespace.

Python suites use python.test(), with an optional box selecting their
interpreter and package environment. The generated type check uses the
same environment. python.binary() takes the same optional box instead of a
separate box_binary macro.

Generated RPM branch BUCK files call rpm.branch from the public facade. The
image layer operations are defined once as the ops struct that the image
facade forwards.

tine buck run tine//tools:check passes all 39 test targets.

@martinpitt martinpitt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Needs a rebase, and I'm really curious how this changes the image contents?

Comment thread examples/image/expected.json Resolved
The distribution helpers don't follow the namespace API used elsewhere.
Let's expose release and signing key helpers through a struct for each
distribution.

Signed-off-by: Daan De Meyer <daan@amutable.com>
Shared helpers and the Python and platform APIs still export individual
names. Let's export namespace structs and use the existing box facade
where the load graph permits it. We also fold the box-hosted Python binary
into python.binary() as a box argument, so the python namespace has one
binary macro.

Signed-off-by: Daan De Meyer <daan@amutable.com>

@martinpitt martinpitt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Probably needs another push for the updated ARM digests)

The directory uses a plural name while its public namespace is singular.
Let's use platform/ for the directory and labels. The labels seed image
UUIDs, so let's refresh the x86 and arm64 image digests as well.

Signed-off-by: Daan De Meyer <daan@amutable.com>
Python suites require a box even when they only use the standard library.
Let's expose python.test() with an optional box and check each suite
against the environment it runs in.

Signed-off-by: Daan De Meyer <daan@amutable.com>
Generated branch BUCK files load rpm_branch from generated.bzl, which is an
implementation module rather than the public rpm facade. Let's add the macro
to the facade as rpm.branch and have the importer emit calls to rpm.branch.
A BUCK generated before keeps working, since generated.bzl still exports
rpm_branch.

Signed-off-by: Daan De Meyer <daan@amutable.com>
The BUCK that the importer generates for a branch calls rpm_branch, and
nothing calls rpm_package_json. Let's delete it and point the importer
comments at rpm.branch.

Signed-off-by: Daan De Meyer <daan@amutable.com>
The image facade builds image.ops from thirteen functions that it loads one
by one. compose.bzl calls the same functions by their bare names, so each
operation has two names. Let's define the ops struct in image.bzl, make the
functions private, and have the facade and compose.bzl use the struct.

Signed-off-by: Daan De Meyer <daan@amutable.com>
@daandemeyer

Copy link
Copy Markdown
Member Author

Failure is a flake

@daandemeyer
daandemeyer merged commit 85295da into amutable:main Nov 2, 2026
4 of 5 checks passed
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.

2 participants