|
1 | | -***** |
2 | | -build |
3 | | -***** |
| 1 | +####### |
| 2 | + build |
| 3 | +####### |
4 | 4 |
|
5 | 5 | A simple, correct `Python packaging <https://packaging.python.org/>`_ **build frontend**. |
6 | 6 |
|
7 | | -build reads your project's `pyproject.toml configuration file <https://packaging.python.org/en/latest/specifications/pyproject-toml/>`_ and invokes **build backends** to create `distribution packages <https://packaging.python.org/en/latest/glossary/#term-Distribution-Package>`_—the files you upload to `PyPI <https://pypi.org/>`_ or install with pip. It focuses solely on building packages and does not manage dependencies or virtual environments. |
| 7 | +build reads your project's `pyproject.toml configuration file |
| 8 | +<https://packaging.python.org/en/latest/specifications/pyproject-toml/>`_ and invokes **build backends** to create |
| 9 | +`distribution packages <https://packaging.python.org/en/latest/glossary/#term-Distribution-Package>`_ (the files you |
| 10 | +upload to PyPI_ or install with pip_). It focuses solely on building packages and does not manage dependencies or |
| 11 | +virtual environments. |
8 | 12 |
|
9 | | -Mission Statement |
10 | | -================= |
| 13 | +******************* |
| 14 | + Mission Statement |
| 15 | +******************* |
11 | 16 |
|
12 | | -Many Python tools combine multiple capabilities into one project. For example, pip_ both installs packages and can build them. While convenient, this tight coupling isn't always desirable. Some users need standalone build tools for custom environments (outside PyPI_), or they manage packages themselves (like Linux distributions do). |
| 17 | +Many Python tools combine multiple capabilities into one project. For example, pip_ both installs packages and can build |
| 18 | +them. While convenient, this tight coupling isn't always desirable. Some users need standalone build tools for custom |
| 19 | +environments (outside PyPI_), or they manage packages themselves (like Linux distributions do). |
13 | 20 |
|
14 | | -This project fills that gap by providing a standalone build tool following modern Python packaging standards for how build tools communicate with backends and how ``pyproject.toml`` defines build requirements. |
| 21 | +This project fills that gap by providing a standalone build tool following modern Python packaging standards for how |
| 22 | +build tools communicate with backends and how ``pyproject.toml`` defines build requirements. |
15 | 23 |
|
16 | 24 | We keep dependencies minimal to make build easy to install and use in restricted environments. |
17 | 25 |
|
18 | | -Differences from other tools |
19 | | -============================= |
| 26 | +****************************** |
| 27 | + Differences from other tools |
| 28 | +****************************** |
20 | 29 |
|
21 | | -Thanks to standardization, all compliant build frontends produce the same outputs (`source distributions <https://packaging.python.org/en/latest/specifications/source-distribution-format/>`_ and `wheels <https://packaging.python.org/en/latest/specifications/binary-distribution-format/>`_) from the same project. The differences are mainly in scope, dependencies, and extra features. |
| 30 | +Thanks to standardization, all compliant build frontends produce the same outputs (`source distributions |
| 31 | +<https://packaging.python.org/en/latest/specifications/source-distribution-format/>`_ and `wheels |
| 32 | +<https://packaging.python.org/en/latest/specifications/binary-distribution-format/>`_) from the same project. The |
| 33 | +differences are mainly in scope, dependencies, and extra features. |
22 | 34 |
|
23 | 35 | ``uv build`` |
24 | | ------------- |
| 36 | +============ |
25 | 37 |
|
26 | | -`uv build <https://docs.astral.sh/uv/>`_ is essentially equivalent to ``python -m build --installer=uv``. Both follow packaging standards. build offers features like ``--config-json`` for passing complex nested configuration to backends, and the pip installer works on systems that don't have pre-compiled uv wheels. |
| 38 | +`uv build <https://docs.astral.sh/uv/>`_ is essentially equivalent to ``python -m build --installer=uv``. Both follow |
| 39 | +packaging standards. build offers features like ``--config-json`` for passing complex nested configuration to backends, |
| 40 | +and the pip installer works on systems that don't have pre-compiled uv wheels. |
27 | 41 |
|
28 | 42 | ``setup.py sdist bdist_wheel`` |
29 | | -------------------------------- |
| 43 | +============================== |
30 | 44 |
|
31 | | -build is the modern equivalent of ``setup.py sdist bdist_wheel``, supporting any backend — not just `setuptools <https://setuptools.pypa.io/>`_. |
| 45 | +build is the modern equivalent of ``setup.py sdist bdist_wheel``, supporting any backend — not just `setuptools |
| 46 | +<https://setuptools.pypa.io/>`_. |
32 | 47 |
|
33 | 48 | ``hatch build`` |
34 | | ---------------- |
| 49 | +=============== |
35 | 50 |
|
36 | | -`hatch build <https://hatch.pypa.io/>`_ is the build command from the Hatch project management tool. It provides a convenient wrapper around the build process as part of the larger Hatch ecosystem for managing Python projects, while build is a standalone tool focused solely on building. |
| 51 | +`hatch build <https://hatch.pypa.io/>`_ is the build command from the Hatch project management tool. It provides a |
| 52 | +convenient wrapper around the build process as part of the larger Hatch ecosystem for managing Python projects, while |
| 53 | +build is a standalone tool focused solely on building. |
37 | 54 |
|
38 | 55 | ``flit build`` |
39 | | --------------- |
| 56 | +============== |
40 | 57 |
|
41 | | -`flit build <https://flit.pypa.io/>`_ is the build command from the Flit project. One important difference: flit-core produces slightly different source distributions when built by flit itself compared to other frontends. Using build (or any standards-compliant frontend) ensures consistent outputs regardless of the backend. |
| 58 | +`flit build <https://flit.pypa.io/>`_ is the build command from the Flit project. One important difference: flit-core |
| 59 | +produces slightly different source distributions when built by flit itself compared to other frontends. Using build (or |
| 60 | +any standards-compliant frontend) ensures consistent outputs regardless of the backend. |
42 | 61 |
|
43 | 62 | ``cibuildwheel`` |
44 | | ----------------- |
| 63 | +================ |
45 | 64 |
|
46 | | -`cibuildwheel <https://cibuildwheel.pypa.io/>`_ is a different kind of tool. While build creates a single wheel for the current platform, cibuildwheel orchestrates building wheels across many platforms and Python versions in CI. It actually calls a build frontend (like build or pip) internally for each platform. Use build to create a pure-Python wheel or a single native wheel; use cibuildwheel when you need to produce native wheels for many platforms. |
| 65 | +`cibuildwheel <https://cibuildwheel.pypa.io/>`_ is a different kind of tool. While build creates a single wheel for the |
| 66 | +current platform, cibuildwheel orchestrates building wheels across many platforms and Python versions in CI. It actually |
| 67 | +calls a build frontend (like build or pip) internally for each platform. Use build to create a pure-Python wheel or a |
| 68 | +single native wheel; use cibuildwheel when you need to produce native wheels for many platforms. |
47 | 69 |
|
48 | | -Where to start |
49 | | -============== |
| 70 | +**************** |
| 71 | + Where to start |
| 72 | +**************** |
50 | 73 |
|
51 | 74 | **First time using build?** Start with the :doc:`tutorial/getting-started` to create your first package. |
52 | 75 |
|
53 | | -**Need to solve a specific problem?** Check the :doc:`how-to/basic-usage` for common workflows, or browse the how-to guides below for your specific scenario. |
| 76 | +**Need to solve a specific problem?** Check the :doc:`how-to/basic-usage` for common workflows, or browse the how-to |
| 77 | +guides below for your specific scenario. |
54 | 78 |
|
55 | | -**Looking for technical details?** The :doc:`reference/cli` documents all command-line options, and the :doc:`reference/api` covers the Python API. |
| 79 | +**Looking for technical details?** The :doc:`reference/cli` documents all command-line options, and the |
| 80 | +:doc:`reference/api` covers the Python API. |
56 | 81 |
|
57 | | -**Want to understand how it works?** Read :doc:`explanation/how-it-works` to learn about the build process and isolation. |
| 82 | +**Want to understand how it works?** Read :doc:`explanation/how-it-works` to learn about the build process and |
| 83 | +isolation. |
58 | 84 |
|
59 | 85 | .. toctree:: |
60 | | - :caption: Tutorial |
61 | | - :hidden: |
| 86 | + :caption: Tutorial |
| 87 | + :hidden: |
62 | 88 |
|
63 | | - tutorial/getting-started |
| 89 | + tutorial/getting-started |
64 | 90 |
|
65 | 91 | .. toctree:: |
66 | | - :caption: How-to Guides |
67 | | - :hidden: |
| 92 | + :caption: How-to Guides |
| 93 | + :hidden: |
68 | 94 |
|
69 | | - how-to/install |
70 | | - how-to/basic-usage |
71 | | - how-to/choosing-tools |
72 | | - how-to/ci-cd |
73 | | - how-to/corporate-environments |
74 | | - how-to/config-settings |
75 | | - how-to/troubleshooting |
| 95 | + how-to/install |
| 96 | + how-to/basic-usage |
| 97 | + how-to/choosing-tools |
| 98 | + how-to/ci-cd |
| 99 | + how-to/corporate-environments |
| 100 | + how-to/config-settings |
| 101 | + how-to/troubleshooting |
76 | 102 |
|
77 | 103 | .. toctree:: |
78 | | - :caption: Reference |
79 | | - :hidden: |
| 104 | + :caption: Reference |
| 105 | + :hidden: |
80 | 106 |
|
81 | | - reference/cli |
82 | | - reference/api |
83 | | - reference/environment-variables |
| 107 | + reference/cli |
| 108 | + reference/api |
| 109 | + reference/environment-variables |
84 | 110 |
|
85 | 111 | .. toctree:: |
86 | | - :caption: Explanation |
87 | | - :hidden: |
| 112 | + :caption: Explanation |
| 113 | + :hidden: |
88 | 114 |
|
89 | | - explanation/how-it-works |
90 | | - explanation/build-backends |
| 115 | + explanation/how-it-works |
| 116 | + explanation/build-backends |
91 | 117 |
|
92 | 118 | .. toctree:: |
93 | | - :caption: Development |
94 | | - :hidden: |
| 119 | + :caption: Development |
| 120 | + :titlesonly: |
| 121 | + :hidden: |
95 | 122 |
|
96 | | - development/contributing |
97 | | - development/release |
98 | | - Source Code <https://github.com/pypa/build/> |
99 | | - Issue Tracker <https://github.com/pypa/build/issues> |
100 | | - |
101 | | -.. toctree:: |
102 | | - :caption: Changelog |
103 | | - :hidden: |
104 | | - |
105 | | - changelog |
| 123 | + development/contributing |
| 124 | + development/release |
| 125 | + changelog |
| 126 | + Source Code <https://github.com/pypa/build/> |
| 127 | + Issue Tracker <https://github.com/pypa/build/issues> |
106 | 128 |
|
107 | 129 | .. _pip: https://github.com/pypa/pip |
108 | | -.. _PyPI: https://pypi.org/ |
| 130 | + |
109 | 131 | .. _pipx: https://github.com/pipxproject/pipx |
| 132 | + |
| 133 | +.. _pypi: https://pypi.org/ |
0 commit comments