Skip to content

Commit 9fb5656

Browse files
rd4398claude
andcommitted
docs(how-tos): add multiple version bootstrap guide
Add a new how-to guide documenting the `--multiple-versions` flag for the `bootstrap` and `bootstrap-parallel` commands. Covers enabling the mode, how resolution and error handling work, flag interactions, and a complete example with verification steps. Co-Authored-By: Claude <claude@anthropic.com> Signed-off-by: Rohan Devasthale <rdevasth@redhat.com>
1 parent 2132ef3 commit 9fb5656

2 files changed

Lines changed: 163 additions & 0 deletions

File tree

docs/how-tos/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ Customize builds with overrides, variants, and version handling.
4747

4848
pyproject-overrides
4949
multiple-versions
50+
multiple-version-bootstrap
5051
pre-release-versions
5152
release-age-cooldown
5253

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
Multiple Version Bootstrap
2+
==========================
3+
4+
.. versionadded:: 0.83.0
5+
6+
By default, fromager resolves each package to its single highest matching
7+
version. The ``--multiple-versions`` flag changes this behavior so that
8+
fromager resolves and builds **all versions** that match each requirement
9+
specifier, rather than only the highest one.
10+
11+
This is different from ``--skip-constraints``, which lets you build a
12+
specific set of conflicting pinned versions. ``--multiple-versions``
13+
discovers and builds every matching version automatically. See
14+
:doc:`multiple-versions` for the ``--skip-constraints`` option.
15+
16+
When to Use This
17+
----------------
18+
19+
Use ``--multiple-versions`` when you need to:
20+
21+
- Populate a private package index with every available version of a package
22+
- Build a broad wheel collection that serves consumers pinned to different
23+
versions
24+
- Test that multiple versions of a package all build from source in your
25+
environment
26+
27+
.. note::
28+
29+
The resulting wheel collection is **not** meant to be installed as a single
30+
coherent set. Each version is built independently.
31+
32+
How to Enable It
33+
----------------
34+
35+
Pass ``--multiple-versions`` to either ``bootstrap`` or
36+
``bootstrap-parallel``:
37+
38+
.. code-block:: bash
39+
40+
# Serial bootstrap
41+
fromager bootstrap --multiple-versions requests>=2.28
42+
43+
# Parallel bootstrap
44+
fromager bootstrap-parallel --multiple-versions requests>=2.28
45+
46+
This resolves every version of ``requests`` that satisfies ``>=2.28`` and
47+
bootstraps each one.
48+
49+
You can also use a requirements file:
50+
51+
.. code-block:: bash
52+
53+
fromager bootstrap --multiple-versions -r requirements.txt
54+
55+
How It Works
56+
------------
57+
58+
1. **Resolution** --- For each requirement, fromager queries the package index
59+
and collects all versions matching the specifier. Without the flag, only the
60+
highest version is returned.
61+
62+
2. **Graph population** --- Every resolved version is added to the dependency
63+
graph. The highest version is processed first.
64+
65+
3. **Build** --- Each version is bootstrapped independently: its source is
66+
downloaded, its dependencies are resolved, and a wheel is built.
67+
68+
4. **Error handling** --- If a particular version fails to build, fromager logs
69+
a warning, removes that version from the dependency graph, and continues
70+
with the remaining versions. A summary of failed versions is printed at the
71+
end.
72+
73+
5. **Constraints disabled** --- ``constraints.txt`` generation is
74+
**automatically skipped** because a constraints file cannot represent
75+
multiple versions of the same package. You do not need to pass
76+
``--skip-constraints`` separately.
77+
78+
Output Files
79+
~~~~~~~~~~~~
80+
81+
When ``--multiple-versions`` is active:
82+
83+
- ``build-order.json`` --- created normally, listing every version built
84+
- ``graph.json`` --- created normally, containing all versions in the
85+
dependency graph
86+
- ``constraints.txt`` --- **not generated**
87+
88+
Combining with Other Flags
89+
--------------------------
90+
91+
``--test-mode``
92+
Supported with serial ``bootstrap`` only. Failures are collected and
93+
reported at the end rather than aborting early (same behavior as without
94+
``--multiple-versions``).
95+
96+
``--skip-constraints``
97+
Redundant when ``--multiple-versions`` is set. Fromager automatically
98+
disables constraint generation. Passing both flags explicitly is
99+
harmless --- no duplicate log messages are emitted.
100+
101+
``--max-release-age``
102+
Works together with ``--multiple-versions``. Only versions published
103+
within the specified number of days are considered.
104+
105+
``bootstrap-parallel``
106+
The flag is passed through to the serial bootstrap phase (sdist-only),
107+
then the parallel build phase builds the remaining wheels.
108+
``--test-mode`` is not available in parallel builds.
109+
110+
Complete Example
111+
----------------
112+
113+
Suppose you want to build every ``requests`` release from 2.28 onward.
114+
115+
**1. Create a requirements file**
116+
117+
.. code-block:: text
118+
119+
requests>=2.28
120+
121+
**2. Run the bootstrap**
122+
123+
.. code-block:: bash
124+
125+
fromager bootstrap --multiple-versions \
126+
--sdists-repo ./sdists-repo \
127+
--wheels-repo ./wheels-repo \
128+
--work-dir ./work-dir \
129+
-r requirements.txt
130+
131+
**3. Verify the built wheels**
132+
133+
.. code-block:: bash
134+
135+
find wheels-repo/downloads/ -name "requests-*.whl" | sort
136+
# requests-2.28.0-py3-none-any.whl
137+
# requests-2.28.1-py3-none-any.whl
138+
# requests-2.28.2-py3-none-any.whl
139+
# ...
140+
141+
**4. Confirm constraints were skipped**
142+
143+
.. code-block:: bash
144+
145+
ls work-dir/constraints.txt
146+
# Expected: file does not exist
147+
148+
If any version failed to build, the log output will include lines like:
149+
150+
.. code-block:: text
151+
152+
WARNING requests: 1 version(s) failed to bootstrap
153+
WARNING - requests==2.28.0: BuildError: ...
154+
155+
See Also
156+
--------
157+
158+
- :doc:`multiple-versions` --- building specific conflicting versions
159+
with ``--skip-constraints``
160+
- :doc:`graph-commands/understanding-multiple-versions` --- analyzing
161+
multiple versions in dependency graphs
162+
- :doc:`bootstrap-constraints` --- using constraints for reproducible builds

0 commit comments

Comments
 (0)