Skip to content

Commit 2db6e21

Browse files
committed
docs: add quick start guide and glossary from learning-fromager repo
Add quickstart.rst with installation instructions and a simple stevedore exampl for new users. Add glossary.md with terminology definitions. Update getting-started.rst to point new users to the quick start guide. Content adapted from the learning-fromager repository. Signed-off-by: shifa-khan shikhan@redhat.com Closes: #799
1 parent 5cf7ab8 commit 2db6e21

File tree

4 files changed

+205
-0
lines changed

4 files changed

+205
-0
lines changed

docs/getting-started.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
Getting Started
22
===============
33

4+
.. note::
5+
6+
New to fromager? Start with :doc:`quickstart` for a simple first build.
7+
48
The basic process for using fromager to build a collection of wheels is
59

610
1. Make a list of the top-level dependencies (applications, extension libraries,

docs/glossary.md

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
# Glossary
2+
3+
Reference for terminology used throughout fromager documentation.
4+
5+
## Package Formats
6+
7+
**sdist (Source Distribution)** is an archive containing Python source code,
8+
typically a `.tar.gz` file. It must be compiled to be installed.
9+
10+
**wheel** is a pre-built binary distribution (`.whl` file) that can be
11+
installed directly without compilation.
12+
13+
## Package Naming
14+
15+
**canonical name** is the normalized form of a package name following Python
16+
packaging standards. It's lowercase with hyphens, so `My-Package` becomes
17+
`my-package`.
18+
19+
**override name** is the module-safe version used for settings files and
20+
plugins. Hyphens become underscores, so `my-package` becomes `my_package`.
21+
22+
## Dependency Types
23+
24+
**build-system dependencies** are the minimal tools needed to understand how
25+
to build a package. These are specified in `[build-system] requires` in
26+
`pyproject.toml`. Examples include `setuptools`, `hatchling`, and `flit-core`.
27+
28+
**build-backend dependencies** are additional dependencies discovered by
29+
calling the build backend's `get_requires_for_build_wheel()` hook. For example,
30+
a package with Cython extensions might need `cython`.
31+
32+
**build-sdist dependencies** are dependencies specifically needed for creating
33+
source distributions, returned by `get_requires_for_build_sdist()`.
34+
35+
**install dependencies** are packages needed when using the built package.
36+
They come from `Requires-Dist` in the wheel metadata.
37+
38+
**top-level dependencies** are the requirements you specify directly in your
39+
`requirements.txt`, as opposed to dependencies discovered through resolution.
40+
41+
## Requirements vs Constraints
42+
43+
**requirement** specifies a package you want to build. It can include version
44+
constraints like `requests>=2.25.0`.
45+
46+
**constraint** limits which version is selected during resolution without
47+
requesting the package directly. Constraints are useful for resolving conflicts
48+
or pinning transitive dependencies.
49+
50+
A common pattern is to separate them:
51+
52+
```text
53+
# requirements.txt - what you want to build
54+
requests
55+
flask
56+
57+
# constraints.txt - version limits for everything
58+
requests>=2.25.0
59+
urllib3==2.2.3
60+
```
61+
62+
## Build Concepts
63+
64+
**bootstrap** is the recursive process of building a package and all its
65+
dependencies from source. Fromager figures out the correct build order
66+
automatically.
67+
68+
**build order** is the sequence in which packages must be built. It's a
69+
topological sort of the dependency graph, so each package's dependencies
70+
are built before the package itself.
71+
72+
**variant** is a named build configuration for different scenarios like
73+
`cpu`, `gpu`, or `cuda`. Variants control environment variables and settings
74+
on a per-package basis.
75+
76+
**resolver** is the component that determines which version of a package
77+
to use based on requirements and constraints.
78+
79+
## Customization
80+
81+
**override** provides package-specific custom behavior, such as a custom
82+
source URL or build commands.
83+
84+
**hook** is an extension point for cross-cutting concerns like post-build
85+
actions. Multiple plugins can handle the same hook.
86+
87+
**patch** is a file containing source code modifications applied before
88+
building. Patches are placed in `overrides/patches/<package_name>/`.
89+
90+
**settings file** is a YAML configuration for package-specific build behavior,
91+
located in `overrides/settings/<package_name>.yaml`.
92+
93+
## Build Isolation
94+
95+
**network isolation** means running builds without network access, using Linux
96+
namespaces. This ensures builds use only local or vendored dependencies.
97+
98+
**build isolation** means each package builds in its own virtual environment
99+
to prevent interference between packages.
100+
101+
**vendoring** means including dependencies within a package's source for
102+
offline builds. This is common for Rust dependencies in Python packages.
103+
104+
## Version Terms
105+
106+
**pre-release** refers to development versions like `1.0.0a1` or `1.0.0rc1`.
107+
These are not selected by default unless explicitly requested.
108+
109+
**specifier** is the version range part of a requirement, like `>=1.0,<2.0`.
110+
111+
## See Also
112+
113+
For detailed explanation of output directories and files, see [files](files.md).
114+
115+
For how to use settings, patches, and variants, see [customization](customization.md).
116+
117+
For technical details of the bootstrap process, see [using](using.md).

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ those special cases directly into fromager.
2727
:maxdepth: 2
2828

2929
using.md
30+
quickstart.rst
3031
getting-started.rst
3132
customization.md
3233
concepts/index.rst

docs/quickstart.rst

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
Quick Start
2+
===========
3+
4+
This guide gets you from zero to your first wheel build in under 5 minutes.
5+
6+
Prerequisites
7+
-------------
8+
9+
You'll need Python 3.11 or later and network access to download packages from PyPI.
10+
11+
Installation
12+
------------
13+
14+
Install fromager using pip:
15+
16+
.. code-block:: console
17+
18+
$ pip install fromager
19+
$ fromager --version
20+
fromager, version X.Y.Z
21+
22+
Your First Build
23+
----------------
24+
25+
Let's build a simple package and its dependencies from source. We'll use
26+
``stevedore``, a lightweight package with minimal dependencies.
27+
28+
Create a ``requirements.txt`` file with the package name:
29+
30+
.. code-block:: console
31+
32+
$ echo "stevedore" > requirements.txt
33+
34+
Run the bootstrap command:
35+
36+
.. code-block:: console
37+
38+
$ fromager bootstrap -r requirements.txt
39+
40+
primary settings file: overrides/settings.yaml
41+
per-package settings dir: overrides/settings
42+
variant: cpu
43+
...
44+
100%|████████████████████████████████████████| 3/3 [00:08<00:00, 2.67s/pkg]
45+
writing installation dependencies to ./work-dir/constraints.txt
46+
47+
Check your results:
48+
49+
.. code-block:: console
50+
51+
$ ls wheels-repo/downloads/
52+
pbr-6.1.0-0-py2.py3-none-any.whl
53+
setuptools-75.1.0-0-py3-none-any.whl
54+
stevedore-5.3.0-0-py3-none-any.whl
55+
56+
You've built ``stevedore`` and its dependencies (``pbr``, ``setuptools``)
57+
entirely from source. Fromager downloaded the source distributions from PyPI,
58+
figured out the build and runtime dependencies, built each package in the
59+
correct order, and created wheels in ``wheels-repo/downloads/``.
60+
61+
For a detailed explanation of the output files and directories, see
62+
:doc:`files`.
63+
64+
Pinning Versions with Constraints
65+
---------------------------------
66+
67+
For reproducible builds, use a constraints file to pin specific versions:
68+
69+
.. code-block:: console
70+
71+
$ echo "stevedore==5.3.0" > constraints.txt
72+
$ fromager -c constraints.txt bootstrap -r requirements.txt
73+
74+
The ``-c`` option ensures fromager uses exactly the versions you specify.
75+
76+
Next Steps
77+
----------
78+
79+
Now that you've seen fromager work with a simple package, you might want to:
80+
81+
* Learn to debug build failures with a more complex example in :doc:`getting-started`
82+
* Customize builds with settings, patches, and variants in :doc:`customization`
83+
* Check specific guides in :doc:`how-tos/index`

0 commit comments

Comments
 (0)