Skip to content

Commit 68e3368

Browse files
committed
Describe building of semver
1 parent 5a47f94 commit 68e3368

File tree

3 files changed

+63
-34
lines changed

3 files changed

+63
-34
lines changed

BUILDING.rst

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
.. _build-semver:
2+
3+
Building semver
4+
===============
5+
6+
.. _PEP 517: https://www.python.org/dev/peps/pep-0517/
7+
.. _PEP 621: https://www.python.org/dev/peps/pep-0621/
8+
.. _A Practical Guide to Setuptools and Pyproject.toml: https://godatadriven.com/blog/a-practical-guide-to-setuptools-and-pyproject-toml/
9+
.. _Declarative config: https://setuptools.rtfd.io/en/latest/userguide/declarative_config.html
10+
11+
12+
This project changed slightly its way how it is built. The reason for this
13+
was to still support the "traditional" way with :command:`setup.py`,
14+
but at the same time try out the newer way with :file:`pyproject.toml`.
15+
Over time, once Python 3.6 gets deprecated, we will support only the newer way.
16+
17+
18+
Background information
19+
----------------------
20+
21+
Skip this section and head over to :ref:`build-pyproject-build` if you just
22+
want to know how to build semver.
23+
This section gives some background information how this project is set up.
24+
25+
The traditional way with :command:`setup.py` in this project uses a
26+
`Declarative config`_. With this approach, the :command:`setup.py` is
27+
stripped down to its bare minimum and all the metadata is stored in
28+
:file:`setup.cfg`.
29+
30+
The new :file:`pyproject.toml` contains only information about the build backend, currently setuptools.build_meta. The idea is taken from
31+
`A Practical Guide to Setuptools and Pyproject.toml`_.
32+
Setuptools-specific configuration keys as defined in `PEP 621`_ are currently
33+
not used.
34+
35+
36+
.. _build-pyproject-build:
37+
38+
Building with pyproject-build
39+
-----------------------------
40+
41+
To build semver you need:
42+
43+
* The :mod:`build` module which implements the `PEP 517`_ build
44+
frontend.
45+
Install it with::
46+
47+
pip install build
48+
49+
Some Linux distributions has already packaged it. If you prefer
50+
to use the module with your package manager, search for
51+
:file:`python-build` or :file:`python3-build` and install it.
52+
53+
* The command :command:`pyproject-build` from the :mod:`build` module.
54+
55+
To build semver, run::
56+
57+
pyproject-build
58+
59+
After the command is finished, you can find two files in the :file:`dist` folder: a ``.tar.gz`` and a ``.whl`` file.

changelog.d/364.feature.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Enhance :file:`pyproject.toml` to make it possible to use the
2+
:command:`pyproject-build` command from the build module.
3+
For more information, see :ref:`build-semver`.

docs/building.rst

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1 @@
1-
Building semver
2-
===============
3-
4-
.. _PEP 517: https://www.python.org/dev/peps/pep-0517/
5-
6-
This project changed its way how it is built. The reason for this
7-
was to still support the "traditional" way, but at the same time
8-
try out the newer way with ``pyproject.toml``. Over time, once
9-
Python 3.6 gets deprecated, we will support only the newer way.
10-
11-
We distinguish between different Python versions:
12-
13-
* For Python 3.6: Uses the usual :command:`setup.py build`.
14-
15-
* From Python 3.7 and above: Uses the more modern approach
16-
with the `PEP 517`_ build frontend and its command
17-
:command:`pyproject-build`, implemented in https://github.com/pypa/build.
18-
19-
Both ways are integrated into the :command:`build.sh` script. The
20-
script will detect your used Python version and uses either the old
21-
or new way.
22-
23-
For you as developer or packager you can:
24-
25-
* use the :command:`build.sh` script and don't care about
26-
the background, or
27-
28-
* ignore the :command:`build.sh` script and use the usual :command:`setup.py`
29-
command or :command:`pyproject-build`, depending on your Python version.
30-
31-
.. "setuptools>=62.0",
32-
"setuptools-scm",
33-
"wheel",
34-
"build",
1+
.. include:: ../BUILDING.rst

0 commit comments

Comments
 (0)