-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FR: An alternative API design for easier apt.install #123
Comments
This is serendipitous 😄 I didn't see this issue until I got notified when you mentioned it in #56 but last week I was also drafting an almost exact API! I've been thinking about it since my reviews to those old PRs and the issues I found with the architectures. I 200% love this, the current API conflates the architecture of TL;DRHere's a quick overview of how I was drafting a new API, incorporating some of your
apt = use_extension("@rules_distroless//apt:extensions.bzl", "apt")
apt.sources(
name = "bookworm",
file = "//apt/sources/bookworm.sources",
)
apt.sources(
name = "docker",
file = "//apt/sources/docker.list",
)
apt.install(
name = "base"
# architectures = ["arm64"],
sources = ["@apt//sources/bookworm"],
packages = "//apt/packages/bookworm.yaml",
lock = "//apt/packages/bookworm.lock.json",
)
# defaults to the "nolock = True" behavior
apt.install(
name = "docker"
# architectures = ["arm64"],
sources = ["@apt//sources/docker"],
packages = "//apt/packages/docker.yaml",
)
use_repo(apt, "apt")
# update sources repo
$ bazel run @apt//sources/bookworm:update
# make / update install lock
$ bazel run @apt//install/base:lock
Types: deb
Architectures: amd64 arm64
URIs: http://deb.debian.org/debian
Suites: bookworm bookworm-updates
Components: main contrib non-free non-free-firmware
Types: deb
Architectures: amd64 arm64
URIs: http://deb.debian.org/debian-security
Suites: bookworm-security
Components: main contrib non-free non-free-firmware
packages:
- coreutils # for commands like `ls`
# for apt list --installed
- dpkg
- apt
- perl
# docker packages
- docker
packages:
- docker
load("@rules_oci//oci:defs.bzl", "oci_image")
oci_image(
name = "base",
architecture = select({
"@platforms//cpu:arm64": "arm64",
"@platforms//cpu:x86_64": "amd64",
}),
os = "linux",
tars = [
"@apt//install/bookworm",
],
)
oci_image(
name = "docker",
base = ":base",
tars = [
"@apt//install/docker",
],
) CommentsHere's a long version of the TL;DR above with more explanations. Also, I've used folded sections to avoid a "wall of text". apt.sources: support DEB822 .sources format
|
All the ideas look nice! @jjmaestro, one minor suggestion for you to consider: for a really excellent developer experience, make liberal use of comments in the lockfile to include extra information. We use uv for managing python packages, and the # This file was autogenerated by uv via the following command:
# uv pip compile requirements.in -o requirements.txt --override overrides.txt
...
...
colorama==0.4.6
# via
# anyscale
# halo
# log-symbols
coloredlogs==15.0.1
# via onnxruntime
colorful==0.5.6
# via ray
comm==0.2.2
# via
# ipykernel
# ipywidgets
contextlib2==21.6.0
# via ml-collections
contourpy==1.3.1
# via matplotlib
coverage==7.6.10
# via pytest-cov
...
... In python |
I think this would be clear from the format of the lock itself. If you check it out, for every package there's a |
The text was updated successfully, but these errors were encountered: