# Rebuilding or refreshing the bundle

Run this on a host **with** network access, then move the directory across.
The build host must have the same architecture and a glibc no newer than the
target's (RHEL 9.6 is glibc 2.34, x86_64).

## Refresh both wheel sets

    cd gradio-template

    # Python 3.9 -- constraints are required, see the comments in the file
    python3.9 -m pip download -d wheels/py39 --only-binary=:all: \
        -c requirements/constraints-py39.txt -r requirements/gradio-py39.in

    # Python 3.12
    python3.12 -m pip download -d wheels/py312 --only-binary=:all: \
        -r requirements/gradio-py312.in

    # pip / setuptools / wheel for the venv bootstrap
    python3.9  -m pip download -d bootstrap/py39  --only-binary=:all: pip setuptools wheel
    python3.12 -m pip download -d bootstrap/py312 --only-binary=:all: pip setuptools wheel

`--only-binary=:all:` is deliberate: it makes the download fail loudly if a
dependency has no prebuilt wheel, rather than shipping an sdist that would need
a compiler on the offline host.

Download with the **real target interpreter** rather than
`--python-version`/`--platform`. Environment markers (`python_version <
"3.10"`, and similar) then resolve exactly as they will on the target.

## Regenerate the locks and manifest

    scripts/make-manifest.sh

This rewrites `requirements/gradio-py*.lock.txt` from whatever is in `wheels/`,
refreshes the sdists, and regenerates `MANIFEST.sha256`.

## Verify before shipping

    scripts/verify-offline.sh

18 checks must pass: an offline install plus 7 template launches plus a
`gradio_client` round trip, for each interpreter. As root it runs everything
inside `unshare -n`, so an accidental network dependency fails instead of
passing quietly.

## Moving to a different gradio version

Edit `requirements/gradio-py39.in` or `gradio-py312.in`, then redo the steps
above. Two constraints are load-bearing and must not be dropped while the
Python 3.9 set stays on the gradio 4.x branch:

* `huggingface-hub<1.0` -- gradio 4.44.1 imports `HfFolder`, removed in 1.0
* `pydantic<2.11` -- gradio_client 1.3.0 cannot parse pydantic 2.11+ schemas

Both are explained in `requirements/constraints-py39.txt` and
`docs/TROUBLESHOOTING.md`. gradio 5.0 raised its floor to Python 3.10, so 4.44.1
is the last release that runs on 3.9 at all; there is no newer 4.x to move to.

## Different architecture

Repeat the download steps on an `aarch64` host. The wheel filenames carry the
platform tag, so keep the two bundles separate.
