Skip to content

Official Inference Code of EAGLE-4

feat(pkg): install ROCm from public indexes

Seyfal Sultanov1bdb5dc1e320
diff --git a/README.md b/README.md
index 3d53104..17e247c 100644
--- a/README.md
+++ b/README.md
@@ -102,11 +102,12 @@ speculative server is faster.
Install one patched engine per environment, then `eagle-harness==0.1.0` from PyPI. The
[v0.1.0 GitHub release](https://github.com/eagle-hq/EAGLE-4/releases/tag/v0.1.0) carries the engine wheels, not `eagle-harness`.
Use Python 3.12 for the CUDA engines and Python 3.10 for the ROCm wheel. The commands read their pins from the
-release settings file in this checkout:
+release settings file in the checkout. Run them, and start servers, from the directory that contains the checkout.
+Inside it, `python -m` would import the source tree's `eagle_harness/` instead of the installed wheel.
```bash
-git clone https://github.com/eagle-hq/EAGLE-4 && cd EAGLE-4
-. ./docs/release.env
+git clone https://github.com/eagle-hq/EAGLE-4
+. EAGLE-4/docs/release.env
```
SGLang on CUDA:
@@ -134,9 +135,8 @@ prove that kernels run or that generation is correct, so send the quickstart req
The [installation guide](docs/install.md) has the same steps for [vLLM](docs/install.md#vllm-cuda) and
[TokenSpeed](docs/install.md#tokenspeed-cuda-experimental), which needs its scheduler and kernel wheels from the
-same index. The SGLang ROCm fresh-install path is
-[still under qualification](docs/install.md#sglang-rocm-on-amd), so the [AMD recipe](docs/quickstart-amd.md)
-applies to an already-qualified MI355X environment only.
+same index. SGLang on AMD MI355X installs a hash-locked closure from PyPI, the ROCm index and AMD's indexes:
+follow [SGLang ROCm](docs/install.md#sglang-rocm-on-amd), then the [AMD recipe](docs/quickstart-amd.md).
## Serve
diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.md
index 27b952b..78eb405 100644
--- a/THIRD_PARTY_NOTICES.md
+++ b/THIRD_PARTY_NOTICES.md
@@ -85,3 +85,20 @@ Source-Available License is not such a license: it is not an open-source license
4c) excludes "separable proprietary components that are not derived from or modifications of the Software". No source
distribution carries the runtime in any case, because `MANIFEST.in` prunes `eagle_harness/kernels/_native` from the
sdist and a source install compiles `candidate.cu` against the CUDA toolkit already on the machine.
+
+## Redistributed ROCm wheels
+
+This section is separate from the eagle-harness notices above. The EAGLE-4 ROCm wheel index also serves three
+third-party wheels that no vendor index carries in the tested form. They are separate downloads, not part of
+eagle-harness, and each keeps the license files of its own source. Every other ROCm dependency is installed from
+PyPI or AMD's indexes, not from the EAGLE-4 index.
+
+| Wheel | Project and license | Change |
+|---|---|---|
+| `torch-2.9.1+rocm7.2.0.lw.git7e1940d4-1eagle-cp310-cp310-linux_x86_64.whl` | PyTorch, as built by AMD for ROCm 7.2. BSD-3-Clause. Its `LICENSE` and `NOTICE` ship unchanged in the wheel. | Modified metadata only: the requirement `triton==3.5.1+rocm7.2.0.gita272dfa8` is replaced by `triton==3.7.0+amd.rocm7.2.0.git89002410`, `WHEEL` gains build tag `1eagle`, and `RECORD` is regenerated (`tools/repack_rocm_torch.py`). Every other file is AMD's original. |
+| `sglang_kernel-0.4.7-1eagle-cp310-cp310-linux_x86_64.whl` | SGLang kernel package (`python/sglang/kernels/aot`). Apache-2.0. Copyright 2023-2024 SGLang Team. | Built from unmodified SGLang source for HIP `gfx950`. SGLang's `THIRDPARTYNOTICES.txt` from the same source is added to the wheel's license files (`tools/add_wheel_notices.py`). |
+| `amd_aiter-0.1.21.dev48+g4ad998328.d20260918-cp310-cp310-linux_x86_64.whl` | AITER. MIT. Copyright Advanced Micro Devices, Inc. It bundles composable_kernel (MIT, Advanced Micro Devices, Inc.), whose `LICENSE` ships in the wheel. | Built from ROCm/aiter revision `4ad99832` with the patches the SGLang v0.5.20 ROCm image applies: ROCm/aiter commits `7b481fb` and `24a62b1` (tuned GEMM configurations), a `functools.cache` edit and a `torch.Stream` compatibility edit. |
+
+The Torch wheel also contains two libraries that its `LICENSE` file does not name. Both are AMD's builds,
+redistributed unchanged: `libaotriton_v2.so` (AOTriton, MIT, Advanced Micro Devices, Inc.,
+<https://github.com/ROCm/aotriton>) and `libmagma.so` (MAGMA, BSD-3-Clause, <https://icl.utk.edu/magma/>).
diff --git a/docker/rocm/requirements.lock b/docker/rocm/requirements.lock
index de26de8..2a94482 100644
--- a/docker/rocm/requirements.lock
+++ b/docker/rocm/requirements.lock
@@ -108,7 +108,7 @@ sentencepiece==0.2.2 --hash=sha256:44284adc6fbe9d5bdd480541431a3d93f674fa4473671
setproctitle==1.3.7 --hash=sha256:00afa6fc507967d8c9d592a887cdc6c1f5742ceac6a4354d111ca0214847732c
setuptools==59.6.0 --hash=sha256:4ce92f1e1f8f01233ee9952c04f6b81d1e02939d6e1b488428154974a4d0783e
sglang==0.5.23.dev252+eagle.4.rocm --hash=sha256:4e336633bd19e8b15b9da7d7048ff7535daa2a209d458110014bcfe899b04285
-sglang-kernel==0.4.7 --hash=sha256:62c41313a71a1701243c0143884a8e117f286de7a4fdec14fdc7dfbacec6589c
+sglang-kernel==0.4.7 --hash=sha256:6573091a2ce00a2eee89c6420fb05bcfd44e5d6d8da3636273dd01dc03cc320d
shellingham==1.5.4 --hash=sha256:7ecfff8f2fd72616f7481040475a65b2bf8af90a56c89140852d1120324e8686
six==1.17.0 --hash=sha256:4721f391ed90541fddacab5acf947aa0d3dc7d27b2e1e8eda2be8970586c3274
smg-grpc-proto==0.4.18 --hash=sha256:1ed71e659f92d95a5528058ef668018421be2580a89010a90e651cb1694dfe64
diff --git a/docs/install.md b/docs/install.md
index 63344f7..3464eac 100644
--- a/docs/install.md
+++ b/docs/install.md
@@ -6,8 +6,8 @@ last_verified: 2026-10-20
# Install EAGLE-4 0.1.0
-Use one patched engine per environment. CUDA paths install `eagle-harness==0.1.0` from PyPI.
-The ROCm path uses a complete wheel bundle.
+Use one patched engine per environment. Every path installs from public package indexes:
+`eagle-harness==0.1.0` from PyPI and the patched engine from the EAGLE-4 wheel index.
Stock engine packages do not provide the required plugin hooks. Choose the pip or Docker path below,
then follow that engine's quickstart.
@@ -18,22 +18,25 @@ The engine wheels belong to the GitHub release named by `EAGLE_RELEASE_ASSETS`.
separate CUDA and ROCm wheels. The `eagle-harness` wheels and source distribution are published only to PyPI,
not to the GitHub Release. Publishing the public release runs `publish.yml` with PyPI trusted publishing.
-These are release destinations, not evidence that publication has completed. The PyPI project and public
-artifacts are not yet available for this draft. Fresh CUDA environments installed private wheels and served
-real requests, and the `eagle-harness` wheel and source-distribution forms passed installation checks. Those checks
-used a private index, not the public URLs. The private SGLang image also passed serving and correctness
-checks. vLLM image qualification is pending, and the TokenSpeed image has not been built. Final release
-artifacts and registry publication require separate checks.
-The private ROCm pip closure below was clean-installed and inference-tested. Its Docker recipe
-has not been container-qualified. Publication remains a separate release step.
+Fresh CUDA environments installed the engine wheels and served real requests, and the `eagle-harness`
+wheel and source-distribution forms passed installation checks. Those checks used a private index,
+not the public URLs. The private SGLang image also passed serving and correctness checks. vLLM image qualification is pending,
+and the TokenSpeed image has not been built. The ROCm pip path below was clean-installed from the public
+indexes and inference-tested on an MI355X. Its Docker recipe has not been container-qualified.
Do not replace an unavailable artifact with the stock engine or an unpinned package.
-Use the release checkout containing these docs. Run commands from its root:
+Clone the release checkout containing these docs and read its settings:
```bash
-. ./docs/release.env
+git clone https://github.com/eagle-hq/EAGLE-4
+. EAGLE-4/docs/release.env
```
+Run every command in this guide and in the quickstarts from the directory that contains the checkout,
+not from inside it. `python -m` puts the current directory first on the import path, so a server started
+inside the checkout imports the source tree's `eagle_harness/` instead of the installed wheel.
+`eagle-harness-check` cannot detect that, because a console script does not import from the current directory.
+
## Requirements
- Linux x86-64. Use Python 3.12 for CUDA engines and Python 3.10 for the ROCm wheel.
@@ -44,8 +47,8 @@ Use the release checkout containing these docs. Run commands from its root:
compilation, or use the release container's compatible toolchain. This does not change the wheel index.
- SGLang ROCm requires Ubuntu 22.04, the ROCm 7.2 developer toolkit (`hipcc` and headers),
a C++ compiler, Git, and an MI355X with a compatible host driver.
- Use the complete, hash-locked ROCm wheel bundle below. The upstream MI35x base and its
- custom PyTorch wheel use the CPython 3.10 ABI. Python 3.12 is not a supported substitute.
+ Install the hash-locked ROCm closure below. AMD's PyTorch build for ROCm 7.2 and the
+ engine wheel use the CPython 3.10 ABI. Python 3.12 is not a supported substitute.
- Docker needs NVIDIA GPU access for CUDA, or `/dev/kfd` and `/dev/dri` access for ROCm.
- Obtain readable target and compatible draft weights before serving. The quickstarts use
Qwen3.8-27B BF16 and its EAGLE-4 draft. Check the [support matrix](support-matrix.md) for other pairs.
@@ -82,39 +85,52 @@ Inside the container, use `/models` paths and `--host 0.0.0.0` in the
## SGLang ROCm on AMD
-Use the complete ROCm bundle with Python 3.10, not an isolated engine wheel or the CUDA index.
-The bundle contains `wheels/`, `requirements.lock`, `constraints.txt` and `SHA256SUMS`.
-Until the complete bundle is published with the release assets, obtain it from the release owner.
-The individual SGLang wheel in the engine index is insufficient.
-[The lock](../docker/rocm/requirements.lock) pins every package and wheel hash. The
-[constraints](../docker/rocm/constraints.txt) provide the corresponding exact versions.
-Do not use `--no-deps`, a source-overlay `PYTHONPATH`, or `--system-site-packages`.
+Install the complete ROCm closure with Python 3.10, not an isolated engine wheel or the CUDA index.
+[The lock](../docker/rocm/requirements.lock) pins every package version and wheel hash, so pip installs
+exactly the tested files and refuses anything else. The
+[constraints](../docker/rocm/constraints.txt) list the same versions without hashes.
+The wheels come from public indexes:
+
+| Wheels | Index |
+| --- | --- |
+| `eagle-harness` and most dependencies | PyPI |
+| The ROCm SGLang engine, plus the Torch, `sglang-kernel` and AITER builds described below | `EAGLE_ROCM_INDEX` |
+| Triton `3.7.0+amd.rocm7.2.0.git89002410` | AMD's Triton index, `EAGLE_AMD_TRITON_INDEX` |
+| Torchvision `0.24.0+rocm7.2.0.gitb919bd0c` | AMD's ROCm 7.2 wheel directory, `EAGLE_AMD_ROCM_WHEELS` |
-On the compatible ROCm host, set `EAGLE_ROCM_BUNDLE` to the absolute bundle directory:
+Do not use `--no-deps`, a source-overlay `PYTHONPATH`, or `--system-site-packages`.
+On the ROCm host, from the directory that contains the checkout:
```bash
-: "${EAGLE_ROCM_BUNDLE:?set the absolute path to the complete ROCm wheel bundle}"
-(cd "$EAGLE_ROCM_BUNDLE" && sha256sum -c SHA256SUMS)
unset PYTHONPATH
export PATH="/opt/rocm/bin:$PATH"
export LD_LIBRARY_PATH="/opt/rocm/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
python3.10 -m venv .venv-sglang-rocm
source .venv-sglang-rocm/bin/activate
-python -m pip install --no-index --find-links "$EAGLE_ROCM_BUNDLE/wheels" \
- --require-hashes -r "$EAGLE_ROCM_BUNDLE/requirements.lock"
+python -m pip install --require-hashes -r EAGLE-4/docker/rocm/requirements.lock \
+ --extra-index-url "$EAGLE_ROCM_INDEX" --extra-index-url "$EAGLE_AMD_TRITON_INDEX" \
+ --find-links "$EAGLE_AMD_ROCM_WHEELS"
python -m pip check
python -c 'import torch; assert torch.version.hip and torch.cuda.is_available(); print(torch.__version__, torch.version.hip)'
eagle-harness-check
```
-The bundle pairs `torch==2.9.1+rocm7.2.0.lw.git7e1940d4` with
-`triton==3.7.0+amd.rocm7.2.0.git89002410`, `apache-tvm-ffi==0.1.9`,
-`xgrammar==0.2.1` and the HIP `sglang-kernel==0.4.7` wheel for `gfx950`.
-The PyPI kernel wheel with the same version is a different, CUDA artifact.
-The Torch wheel has build tag `1eagle`: only dependency metadata and wheel records differ
-from the vendor wheel. Its runtime files are unchanged. The corrected metadata pins the Triton
-version used by the upstream MI35x image, rather than retaining the vendor wheel's incompatible
-Triton 3.5.1 pin. The lock's hash is required to select this build, not just its package version.
+The download is about 2.8 GB. The closure pairs `torch==2.9.1+rocm7.2.0.lw.git7e1940d4` with
+`triton==3.7.0+amd.rocm7.2.0.git89002410`, `apache-tvm-ffi==0.1.9`, `xgrammar==0.2.1`, AITER and
+the HIP `sglang-kernel==0.4.7` for `gfx950`. Three of these are not on their vendors' indexes in the
+tested form, so the EAGLE-4 index serves them. Each is selected by its hash, not just its version:
+
+- Torch, build tag `1eagle`, is AMD's ROCm 7.2 wheel with one dependency corrected. AMD's metadata pins
+ Triton 3.5.1, while AITER needs Triton 3.6 or newer. The rebuilt metadata pins the Triton build used
+ by the upstream SGLang MI35x image instead. Only the metadata, `WHEEL` and `RECORD` files differ from
+ AMD's wheel. Every runtime file and its license files are unchanged.
+- `sglang-kernel`, build tag `1eagle`, is the HIP build of SGLang's kernel package for `gfx950`.
+ PyPI's `sglang-kernel==0.4.7` is a different, CUDA build. The wheel adds SGLang's
+ `THIRDPARTYNOTICES.txt` to its license files.
+- AITER `0.1.21.dev48+g4ad998328.d20260918` is built from the AITER revision and patches that the
+ upstream SGLang MI35x image uses. AMD publishes no wheel of that build.
+
+[Third-party notices](../THIRD_PARTY_NOTICES.md#redistributed-rocm-wheels) lists their licenses and changes.
### Build the ROCm image
@@ -123,12 +139,15 @@ this same closure in an isolated Python 3.10 environment. It does not reuse the
editable SGLang installation. Container construction and serving must be qualified separately
before a release image is advertised as tested.
-Build with Docker BuildKit and the complete local wheel bundle:
+Download the locked wheels with the Python 3.10 environment above, then build with Docker BuildKit:
```bash
+python -m pip download --require-hashes -r EAGLE-4/docker/rocm/requirements.lock \
+ --extra-index-url "$EAGLE_ROCM_INDEX" --extra-index-url "$EAGLE_AMD_TRITON_INDEX" \
+ --find-links "$EAGLE_AMD_ROCM_WHEELS" --only-binary :all: -d rocm-wheels
docker buildx build --platform linux/amd64 --load \
- --build-context "rocm-wheels=$EAGLE_ROCM_BUNDLE/wheels" \
- -f docker/sglang-rocm.Dockerfile -t eagle-4-sglang-rocm:0.1.0 .
+ --build-context "rocm-wheels=$PWD/rocm-wheels" \
+ -f EAGLE-4/docker/sglang-rocm.Dockerfile -t eagle-4-sglang-rocm:0.1.0 EAGLE-4
docker run --rm --device=/dev/kfd --device=/dev/dri --group-add video \
--ipc host -it -p 127.0.0.1:30000:30000 -v "$PWD/models:/models:ro" \
--entrypoint bash eagle-4-sglang-rocm:0.1.0
@@ -208,6 +227,15 @@ and bind to `0.0.0.0`. This path is NVIDIA-only, not a ROCm recipe.
engine does not provide the expected contract. Fix that before loading weights. This check does not
prove GPU kernels work or generation is correct. The quickstart's generated response is a separate check.
+From the directory where you start servers, confirm that Python imports the installed package:
+
+```bash
+python -c 'import eagle_harness; print(eagle_harness.__file__)'
+```
+
+The printed path must be inside the environment's `site-packages`. A path inside the checkout means
+the server would run the source tree instead of the installed wheel.
+
For the SGLang and vLLM calibration CLI, also run:
```bash
@@ -224,7 +252,7 @@ The private CUDA image checks used a prebuilt `eagle-harness` wheel instead of t
so they do not qualify those Dockerfiles verbatim. The corrected SGLang TP4 image passed hook, dependency,
request and twenty-prompt correctness checks. vLLM image qualification is pending, TokenSpeed has no
built image, and ROCm has no container qualification.
-The ROCm recipe pins its upstream base by digest and requires the complete wheel bundle as a named
+The ROCm recipe pins its upstream base by digest and takes the downloaded locked wheels as a named
build context. The TokenSpeed sketch requires an explicit compatible `BASE_IMAGE`.
Do not infer container qualification from a successful pip installation or syntax check.
Final rebuilds and publication under the release tags are separate release steps.
diff --git a/docs/quickstart-amd.md b/docs/quickstart-amd.md
index cd1f731..5db4a2c 100644
--- a/docs/quickstart-amd.md
+++ b/docs/quickstart-amd.md
@@ -13,8 +13,11 @@ No `data_path` or profile environment variable is needed.
## Before starting
Complete the [ROCm installation](install.md#sglang-rocm-on-amd) in a fresh Python 3.10 environment,
-then run `python -m pip check` and `eagle-harness-check`. Use the entire locked wheel bundle, including
+then run `python -m pip check` and `eagle-harness-check`. Install the entire hash-locked closure, including
its corrected Torch wheel. An individually installed SGLang wheel is not a complete ROCm runtime.
+Run the commands below from the directory that contains the EAGLE-4 checkout, not from inside it.
+Inside the checkout, `python -m sglang.launch_server` imports the source tree's `eagle_harness/`
+instead of the installed wheel.
Use the ROCm 7.2 runtime and locally downloaded target and draft directories. Profile selection compares
both local `config.json` files with the measured pair, so an unresolved Hub identifier is not sufficient.
The profile applies to MI355X, including VF, BF16, TP1 and no quantization. It is not a generic AMD profile.
@@ -63,7 +66,9 @@ python -m sglang.launch_server --model-path "$MODEL" --tp-size 1 --dtype bfloat1
--speculative-algorithm-config '{"mode":"serve"}'
```
-Look for `selected packaged MI355X cost profile` in the startup log. If it is absent, check the
+Look for `selected packaged MI355X cost profile` in the startup log. The profile path on that line
+must be inside the environment's `site-packages`. A path inside the checkout means the server started
+from inside it, so stop the server and start it from the parent directory. If the line is absent, check the
GPU, dtype, TP size and local model configurations before assuming the measured profile is in use.
An explicit `data_path` overrides automatic selection. The packaged profile includes measured costs
for batch sizes 1, 8 and 32, but that does not qualify every batch size or context length.
diff --git a/docs/release.env b/docs/release.env
index 7509f0a..602761d 100644
--- a/docs/release.env
+++ b/docs/release.env
@@ -1,11 +1,14 @@
# Copyright 2026 Eagle AI Corp.
# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
-# Source from the repository root: . ./docs/release.env
+# Source it from the directory that contains the checkout: . EAGLE-4/docs/release.env
# Distribution locations for 0.1.0. Publication is a separate release gate.
export EAGLE_VERSION='0.1.0'
export EAGLE_WHEEL_ROOT='https://eagle-hq.github.io/EAGLE-4/whl'
export EAGLE_CUDA_INDEX="$EAGLE_WHEEL_ROOT/cu130/"
export EAGLE_ROCM_INDEX="$EAGLE_WHEEL_ROOT/rocm/"
+# AMD's indexes for the ROCm Triton and Torchvision builds in docker/rocm/requirements.lock.
+export EAGLE_AMD_TRITON_INDEX='https://pypi.amd.com/triton/release/rocm-7.2.0/simple/'
+export EAGLE_AMD_ROCM_WHEELS='https://repo.radeon.com/rocm/manylinux/rocm-rel-7.2/'
export EAGLE_RELEASE_ASSETS='https://github.com/eagle-hq/EAGLE-4/releases/tag/v0.1.0'
export EAGLE_IMAGE_ROOT='ghcr.io/eagle-hq/eagle-4'
export EAGLE_SGLANG_IMAGE="$EAGLE_IMAGE_ROOT-sglang:$EAGLE_VERSION"
diff --git a/tests/test_add_wheel_notices.py b/tests/test_add_wheel_notices.py
new file mode 100644
index 0000000..53afe80
--- /dev/null
+++ b/tests/test_add_wheel_notices.py
@@ -0,0 +1,84 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Adding notices to a built wheel changes its notices and metadata, never its runtime payload."""
+
+import csv
+import importlib.util
+import io
+import json
+from pathlib import Path
+import zipfile
+
+import pytest
+
+SPEC = importlib.util.spec_from_file_location(
+ "add_wheel_notices", Path(__file__).parents[1] / "tools/add_wheel_notices.py"
+)
+assert SPEC is not None and SPEC.loader is not None
+MODULE = importlib.util.module_from_spec(SPEC)
+SPEC.loader.exec_module(MODULE)
+
+NAME = "sglang_kernel-0.4.7"
+INFO = f"{NAME}.dist-info"
+
+
+def wheel(tmp_path):
+ source = tmp_path / f"{NAME}-cp310-cp310-linux_x86_64.whl"
+ with zipfile.ZipFile(source, "w") as archive:
+ binary = zipfile.ZipInfo("sgl_kernel/common_ops.so", date_time=(2020, 1, 2, 3, 4, 6))
+ binary.external_attr = 0o100755 << 16
+ archive.writestr(binary, b"\x00native\xff")
+ archive.writestr(f"{INFO}/METADATA", "Metadata-Version: 2.4\nName: sglang-kernel\nVersion: 0.4.7\n"
+ "License-File: LICENSE\n\nlong description\n")
+ archive.writestr(f"{INFO}/WHEEL", "Wheel-Version: 1.0\nTag: cp310-cp310-linux_x86_64\n")
+ archive.writestr(f"{INFO}/licenses/LICENSE", "Apache License\n")
+ archive.writestr(f"{INFO}/RECORD", "")
+ notice = tmp_path / "THIRDPARTYNOTICES.txt"
+ notice.write_text("Notice for flashinfer-ai/flashinfer\n")
+ return source, notice
+
+
+def test_adds_notice_build_tag_and_valid_record(tmp_path, wheel):
+ source, notice = wheel
+ receipt = MODULE.add_notices(source, tmp_path / "out", "1eagle", {"THIRDPARTYNOTICES.txt": notice})
+ output = tmp_path / "out" / receipt["output"]
+ assert output.name == f"{NAME}-1eagle-cp310-cp310-linux_x86_64.whl"
+ with zipfile.ZipFile(output) as archive:
+ assert archive.read(f"{INFO}/licenses/THIRDPARTYNOTICES.txt") == notice.read_bytes()
+ metadata = archive.read(f"{INFO}/METADATA").decode()
+ assert metadata.index("License-File: THIRDPARTYNOTICES.txt") < metadata.index("\n\nlong description")
+ assert "License-File: LICENSE\n" in metadata
+ assert archive.read(f"{INFO}/WHEEL").decode().endswith("Build: 1eagle\n")
+ assert archive.read("sgl_kernel/common_ops.so") == b"\x00native\xff"
+ info = archive.getinfo("sgl_kernel/common_ops.so")
+ assert (info.external_attr >> 16, info.date_time) == (0o100755, (2020, 1, 2, 3, 4, 6))
+ rows = list(csv.reader(io.StringIO(archive.read(f"{INFO}/RECORD").decode())))
+ assert {row[0] for row in rows} == set(archive.namelist())
+ assert receipt["unchanged_payload_members"] == 2
+ assert json.loads((tmp_path / "out" / f"{output.name}.json").read_text()) == receipt
+
+
[email protected]("case", ["build-tagged", "bad-build", "existing-notice", "no-notices"])
+def test_rejects_unsafe_inputs(tmp_path, wheel, case):
+ source, notice = wheel
+ build, notices = "1eagle", {"THIRDPARTYNOTICES.txt": notice}
+ if case == "build-tagged":
+ source = source.rename(source.with_name(f"{NAME}-1x-cp310-cp310-linux_x86_64.whl"))
+ elif case == "bad-build":
+ build = "eagle"
+ elif case == "existing-notice":
+ notices = {"LICENSE": notice}
+ else:
+ notices = {}
+ with pytest.raises(ValueError):
+ MODULE.add_notices(source, tmp_path / "out", build, notices)
+ assert not list(tmp_path.glob("out/*.whl"))
+
+
+def test_refuses_to_overwrite(tmp_path, wheel):
+ source, notice = wheel
+ MODULE.add_notices(source, tmp_path / "out", "1eagle", {"THIRDPARTYNOTICES.txt": notice})
+ with pytest.raises(FileExistsError):
+ MODULE.add_notices(source, tmp_path / "out", "1eagle", {"THIRDPARTYNOTICES.txt": notice})
diff --git a/tests/test_engine_release.py b/tests/test_engine_release.py
index 4480c4e..a82e211 100644
--- a/tests/test_engine_release.py
+++ b/tests/test_engine_release.py
@@ -4,6 +4,7 @@
"""Exercise the real publisher CLI against an isolated, file-backed gh fake."""
import hashlib
+import importlib.util
import json
import os
from pathlib import Path
@@ -52,10 +53,13 @@ if args[1] == "view":
print(json.dumps({"tagName": "v0.1.0", "isDraft": os.environ.get("GH_TEST_DRAFT") == "true",
"assets": [{"name": p.name} for p in remote.iterdir()]}))
elif args[1] == "upload":
- assert len(args) == 4, args
source = Path(args[3])
target = remote / source.name
- assert not target.exists(), "no clobber"
+ if args[4:] == ["--clobber"]:
+ assert source.name.endswith("-SHA256SUMS"), "only a manifest is ever replaced"
+ else:
+ assert len(args) == 4, args
+ assert not target.exists(), "no clobber"
shutil.copyfile(source, target)
elif args[1] == "download":
name = args[args.index("--pattern") + 1]
@@ -369,3 +373,125 @@ def test_draft_requires_explicit_opt_in_and_cannot_make_pages(tmp_path, release,
result = command("pages", TAG, tmp_path / "site")
assert result.returncode != 0
assert not (tmp_path / "site").exists()
+
+
+ALLOWED_THIRD_PARTY = (
+ ("torch", "2.9.1+rocm7.2.0.lw.git7e1940d4", "torch-2.9.1+rocm7.2.0.lw.git7e1940d4-1eagle-cp310-cp310-linux_x86_64.whl"),
+ ("sglang-kernel", "0.4.7", "sglang_kernel-0.4.7-1eagle-cp310-cp310-linux_x86_64.whl"),
+)
+
+
+def third_party(tmp_path, monkeypatch):
+ """Allow-listed third-party wheels plus an audited source tree whose lock pins their hashes."""
+ source = tmp_path / "audited-source"
+ (source / "tools").mkdir(parents=True)
+ (source / "docker/rocm").mkdir(parents=True)
+ for name in ("engine_release.py", "mk_index.py"):
+ shutil.copyfile(REPO / "tools" / name, source / "tools" / name)
+ monkeypatch.setattr(sys.modules[__name__], "TOOL", source / "tools/engine_release.py")
+ extra = []
+ for project, version, filename in ALLOWED_THIRD_PARTY:
+ path = tmp_path / filename
+ with zipfile.ZipFile(path, "w") as archive:
+ archive.writestr("x.dist-info/METADATA", f"Name: {project}\nVersion: {version}\n")
+ extra.append(path)
+ lock = source / "docker/rocm/requirements.lock"
+ lock.write_text("".join(
+ f"{project}=={version} --hash=sha256:{hashlib.sha256(path.read_bytes()).hexdigest()}\n"
+ for (project, version, _), path in zip(ALLOWED_THIRD_PARTY, extra)
+ ))
+ return extra, lock
+
+
+def test_extend_adds_allow_listed_third_party_wheels_and_indexes_them(tmp_path, release, third_party):
+ remote, log = release
+ extra, _ = third_party
+ engine = wheels(tmp_path, "rocm")
+ assert command("upload", TAG, "rocm", *engine).returncode == 0
+ released = (remote / "engine-rocm-SHA256SUMS").read_text()
+ # Without --extend a released manifest never changes.
+ result = command("upload", TAG, "rocm", *engine, *extra)
+ assert result.returncode != 0 and "SHA256 mismatch" in result.stderr
+ assert (remote / "engine-rocm-SHA256SUMS").read_text() == released
+ result = command("upload", "--extend", TAG, "rocm", *engine, *extra)
+ assert result.returncode == 0, result.stderr
+ manifest = (remote / "engine-rocm-SHA256SUMS").read_text()
+ assert released in manifest and len(manifest.splitlines()) == 3
+ uploads = [args for args in calls(log) if args[1] == "upload"]
+ assert "--clobber" in uploads[-1] and uploads[-1][3].endswith("engine-rocm-SHA256SUMS")
+ assert not any("--clobber" in args for args in uploads[:-1])
+ assert {Path(args[3]).name for args in uploads[-3:-1]} == {p.name for p in extra}
+ # A rerun verifies bytes and uploads nothing.
+ assert command("upload", "--extend", TAG, "rocm", *engine, *extra).returncode == 0
+ assert [args for args in calls(log) if args[1] == "upload"] == uploads
+ site = tmp_path / "site"
+ result = command("pages", TAG, site)
+ assert result.returncode == 0, result.stderr
+ for project, _, filename in ALLOWED_THIRD_PARTY:
+ page = (site / "whl/rocm" / project / "index.html").read_text()
+ digest = hashlib.sha256((remote / filename).read_bytes()).hexdigest()
+ assert f"releases/download/{TAG}/{filename.replace('+', '%2B')}#sha256={digest}" in page
+ assert not list(site.rglob("*.whl"))
+
+
[email protected]("case", ["drop-released", "change-released"])
+def test_extend_never_drops_or_changes_released_entries(tmp_path, release, third_party, case):
+ remote, log = release
+ extra, _ = third_party
+ engine = wheels(tmp_path, "rocm")
+ assert command("upload", TAG, "rocm", *engine, extra[0]).returncode == 0
+ released = (remote / "engine-rocm-SHA256SUMS").read_bytes()
+ uploads = [args for args in calls(log) if args[1] == "upload"]
+ if case == "drop-released":
+ result = command("upload", "--extend", TAG, "rocm", *engine, extra[1])
+ assert "--extend must keep every entry" in result.stderr
+ else:
+ with zipfile.ZipFile(engine[0], "a") as archive:
+ archive.writestr("extra.txt", "rebuilt")
+ result = command("upload", "--extend", TAG, "rocm", *engine, *extra)
+ assert "SHA256 mismatch" in result.stderr
+ assert result.returncode != 0
+ assert (remote / "engine-rocm-SHA256SUMS").read_bytes() == released
+ assert [args for args in calls(log) if args[1] == "upload"] == uploads
+
+
[email protected]("case", ["unlisted-upstream", "hash-not-locked", "other-channel"])
+def test_third_party_wheels_must_be_allow_listed_and_locked(tmp_path, release, third_party, case):
+ _, log = release
+ extra, lock = third_party
+ channel, artifacts = "rocm", [*wheels(tmp_path, "rocm"), *extra]
+ if case == "unlisted-upstream":
+ # torchvision is available from AMD's index, so it is never served here.
+ path = tmp_path / "torchvision-0.24.0+rocm7.2.0.gitb919bd0c-cp310-cp310-linux_x86_64.whl"
+ with zipfile.ZipFile(path, "w") as archive:
+ archive.writestr("x.dist-info/METADATA", "Name: torchvision\nVersion: 0.24.0+rocm7.2.0.gitb919bd0c\n")
+ lock.write_text(lock.read_text() + f"torchvision==0.24.0+rocm7.2.0.gitb919bd0c --hash=sha256:"
+ f"{hashlib.sha256(path.read_bytes()).hexdigest()}\n")
+ artifacts.append(path)
+ expected = "not an Eagle engine wheel"
+ elif case == "hash-not-locked":
+ lock.write_text(lock.read_text().replace(hashlib.sha256(extra[0].read_bytes()).hexdigest(), "0" * 64))
+ expected = "does not match the ROCm lock"
+ else:
+ channel, artifacts = "cu130", [*wheels(tmp_path, "cu130"), *extra]
+ expected = "not an Eagle engine wheel"
+ result = command("upload", TAG, channel, *artifacts)
+ assert result.returncode != 0
+ assert expected in result.stderr
+ assert not log.exists()
+
+
+def test_allow_list_is_pinned_by_the_shipped_rocm_lock():
+ spec = importlib.util.spec_from_file_location("engine_release", TOOL)
+ sys.path.insert(0, str(TOOL.parent))
+ try:
+ module = importlib.util.module_from_spec(spec)
+ spec.loader.exec_module(module)
+ finally:
+ sys.path.remove(str(TOOL.parent))
+ lock = module.read_lock(module.ROCM_LOCK)
+ assert set(module.THIRD_PARTY) == {"rocm"}
+ for filename in module.THIRD_PARTY["rocm"]:
+ name, version = filename.split("-")[:2]
+ assert lock[module.mk_index.normalize(name)][0] == version, filename
diff --git a/tests/test_install_docs.py b/tests/test_install_docs.py
new file mode 100644
index 0000000..cc4b044
--- /dev/null
+++ b/tests/test_install_docs.py
@@ -0,0 +1,56 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""The install guides run from outside the checkout and install ROCm from public indexes only."""
+
+from pathlib import Path
+import re
+
+import pytest
+
+REPO = Path(__file__).resolve().parents[1]
+GUIDES = [REPO / "README.md", *sorted((REPO / "docs").glob("*.md"))]
+
+
+def bash_blocks(path: Path) -> list[str]:
+ return re.findall(r"```bash\n(.*?)```", path.read_text(), re.S)
+
+
+def section(path: Path, heading: str) -> str:
+ return path.read_text().split(f"\n{heading}\n", 1)[1].split("\n## ", 1)[0]
+
+
+def release_settings() -> dict[str, str]:
+ text = (REPO / "docs/release.env").read_text()
+ return dict(re.findall(r"^export (EAGLE_[A-Z0-9_]+)=(.*)$", text, re.M))
+
+
[email protected]("guide", GUIDES, ids=lambda p: str(p.relative_to(REPO)))
+def test_guides_never_enter_the_checkout(guide):
+ # `python -m` imports from the current directory, so a server started inside the checkout
+ # runs the source tree's eagle_harness/ instead of the installed wheel.
+ for block in bash_blocks(guide):
+ assert not re.search(r"^\s*cd\s+EAGLE-4\b|&&\s*cd\s+EAGLE-4\b", block, re.M), block
+ assert ". ./docs/release.env" not in block, block
+
+
[email protected]("guide", GUIDES, ids=lambda p: str(p.relative_to(REPO)))
+def test_guide_variables_come_from_release_settings(guide):
+ settings = release_settings()
+ for block in bash_blocks(guide):
+ for name in re.findall(r"\$\{?(EAGLE_[A-Z0-9_]+)", block):
+ assert name in settings, f"{guide.name} uses {name}, which docs/release.env does not export"
+
+
+def test_rocm_install_uses_public_indexes_and_the_shipped_lock():
+ install = section(REPO / "docs/install.md", "## SGLang ROCm on AMD")
+ block = re.findall(r"```bash\n(.*?)```", install, re.S)[0]
+ command = block.replace("\\\n", " ")
+ assert "--no-index" not in command and "BUNDLE" not in command
+ lock = re.search(r"--require-hashes -r EAGLE-4/(\S+)", command)
+ assert lock and (REPO / lock[1]).is_file()
+ settings = release_settings()
+ for name in ("EAGLE_ROCM_INDEX", "EAGLE_AMD_TRITON_INDEX", "EAGLE_AMD_ROCM_WHEELS"):
+ assert f'"${name}"' in command
+ assert re.fullmatch(r"(['\"])(https://|\$EAGLE_WHEEL_ROOT/)\S+/\1", settings[name]), settings[name]
+ assert "release owner" not in (REPO / "docs/install.md").read_text()
diff --git a/tools/add_wheel_notices.py b/tools/add_wheel_notices.py
new file mode 100644
index 0000000..d58c28d
--- /dev/null
+++ b/tools/add_wheel_notices.py
@@ -0,0 +1,140 @@
+# Copyright 2026 Eagle AI Corp.
+# SPDX-License-Identifier: LicenseRef-Eagle-4-Source-Available
+
+"""Add license or notice files to a built third-party wheel under a new build tag.
+
+Use it when a wheel we built from upstream source omits notices its source tree
+carries (sglang-kernel's THIRDPARTYNOTICES.txt). The files go to
+``<dist-info>/licenses/`` with ``License-File`` metadata. WHEEL gains the build
+tag and RECORD is regenerated. Every other member keeps its bytes, mode and
+timestamp; the result is verified before the receipt is written.
+
+ python tools/add_wheel_notices.py <wheel> <destination> --build 1eagle NAME=PATH...
+"""
+
+import argparse
+import base64
+import copy
+import csv
+import hashlib
+import io
+import json
+from pathlib import Path
+import re
+import zipfile
+
+
+def sha256(path: Path) -> str:
+ digest = hashlib.sha256()
+ with path.open("rb") as stream:
+ for chunk in iter(lambda: stream.read(8 << 20), b""):
+ digest.update(chunk)
+ return digest.hexdigest()
+
+
+def record_hash(data: bytes) -> str:
+ return "sha256=" + base64.urlsafe_b64encode(hashlib.sha256(data).digest()).rstrip(b"=").decode()
+
+
+def add_notices(source: Path, destination: Path, build: str, notices: dict[str, Path]) -> dict:
+ parts = source.name.removesuffix(".whl").split("-")
+ if len(parts) != 5:
+ raise ValueError(f"expected a wheel without a build tag: {source.name}")
+ if not re.fullmatch(r"\d[A-Za-z0-9_.]*", build):
+ raise ValueError(f"a build tag starts with a digit: {build!r}")
+ if not notices or any(not re.fullmatch(r"[A-Za-z0-9_.-]+", name) for name in notices):
+ raise ValueError("give at least one NAME=PATH with a plain file name")
+ destination.mkdir(parents=True, exist_ok=True)
+ output = destination / ("-".join([*parts[:2], build, *parts[2:]]) + ".whl")
+ if output.exists():
+ raise FileExistsError(output)
+ with zipfile.ZipFile(source) as original:
+ names = original.namelist()
+ info_dir = f"{parts[0]}-{parts[1]}.dist-info"
+ metadata, wheel, record = (f"{info_dir}/{name}" for name in ("METADATA", "WHEEL", "RECORD"))
+ if not {metadata, wheel, record} <= set(names):
+ raise ValueError(f"missing {info_dir} METADATA, WHEEL or RECORD")
+ added = {f"{info_dir}/licenses/{name}": path.read_bytes() for name, path in notices.items()}
+ if added.keys() & set(names):
+ raise ValueError(f"wheel already contains {sorted(added.keys() & set(names))}")
+ wheel_text = original.read(wheel).decode()
+ if re.search(r"^Build:", wheel_text, re.M):
+ raise ValueError("wheel already has a build tag")
+ meta_text = original.read(metadata).decode()
+ head, separator, body = meta_text.partition("\n\n")
+ head += "".join(f"\nLicense-File: {name}" for name in notices)
+ changes = {
+ metadata: (head + separator + body).encode(),
+ wheel: (wheel_text.rstrip("\n") + f"\nBuild: {build}\n").encode(),
+ }
+ payload, rows = {}, []
+ with zipfile.ZipFile(output, "w", compression=zipfile.ZIP_DEFLATED) as rebuilt:
+ for name in names:
+ if name == record:
+ continue
+ data = changes.get(name, None)
+ if data is None:
+ data = original.read(name)
+ payload[name] = hashlib.sha256(data).hexdigest()
+ rows.append([name, record_hash(data), str(len(data))])
+ rebuilt.writestr(copy.copy(original.getinfo(name)), data)
+ template = original.getinfo(metadata)
+ for name, data in added.items():
+ info = zipfile.ZipInfo(name, date_time=template.date_time)
+ info.external_attr = 0o100644 << 16
+ info.compress_type = zipfile.ZIP_DEFLATED
+ rows.append([name, record_hash(data), str(len(data))])
+ rebuilt.writestr(info, data)
+ rows.append([record, "", ""])
+ buffer = io.StringIO(newline="")
+ csv.writer(buffer).writerows(rows)
+ rebuilt.writestr(copy.copy(original.getinfo(record)), buffer.getvalue())
+ attributes = {info.filename: (info.external_attr, info.date_time) for info in original.infolist()}
+ with zipfile.ZipFile(output) as rebuilt:
+ for info in rebuilt.infolist():
+ if info.filename in attributes and (info.external_attr, info.date_time) != attributes[info.filename]:
+ raise ValueError(f"archive attributes changed: {info.filename}")
+ for name, digest in payload.items():
+ if hashlib.sha256(rebuilt.read(name)).hexdigest() != digest:
+ raise ValueError(f"payload changed: {name}")
+ listed = set()
+ for name, digest, size in csv.reader(io.StringIO(rebuilt.read(record).decode())):
+ listed.add(name)
+ if name != record and (digest, size) != (record_hash(rebuilt.read(name)), str(len(rebuilt.read(name)))):
+ raise ValueError(f"RECORD mismatch: {name}")
+ if listed != set(rebuilt.namelist()):
+ raise ValueError("RECORD does not list exactly the archive members")
+ receipt = {
+ "input": source.name,
+ "input_sha256": sha256(source),
+ "output": output.name,
+ "output_sha256": sha256(output),
+ "build": build,
+ "added_members": {name: hashlib.sha256(data).hexdigest() for name, data in added.items()},
+ "changed_members": [metadata, wheel, record],
+ "unchanged_payload_members": len(payload),
+ "record_verified": True,
+ "archive_modes_and_timestamps_preserved": True,
+ }
+ (destination / f"{output.name}.json").write_text(json.dumps(receipt, indent=2) + "\n")
+ return receipt
+
+
+def main() -> None:
+ parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
+ parser.add_argument("source", type=Path)
+ parser.add_argument("destination", type=Path)
+ parser.add_argument("--build", required=True, help="wheel build tag, for example 1eagle")
+ parser.add_argument("notices", nargs="+", metavar="NAME=PATH")
+ args = parser.parse_args()
+ notices = {}
+ for item in args.notices:
+ name, separator, path = item.partition("=")
+ if not separator:
+ parser.error(f"expected NAME=PATH: {item}")
+ notices[name] = Path(path)
+ print(json.dumps(add_notices(args.source, args.destination, args.build, notices), indent=2))
+
+
+if __name__ == "__main__":
+ main()
diff --git a/tools/engine_release.py b/tools/engine_release.py
index 4959cb0..1664dca 100644
--- a/tools/engine_release.py
+++ b/tools/engine_release.py
@@ -8,6 +8,11 @@ Uploads require a complete channel's wheels. The checksum manifest is uploaded
last, so an interrupted upload cannot advertise an incomplete channel. Reruns
verify existing bytes instead of replacing assets. Nothing creates a release.
Pages indexes exactly the channels whose manifest the release carries.
+
+A channel serves our engine wheels plus, explicitly allow-listed, third-party
+wheels we rebuilt or repacked because no official index carries those builds.
+Each must match the channel's audited hash lock. ``upload --extend`` adds wheels
+to a released channel: the new manifest keeps every released entry unchanged.
"""
import argparse
@@ -31,6 +36,17 @@ REQUIRED = {
"rocm": {"sglang"},
}
WHEEL_NAME = re.compile(r"[A-Za-z0-9_][A-Za-z0-9_.+\-]*\.whl")
+# Never list a package users can get from its official index (PyPI, PyTorch, AMD).
+THIRD_PARTY = {
+ "rocm": {
+ # AMD's vendor wheel with only its Triton requirement corrected; tools/repack_rocm_torch.py.
+ "torch-2.9.1+rocm7.2.0.lw.git7e1940d4-1eagle-cp310-cp310-linux_x86_64.whl",
+ # HIP build for gfx950 (PyPI's 0.4.7 is a CUDA build) plus its upstream THIRDPARTYNOTICES.txt.
+ "sglang_kernel-0.4.7-1eagle-cp310-cp310-linux_x86_64.whl",
+ # AITER as built in upstream SGLang's MI35x image; AMD publishes no wheel of it.
+ "amd_aiter-0.1.21.dev48+g4ad998328.d20260918-cp310-cp310-linux_x86_64.whl",
+ },
+}
def validate_tag(tag: str) -> None:
@@ -48,7 +64,7 @@ def manifest_name(channel: str) -> str:
return "harness-SHA256SUMS" if channel == "harness" else f"engine-{channel}-SHA256SUMS"
-def validate_rocm_runtime(wheels: list[Path], lock: Path) -> None:
+def read_lock(lock: Path) -> dict[str, tuple[str, str]]:
expected = {}
for line in lock.read_text().splitlines():
if not line.strip() or line.startswith("#"):
@@ -62,6 +78,11 @@ def validate_rocm_runtime(wheels: list[Path], lock: Path) -> None:
expected[project] = (match[2], match[3])
if not expected:
raise ValueError("empty ROCm runtime lock")
+ return expected
+
+
+def validate_rocm_runtime(wheels: list[Path], lock: Path) -> None:
+ expected = read_lock(lock)
actual = {}
for wheel in wheels:
if not WHEEL_NAME.fullmatch(wheel.name):
@@ -76,7 +97,7 @@ def validate_rocm_runtime(wheels: list[Path], lock: Path) -> None:
missing = expected.keys() - actual.keys()
if missing:
raise ValueError(f"missing locked ROCm packages: {', '.join(sorted(missing))}")
- validate_wheels("rocm", [actual["sglang"]] if "sglang" in actual else [])
+ validate_wheels("rocm", [actual["sglang"]] if "sglang" in actual else [], rocm_lock=lock)
def validate_wheels(channel: str, wheels: list[Path], *, rocm_lock: Path | None = None) -> None:
@@ -85,6 +106,7 @@ def validate_wheels(channel: str, wheels: list[Path], *, rocm_lock: Path | None
return
names = set()
projects = set()
+ lock = rocm_lock if rocm_lock is not None else ROCM_LOCK
for wheel in wheels:
if not WHEEL_NAME.fullmatch(wheel.name) or wheel.name in names:
raise ValueError(f"invalid or duplicate wheel filename: {wheel.name}")
@@ -97,6 +119,10 @@ def validate_wheels(channel: str, wheels: list[Path], *, rocm_lock: Path | None
raise ValueError(f"not a harness wheel: {wheel.name}")
projects.add(project)
continue
+ if wheel.name in THIRD_PARTY.get(channel, ()):
+ if read_lock(lock).get(project) != (version, mk_index.sha256(wheel)):
+ raise ValueError(f"third-party wheel does not match the ROCm lock: {wheel.name}")
+ continue
if project == "eagle-harness" or "+eagle." not in version:
raise ValueError(f"not an Eagle engine wheel: {wheel.name}")
if (".rocm" in version) != (channel == "rocm"):
@@ -128,7 +154,7 @@ def verify(path: Path, digest: str) -> None:
def upload(tag: str, channel: str, wheels: list[Path], *, repository: str = REPOSITORY,
- draft: bool = False) -> None:
+ draft: bool = False, extend: bool = False) -> None:
validate_tag(tag)
validate_wheels(channel, wheels)
if channel == "harness" and any(mk_index.metadata(w)["version"] != tag.removeprefix("v") for w in wheels):
@@ -153,15 +179,26 @@ def upload(tag: str, channel: str, wheels: list[Path], *, repository: str = REPO
checksums[manifest.name] = mk_index.sha256(manifest)
before = work / "before"
before.mkdir()
- # Preflight every conflict before uploading anything; never use --clobber.
+ replace_manifest = False
+ # Preflight every conflict before uploading anything. Only --extend may replace the
+ # manifest, and only with a superset whose released entries keep their digests.
for path in files:
if path.name in existing:
gh("release", "download", tag, "--pattern", path.name, "--dir", str(before), repository=repository)
+ if path is manifest and extend and mk_index.sha256(before / path.name) != checksums[path.name]:
+ released = read_manifest(before / path.name)
+ kept = {name: digest for name, digest in checksums.items() if name in released}
+ if kept != released:
+ raise ValueError(f"--extend must keep every entry of {path.name} unchanged")
+ replace_manifest = True
+ continue
verify(before / path.name, checksums[path.name])
for path in files:
verify(path, checksums[path.name])
if path.name not in existing:
gh("release", "upload", tag, str(path), repository=repository)
+ elif path is manifest and replace_manifest:
+ gh("release", "upload", tag, str(path), "--clobber", repository=repository)
after = work / "after" / path.name
after.parent.mkdir(exist_ok=True)
gh("release", "download", tag, "--pattern", path.name, "--output", str(after), repository=repository)
@@ -214,6 +251,8 @@ def main() -> None:
upload_parser = commands.add_parser("upload", help="publish wheels to an existing GitHub Release")
upload_parser.add_argument("--repository", default=REPOSITORY)
upload_parser.add_argument("--draft", action="store_true", help="require a private repository and a draft release")
+ upload_parser.add_argument("--extend", action="store_true",
+ help="add wheels to a released channel; its released entries must not change")
upload_parser.add_argument("tag")
upload_parser.add_argument("channel", choices=UPLOAD_CHANNELS)
upload_parser.add_argument("wheels", type=Path, nargs="+")
@@ -223,7 +262,8 @@ def main() -> None:
args = parser.parse_args()
try:
if args.command == "upload":
- upload(args.tag, args.channel, args.wheels, repository=args.repository, draft=args.draft)
+ upload(args.tag, args.channel, args.wheels, repository=args.repository, draft=args.draft,
+ extend=args.extend)
else:
pages(args.tag, args.output)
except (ValueError, OSError, subprocess.CalledProcessError) as error: