diff options
author | Adam J. Stewart <ajstewart426@gmail.com> | 2022-08-01 22:55:41 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-02 07:55:41 +0200 |
commit | 22d4612d94af7e1d4cf6f202231807e5db1cc042 (patch) | |
tree | ec44202d6540fcd98a3bb1c28cd8561a3a52bdf2 /lib | |
parent | 113acd4714ff2b422f3e2901a0905b5d9c65e49e (diff) | |
download | spack-22d4612d94af7e1d4cf6f202231807e5db1cc042.tar.gz spack-22d4612d94af7e1d4cf6f202231807e5db1cc042.tar.bz2 spack-22d4612d94af7e1d4cf6f202231807e5db1cc042.tar.xz spack-22d4612d94af7e1d4cf6f202231807e5db1cc042.zip |
Add meson Python build backend (#31809)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/docs/build_systems/pythonpackage.rst | 87 |
1 files changed, 51 insertions, 36 deletions
diff --git a/lib/spack/docs/build_systems/pythonpackage.rst b/lib/spack/docs/build_systems/pythonpackage.rst index de79324de1..a21648b063 100644 --- a/lib/spack/docs/build_systems/pythonpackage.rst +++ b/lib/spack/docs/build_systems/pythonpackage.rst @@ -48,9 +48,10 @@ important to understand. **build backend** Libraries used to define how to build a wheel. Examples include `setuptools <https://setuptools.pypa.io/>`__, - `flit <https://flit.readthedocs.io/>`_, - `poetry <https://python-poetry.org/>`_, and - `hatchling <https://hatch.pypa.io/latest/>`_. + `flit <https://flit.pypa.io/>`_, + `poetry <https://python-poetry.org/>`_, + `hatchling <https://hatch.pypa.io/latest/>`_, and + `meson <https://meson-python.readthedocs.io/>`_. ^^^^^^^^^^^ Downloading @@ -174,9 +175,9 @@ package. The "Project description" tab may also contain a longer description of the package. Either of these can be used to populate the package docstring. -^^^^^^^^^^^^^ -Build backend -^^^^^^^^^^^^^ +^^^^^^^^^^^^ +Dependencies +^^^^^^^^^^^^ Once you've determined the basic metadata for a package, the next step is to determine the build backend. ``PythonPackage`` uses @@ -219,7 +220,28 @@ See `PEP 517 <https://www.python.org/dev/peps/pep-0517/>`_ and information on the design of ``pyproject.toml``. Depending on which build backend a project uses, there are various -places that run-time dependencies can be listed. +places that run-time dependencies can be listed. Most modern build +backends support listing dependencies directly in ``pyproject.toml``. +Look for dependencies under the following keys: + +* ``requires-python`` under ``[project]`` + + This specifies the version of Python that is required + +* ``dependencies`` under ``[project]`` + + These packages are required for building and installation. You can + add them with ``type=('build', 'run')``. + +* ``[project.optional-dependencies]`` + + This section includes keys with lists of optional dependencies + needed to enable those features. You should add a variant that + optionally adds these dependencies. This variant should be ``False`` + by default. + +Some build backends may have additional locations where dependencies +can be found. """"""""" distutils @@ -245,9 +267,9 @@ If the ``pyproject.toml`` lists ``setuptools.build_meta`` as a ``build-backend``, or if the package has a ``setup.py`` that imports ``setuptools``, or if the package has a ``setup.cfg`` file, then it uses setuptools to build. Setuptools is a replacement for the -distutils library, and has almost the exact same API. Dependencies -can be listed in the ``setup.py`` or ``setup.cfg`` file. Look for the -following arguments: +distutils library, and has almost the exact same API. In addition to +``pyproject.toml``, dependencies can be listed in the ``setup.py`` or +``setup.cfg`` file. Look for the following arguments: * ``python_requires`` @@ -292,25 +314,22 @@ listed directly in the ``pyproject.toml`` file. Older versions of flit used to store this info in a ``flit.ini`` file, so check for this too. -Either of these files may contain keys like: +In addition to the default ``pyproject.toml`` keys listed above, +older versions of flit may use the following keys: -* ``requires-python`` - - This specifies the version of Python that is required - -* ``dependencies`` or ``requires`` +* ``requires`` under ``[tool.flit.metadata]`` These packages are required for building and installation. You can add them with ``type=('build', 'run')``. -* ``project.optional-dependencies`` or ``requires-extra`` +* ``[tool.flit.metadata.requires-extra]`` This section includes keys with lists of optional dependencies needed to enable those features. You should add a variant that optionally adds these dependencies. This variant should be False by default. -See https://flit.readthedocs.io/en/latest/pyproject_toml.html for +See https://flit.pypa.io/en/latest/pyproject_toml.html for more information. """""" @@ -332,27 +351,22 @@ hatchling """"""""" If the ``pyproject.toml`` lists ``hatchling.build`` as the -``build-backend``, it uses the hatchling build system. Look for -dependencies under the following keys: - -* ``requires-python`` - - This specifies the version of Python that is required +``build-backend``, it uses the hatchling build system. Hatchling +uses the default ``pyproject.toml`` keys to list dependencies. -* ``project.dependencies`` - - These packages are required for building and installation. You can - add them with ``type=('build', 'run')``. +See https://hatch.pypa.io/latest/config/dependency/ for more +information. -* ``project.optional-dependencies`` +""""" +meson +""""" - This section includes keys with lists of optional dependencies - needed to enable those features. You should add a variant that - optionally adds these dependencies. This variant should be ``False`` - by default. +If the ``pyproject.toml`` lists ``mesonpy`` as the ``build-backend``, +it uses the meson build system. Meson uses the default +``pyproject.toml`` keys to list dependencies. -See https://hatch.pypa.io/latest/config/dependency/ for more -information. +See https://meson-python.readthedocs.io/en/latest/usage/start.html +for more information. """""" wheels @@ -692,6 +706,7 @@ For more information on build and installation frontend tools, see: For more information on build backend tools, see: * setuptools: https://setuptools.pypa.io/ -* flit: https://flit.readthedocs.io/ +* flit: https://flit.pypa.io/ * poetry: https://python-poetry.org/ * hatchling: https://hatch.pypa.io/latest/ +* meson: https://meson-python.readthedocs.io/ |