|
| 1 | +Bootstrap vs Build |
| 2 | +================== |
| 3 | + |
| 4 | +Fromager has two distinct modes of operation: **bootstrap** and **build**. |
| 5 | +Understanding the difference is key to using fromager effectively. |
| 6 | + |
| 7 | +.. seealso:: |
| 8 | + |
| 9 | + :doc:`/using` covers practical command usage and examples. |
| 10 | + |
| 11 | +Quick Comparison |
| 12 | +---------------- |
| 13 | + |
| 14 | +.. list-table:: |
| 15 | + :header-rows: 1 |
| 16 | + :widths: 20 40 40 |
| 17 | + |
| 18 | + * - Aspect |
| 19 | + - Bootstrap |
| 20 | + - Build |
| 21 | + * - **Scope** |
| 22 | + - Entire dependency tree |
| 23 | + - Single package |
| 24 | + * - **Purpose** |
| 25 | + - Discover and resolve all dependencies |
| 26 | + - Compile source into wheel |
| 27 | + * - **Recursion** |
| 28 | + - Yes (processes dependencies) |
| 29 | + - No (one package only) |
| 30 | + * - **Input** |
| 31 | + - Requirements file or package specs |
| 32 | + - Package name + version + source URL |
| 33 | + * - **Output** |
| 34 | + - Dependency graph, build order, all wheels |
| 35 | + - One wheel file |
| 36 | + |
| 37 | +Bootstrap Mode |
| 38 | +-------------- |
| 39 | + |
| 40 | +The ``bootstrap`` command recursively discovers and builds all dependencies: |
| 41 | + |
| 42 | +.. code-block:: text |
| 43 | +
|
| 44 | + fromager bootstrap numpy |
| 45 | + ├── Resolve version → numpy==1.26.0 |
| 46 | + ├── Download source |
| 47 | + ├── Extract build dependencies from pyproject.toml |
| 48 | + ├── bootstrap(setuptools) ← Process build dependencies first |
| 49 | + ├── Build wheel (with build deps available) |
| 50 | + ├── Extract install dependencies from wheel metadata |
| 51 | + └── bootstrap(cython) ← Process each install dependency |
| 52 | + └── Resolve version → cython==3.0.0, then repeat... |
| 53 | +
|
| 54 | +**Key operations:** |
| 55 | + |
| 56 | +1. Version resolution for all packages |
| 57 | +2. Dependency graph construction |
| 58 | +3. Build order determination |
| 59 | +4. Wheel building (for each discovered package) |
| 60 | + |
| 61 | +**When to use:** Initial discovery of what needs to be built, creating a complete |
| 62 | +wheel collection from scratch. |
| 63 | + |
| 64 | +Build Mode |
| 65 | +---------- |
| 66 | + |
| 67 | +The ``build`` command compiles a single package without recursion: |
| 68 | + |
| 69 | +.. code-block:: text |
| 70 | +
|
| 71 | + fromager build numpy 1.26.0 https://pypi.org/simple/ |
| 72 | + ├── Download sdist |
| 73 | + ├── Apply patches |
| 74 | + ├── Create build environment |
| 75 | + ├── Run pip wheel |
| 76 | + └── Output: numpy-1.26.0-cp311-linux_x86_64.whl |
| 77 | +
|
| 78 | +**Key operations:** |
| 79 | + |
| 80 | +1. Source download and preparation |
| 81 | +2. Build environment setup |
| 82 | +3. Wheel compilation |
| 83 | +4. No dependency discovery or recursion |
| 84 | + |
| 85 | +**When to use:** Production builds where the build order is already known |
| 86 | +(from a previous bootstrap), CI/CD pipelines, rebuilding individual packages. |
| 87 | + |
| 88 | +Relationship |
| 89 | +------------ |
| 90 | + |
| 91 | +While ``bootstrap`` and ``build`` share some common steps (downloading sources, |
| 92 | +applying patches, running pip wheel), they are separate implementations optimized |
| 93 | +for different use cases. Bootstrap maintains state across the entire dependency tree, |
| 94 | +while build operates statelessly on a single package. |
| 95 | + |
| 96 | +The ``build-sequence`` and ``build-parallel`` commands bridge these modes by reading |
| 97 | +a ``build-order.json`` file (produced by bootstrap) and invoking the build logic |
| 98 | +for each package in the specified order. |
| 99 | + |
| 100 | +Typical Workflow |
| 101 | +---------------- |
| 102 | + |
| 103 | +1. **Development:** Use ``bootstrap`` to discover all dependencies and create |
| 104 | + initial wheel collection |
| 105 | + |
| 106 | +2. **Production:** Use ``build-sequence`` or ``build-parallel`` with the |
| 107 | + ``build-order.json`` from bootstrap to rebuild deterministically |
| 108 | + |
| 109 | +3. **Fixes:** Use ``build`` to rebuild individual packages after applying patches |
0 commit comments