When you run pip install stevedore, pip downloads a wheel that was built on a machine you’ve never seen, with build tools you didn’t pick. Most days that’s fine. If you’re on a security team, ship to machines with no internet access (air-gapped), or need every binary built the same way, it isn’t.

Fromager rebuilds a package and everything needed to build it from source. In this post you’ll go from an empty folder to a small set of source-built wheels, install them with plain pip, and pin the build so you can repeat it.

What we’ll build

We’ll build stevedore, a small plugin-loading library from OpenStack. It’s a good first target because its tree is tiny but not trivial: stevedore needs pbr to build, and pbr needs setuptools to build.

Dependency tree: stevedore 5.10.0 needs pbr 7.1.3 at build time; pbr needs setuptools 84.2.1 at build time and at install time. The pbr and setuptools boxes are shaded as build-only.

Figure 1. One requirement, three builds: stevedore needs pbr to build, and pbr needs setuptools to build and run. Only stevedore ends up installed

pip never shows you this chain, because a ready-made wheel needs no build tools. Fromager has to walk all of it. Keep one distinction in mind for the rest of the post:

  • A build dependency is something a package needs while it’s being turned into a wheel (here, pbr for stevedore).
  • An install dependency is something it needs once it’s installed and running.

stevedore 5.10.0 has no install dependencies at all; pbr is only needed to build it. Remember that: it’s why one of Fromager’s output files will turn out to have a single line.

Prerequisites

  • Python 3.12 or newer. Fromager 0.105.0 requires it. Check with python3 --version.
  • macOS or Linux with network access to PyPI. I ran this on macOS; for real work, Fromager’s docs recommend a build container.
  • No compiler is needed for this example, because all three packages are pure Python.

Step 1: Install Fromager

Create a folder and a virtual environment (an isolated set of installed packages, so Fromager doesn’t touch your system Python), then install a pinned version of Fromager:

mkdir -p fromager-quickstart cd fromager-quickstart python3.12 -m venv .venv # or python3.13, whichever 3.12+ you have source .venv/bin/activate python -m pip install --upgrade pip python -m pip install "fromager==0.105.0" fromager --version 
fromager, version 0.105.0 

You can pin the version. Fromager moves quickly and output formats may change between releases. Keep this terminal open: the later steps assume .venv is still active.

Step 2: Run your first bootstrap

Fromager reads the same requirements.txt format as pip. Ask for one package and run bootstrap, which is Fromager’s name for “resolve a package (pick a concrete version), download its source, build it, and repeat for every dependency”:

echo "stevedore" > requirements.txt fromager bootstrap -r requirements.txt 

Here is the output, trimmed to the lines that matter:

INFO primary settings file: overrides/settings.yaml INFO variant: cpu INFO started wheel server at http://127.0.0.1:49229/simple/ INFO stevedore: stevedore==1.0.0.0a2: no sdist available, only a wheel (skipped) INFO stevedore-5.10.0: new toplevel dependency stevedore resolves to 5.10.0 INFO pbr-7.1.3: new build-system dependency pbr>=6.1.1 resolves to 7.1.3 INFO setuptools-84.2.1: new build-system dependency setuptools>=64.0.0; python_version >= "3.7" resolves to 84.2.1 INFO setuptools-84.2.1: built wheel for version 84.2.1: …/wheels-repo/downloads/setuptools-84.2.1-0-py3-none-any.whl INFO pbr-7.1.3: built wheel for version 7.1.3: …/wheels-repo/downloads/pbr-7.1.3-0-py2.py3-none-any.whl INFO stevedore-5.10.0: built wheel for version 5.10.0: …/wheels-repo/downloads/stevedore-5.10.0-0-py3-none-any.whl INFO writing installation dependencies to …/work-dir/constraints.txt 

Figure 2. What fromager bootstrap did in this run: discover the tree top-down, then build bottom-up, publishing each wheel to a local server so the next build installs it from there.

The first two lines are defaults: optional per-package settings files (you have none yet) and the build variant, which matters when you build the same packages for different hardware. Later posts use both. After that, Fromager:

  1. Started a local wheel server on a random port. Every wheel it builds is published there, so later builds install your freshly built setuptools instead of fetching one from PyPI.
  2. Resolved stevedore to 5.10.0, the newest release with an sdist. Fromager skips any version that only has a wheel, since there’s no source to build from; that’s the 1.0.0.0a2 line.
  3. Downloaded the sdist and read its build requirements: pbr>=6.1.1. Fromager’s log calls these build-system dependencies. It did the same for pbr, which asked for setuptools>=64.0.0.
  4. Built bottom-up, discovering as it went. A package’s build backend can ask for more build dependencies, but only once the first ones are installed. So Fromager built setuptools, installed it into pbr‘s build environment (a temporary environment used only to build pbr), asked pbr‘s build backend whether it needed anything else, built pbr and then did the same for stevedore.
  5. Wrote constraints.txt, which we’ll look at in a moment.

The full log is noisier than this. Two kinds of message look alarming:

  • Safe to ignore: setuptools, which does the actual building for both setuptools itself and pbr, prints long BuildBackendWarning boxes saying a package “would be ignored”. It’s a packaging-hygiene warning aimed at the upstream projects: their test folders are included in an ambiguous way that a future setuptools may stop accepting. They still go into the wheel today, and the build carries on.
  • Worth knowing about: Fromager logs scan_compiled_extensions has detected potential issues for cli.exe, gui.exe and similar files. Those are prebuilt Windows launchers that ship inside the setuptools source archive. They end up in your setuptools wheel too, so that wheel isn’t 100% built from source. Fromager warns but doesn’t remove them. Treat the warning as a pointer to look closer, not as a security scan; Fromager’s source describes the check as a helper for spotting packaging issues.

Step 3: Look at what you got

Fromager wrote three folders next to your requirements.txt. Here’s the tree, trimmed:

. ├── requirements.txt ├── sdists-repo/ │ ├── downloads/ # the original sdists from PyPI │ └── builds/ # sdists rebuilt by Fromager (no patches applied here; patching comes later) ├── wheels-repo/ │ ├── downloads/ # your built wheels │ └── simple/ # a local package index pip can read └── work-dir/ ├── build-order.json ├── graph.json ├── constraints.txt └── stevedore-5.10.0/ # one folder per package: build.log and the requirements Fromager found 

The wheels

ls wheels-repo/downloads/ 
pbr-7.1.3-0-py2.py3-none-any.whl setuptools-84.2.1-0-py3-none-any.whl stevedore-5.10.0-0-py3-none-any.whl 

One requirement produced three wheels, because Fromager built the build tools too.

Notice the -0 after each version. That’s a build tag, an optional field in a wheel filename. Fromager adds one to every wheel it builds, which makes its wheels easy to tell apart from PyPI’s. Under the wheel spec, the build tag breaks ties: if two wheels match in name, version and every other tag, the higher build tag wins. You can raise it to ship a fixed rebuild without changing the version number; a later post shows how.

The rest of each name (py3-none-any, or py2.py3-none-any for pbr) marks these as pure-Python wheels that work on any platform, so the wheels I built on a Mac would install fine on Linux. A later post in the series decodes these tags in full.

build-order.json

This is the order Fromager built things in, bottom-up, with your top-level package last. The first entry, trimmed:

{ "dist": "setuptools", "version": "84.2.1", "constraint": "", "prebuilt": false, "source_url": "https://files.pythonhosted.org/packages/70/b3/…/setuptools-84.2.1.tar.gz" } 

prebuilt: false means Fromager built this wheel itself rather than reusing an existing one. constraint is empty because we haven’t pinned anything yet (Step 5 changes that). And source_url records exactly which archive each wheel came from.

graph.json

graph.json records every dependency edge and what kind it is. You rarely need to read it by hand; fromager graph why answers “why is this package here?”:

fromager graph why work-dir/graph.json setuptools 
setuptools==84.2.1 * setuptools==84.2.1 is an build-system dependency of pbr==7.1.3 with req setuptools>=64.0.0; python_version >= "3.7" * setuptools==84.2.1 is an install dependency of pbr==7.1.3 with req setuptools 

So pbr needs setuptools both to build and to run. If you open the file, you’ll also see three separate edges from stevedore to pbr. Python’s build standards give a project three places to declare build dependencies: a fixed list in pyproject.toml (PEP 518), plus two questions the build backend can answer before building a wheel or an sdist (PEP 517). Fromager records each answer separately. A later post reads the graph in depth.

constraints.txt

cat work-dir/constraints.txt 
stevedore==5.10.0 

A constraints file looks like requirements.txt but works differently. It never adds packages; it only says “if you need this package, use exactly this version.” Fromager writes one for your top-level packages and everything they need at install time, pinned to the versions it built, so they can all be installed together.

That’s why there’s only one line. stevedore has no install dependencies. setuptools is an install dependency of pbr, but pbr itself is only a build tool here: nothing you install at the end needs pbr, so pbr‘s own install dependencies don’t belong in the file either.

Step 4: Install from your own wheels

Now check that the wheels install. Use a fresh virtual environment, not the one Fromager lives in. Fromager itself depends on stevedore, so .venv already has a copy from PyPI, and testing there would prove nothing.

python -m venv .venv-test .venv-test/bin/pip install --no-index --find-links wheels-repo/downloads stevedore .venv-test/bin/python -c "import stevedore, importlib.metadata as m; print('stevedore', m.version('stevedore'), 'from', stevedore.__file__)" 
Looking in links: wheels-repo/downloads Processing ./wheels-repo/downloads/stevedore-5.10.0-0-py3-none-any.whl Installing collected packages: stevedore Successfully installed stevedore-5.10.0 stevedore 5.10.0 from …/.venv-test/lib/python3.12/site-packages/stevedore/__init__.py 

--find-links wheels-repo/downloads tells pip to look for wheels in that folder, and --no-index stops it from looking at PyPI at all. If a wheel were missing, the install would fail loudly instead of falling back to PyPI. The Processing line confirms pip used your -0 wheel, and the last line (from the small Python check) shows the version and where it was installed.

Step 5: Pin the whole tree

Builds that resolve “latest” drift: if setuptools ships a new release tomorrow, your next bootstrap uses it. To stop that, pass a constraints file with the -c option.

The file Fromager wrote pins only stevedore, because it lists only install dependencies. To pin the build tools as well, create your own constraints.txt next to requirements.txt (separate from the one in work-dir/) and list them. Here I pin setuptools to the release before the newest one, 84.2.0, so you can see the pin take effect:

printf 'stevedore==5.10.0\npbr==7.1.3\nsetuptools==84.2.0\n' > constraints.txt fromager -c constraints.txt -O pinned bootstrap -r requirements.txt 

Gotcha: where -c goes matters. -c is a global option, so it must come before bootstrap. After bootstrap, -c means something else: --cache-wheel-server-url. Other short flags have the same split, so check fromager --help against fromager bootstrap --help.

-O pinned writes everything into a separate pinned/ folder so you can compare with the first run. Here’s the log, trimmed:

INFO constraints files: constraints.txt INFO stevedore-5.10.0: incoming requirement stevedore matches constraint stevedore==5.10.0. Will apply both. INFO pbr-7.1.3: incoming requirement pbr>=6.1.1 matches constraint pbr==7.1.3. Will apply both. INFO setuptools-84.2.0: new build-system dependency setuptools>=64.0.0; python_version >= "3.7" resolves to 84.2.0 INFO setuptools-84.2.0: incoming requirement setuptools>=64.0.0; python_version >= "3.7" matches constraint setuptools==84.2.0. Will apply both. 

The log names your constraints file, then notes each package that matches a constraint. “Will apply both” means Fromager keeps the package’s own requirement (>=64.0.0) and your pin, and picks a version that satisfies both. The setuptools lines show the pin taking effect: it resolves to 84.2.0, not 84.2.1. The run took 18 seconds, pinned/wheels-repo/downloads/ now holds setuptools-84.2.0-0-py3-none-any.whl, and the constraint fields in pinned/work-dir/build-order.json are filled in.

A pin has to fit what packages ask for. When I pinned setuptools==63.4.3, below the >=64.0.0 that pbr requires, the bootstrap stopped with an error that names the conflict and the dependency chain. Here’s the error, trimmed:

ERROR Unable to resolve requirement specifier setuptools>=64.0.0; python_version >= "3.7" with constraint setuptools==63.4.3 … (dependency chain: stevedore==5.10.0 -> pbr==7.1.3 -> setuptools>=64.0.0; python_version >= "3.7") 

Build tools affect the result even when your package’s version stays the same: built with setuptools 84.2.0, the pbr wheel came out different (one byte smaller) from the one in the first run. That’s why you pin them. Pinning gets you the same inputs, but on its own it doesn’t guarantee byte-identical outputs; later posts cover repeatable builds and constraints for larger sets of packages.

When a build fails

This example had nothing to compile, so it built cleanly. Real packages will fail sometimes. Three things help:

  • Read work-dir/-/build.log for the failing package. It has the build backend’s full output.
  • Keep going past failures with fromager bootstrap --test-mode -r requirements.txt, which reports every failure at the end instead of stopping at the first.
  • Build in a container. A known build image makes failures reproducible and keeps your laptop’s libraries out of your wheels.

The Getting Started guide explains how to debug a failing build and work around it, for example by marking a package as pre-built while you fix it.

To start over at any point, delete sdists-repo/, wheels-repo/, work-dir/ and (if present) pinned/. Fromager reuses any wheels it finds there, so if you leave them, the next run won’t rebuild everything from scratch.

Trade-offs: when to use this, and when not to

  • Source builds aren’t free, so it’s worth being clear about what you’re buying.
  • Cost: you’re now responsible for running builds. A tree with compiled packages (NumPy, PyTorch, cryptography) needs compilers, Rust toolchains and system libraries, and can take hours instead of seconds.
  • Maintenance: when upstream changes how a package builds, your build can break even though pip install from PyPI still works. Fixing it is your job.
  • What you get: a record of where every wheel came from (source_url, graph.json), build tools you built and pinned yourself, wheels marked with your own build tag and a local index you can install from offline.

If you just need packages on a laptop, pip install from PyPI is the right tool. You can also build from source with pip (--no-binary :all: tells it to skip ready-made wheels), and since pip 25.3 it can pin build tools with --build-constraint. What it doesn’t do is record the build-tool tree it used or keep those build tools as wheels you can serve to later builds; a later post in the series sets the two side by side. Fromager earns its cost when you need to control, and keep a record of, how every wheel was made, including the build tools.

Recap

  • Fromager builds a package and its build tools from source. One requirement produced three wheels.
  • It keeps build dependencies and install dependencies apart, and the constraints.txt it writes lists only install dependencies.
  • Everything it builds gets a build tag (-0), and pip install --no-index --find-links installs it without touching PyPI.
  • To pin the whole tree, list the build tools in your own constraints file, and put -c before bootstrap.

Try it: replace stevedore with a package from your own project’s requirements.txt and see how many build dependencies show up. Then run fromager graph why work-dir/graph.json <package> on the one you didn’t expect. If a package in your tree won’t build, open an issue on Fromager’s GitHub and tell us (the maintainers) what broke.