|
| 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. |
0 commit comments