|
| 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 | +Quick Comparison |
| 8 | +---------------- |
| 9 | + |
| 10 | +.. list-table:: |
| 11 | + :header-rows: 1 |
| 12 | + :widths: 20 40 40 |
| 13 | + |
| 14 | + * - Aspect |
| 15 | + - Bootstrap |
| 16 | + - Build |
| 17 | + * - **Scope** |
| 18 | + - Entire dependency tree |
| 19 | + - Single package |
| 20 | + * - **Purpose** |
| 21 | + - Discover and resolve all dependencies |
| 22 | + - Compile source into wheel |
| 23 | + * - **Recursion** |
| 24 | + - Yes (processes dependencies) |
| 25 | + - No (one package only) |
| 26 | + * - **Input** |
| 27 | + - Requirements file or package specs |
| 28 | + - Package name + version + source URL |
| 29 | + * - **Output** |
| 30 | + - Dependency graph, build order, all wheels |
| 31 | + - One wheel file |
| 32 | + |
| 33 | +Bootstrap Mode |
| 34 | +-------------- |
| 35 | + |
| 36 | +The ``bootstrap`` command recursively discovers and builds all dependencies: |
| 37 | + |
| 38 | +.. code-block:: text |
| 39 | +
|
| 40 | + fromager bootstrap numpy |
| 41 | + ├── Resolve version → numpy==1.26.0 |
| 42 | + ├── Download source |
| 43 | + ├── Build wheel |
| 44 | + ├── Extract dependencies: [cython, setuptools, ...] |
| 45 | + └── bootstrap(cython) ← Recurse for each dependency |
| 46 | + ├── Resolve version → cython==3.0.0 |
| 47 | + ├── Build wheel |
| 48 | + └── ... |
| 49 | +
|
| 50 | +**Key operations:** |
| 51 | + |
| 52 | +1. Version resolution for all packages |
| 53 | +2. Dependency graph construction |
| 54 | +3. Build order determination |
| 55 | +4. Wheel building (for each discovered package) |
| 56 | + |
| 57 | +**When to use:** Initial discovery of what needs to be built, creating a complete |
| 58 | +wheel collection from scratch. |
| 59 | + |
| 60 | +Build Mode |
| 61 | +---------- |
| 62 | + |
| 63 | +The ``build`` command compiles a single package without recursion: |
| 64 | + |
| 65 | +.. code-block:: text |
| 66 | +
|
| 67 | + fromager build numpy 1.26.0 https://pypi.org/simple/ |
| 68 | + ├── Download sdist |
| 69 | + ├── Apply patches |
| 70 | + ├── Create build environment |
| 71 | + ├── Run pip wheel |
| 72 | + └── Output: numpy-1.26.0-cp311-linux_x86_64.whl |
| 73 | +
|
| 74 | +**Key operations:** |
| 75 | + |
| 76 | +1. Source download and preparation |
| 77 | +2. Build environment setup |
| 78 | +3. Wheel compilation |
| 79 | +4. No dependency discovery or recursion |
| 80 | + |
| 81 | +**When to use:** Production builds where the build order is already known |
| 82 | +(from a previous bootstrap), CI/CD pipelines, rebuilding individual packages. |
| 83 | + |
| 84 | +Relationship |
| 85 | +------------ |
| 86 | + |
| 87 | +Bootstrap uses build internally: |
| 88 | + |
| 89 | +.. code-block:: text |
| 90 | +
|
| 91 | + bootstrap() |
| 92 | + └── for each package: |
| 93 | + └── _build_from_source() ← Same as build command |
| 94 | + └── Creates wheel |
| 95 | +
|
| 96 | +The ``build-sequence`` command bridges these modes by reading a ``build-order.json`` |
| 97 | +file (produced by bootstrap) and calling build for each package in order. |
| 98 | + |
| 99 | +Typical Workflow |
| 100 | +---------------- |
| 101 | + |
| 102 | +1. **Development:** Use ``bootstrap`` to discover all dependencies and create |
| 103 | + initial wheel collection |
| 104 | + |
| 105 | +2. **Production:** Use ``build-sequence`` with the ``build-order.json`` from |
| 106 | + bootstrap to rebuild deterministically |
| 107 | + |
| 108 | +3. **Fixes:** Use ``build`` to rebuild individual packages after applying patches |
| 109 | + |
| 110 | +See Also |
| 111 | +-------- |
| 112 | + |
| 113 | +- :doc:`/using` for detailed command documentation |
| 114 | +- :doc:`dependencies` for understanding dependency types |
| 115 | + |
0 commit comments