summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorNicolas Graves <ngraves@ngraves.fr>2025-09-27 12:30:34 +0200
committerSharlatan Hellseher <sharlatanus@gmail.com>2026-03-03 09:32:18 +0000
commite4cc67782eb2e68428e38973c580f371122b2f14 (patch)
tree65be2c666a89fa9df2f94d5ae6c992c6ad85fb4f /doc
parentc87031efe8fea320716e72ec4569c44f47ff8ff9 (diff)
doc: Refresh python documentation.
* doc/contributing.texi: Refresh python documentation (avoid uses of "we " and "you", remove the reference to pyproject-build-system as experimental, and adjust the setuptools situation comments). Merges: https://codeberg.org/guix/guix/pulls/6427 Change-Id: Idb065befc975063ad97e6bdafb724e50d6891cb5 Reviewed-by: Yan Abu Arab <yanabuarab@gmail.com> Reviewed-by: Maxim Cournoyer <maxim@guixotic.coop> Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
Diffstat (limited to 'doc')
-rw-r--r--doc/contributing.texi73
1 files changed, 33 insertions, 40 deletions
diff --git a/doc/contributing.texi b/doc/contributing.texi
index eb5e7f760a1..f1ab1b56da2 100644
--- a/doc/contributing.texi
+++ b/doc/contributing.texi
@@ -1514,37 +1514,30 @@ satisfied.
1514@subsection Python Modules 1514@subsection Python Modules
1515 1515
1516@cindex python 1516@cindex python
1517We currently package Python 2 and Python 3, under the Scheme variable names 1517The standard way to generate a package definition is to use
1518@code{python-2} and @code{python} as explained in @ref{Version Numbers}. 1518@code{guix import pypi <name>}, where @var{name} is the name of the
1519To avoid confusion and naming clashes with other programming languages, it 1519Python package on @url{https://pypi.org, PyPI}, see @pxref{Invoking guix
1520seems desirable that the name of a package for a Python module contains 1520import}. Please check with @code{guix lint <package-name>} that the
1521the word @code{python}. 1521generated package is valid.
1522 1522
1523Some modules are compatible with only one version of Python, others with 1523To avoid confusion and naming clashes with other programming languages,
1524both. If the package Foo is compiled with Python 3, we name it 1524Python module packages should be prefixed with @code{python-}.
1525@code{python-foo}. If it is compiled with Python 2, we name it 1525
1526@code{python2-foo}. Python 2 packages are being removed from the 1526If a project already contains the word @code{python}, please do not
1527distribution; please do no not submit any new Python 2 packages. 1527repeat it; for instance, the module python-dateutil is packaged under
1528 1528the name @code{python-dateutil}. If the project name starts with
1529If a project already contains the word @code{python}, we drop this; 1529@code{py}, it is kept and prefixed as described above (e.g.@:
1530for instance, the module python-dateutil is packaged under the names 1530@code{python-pytz}).
1531@code{python-dateutil} and @code{python2-dateutil}. If the project name
1532starts with @code{py} (e.g.@: @code{pytz}), we keep it and prefix it as
1533described above.
1534 1531
1535@quotation Note 1532@quotation Note
1536Currently there are two different build systems for Python packages in Guix: 1533The standard build system for Python packages is Guix's implementation
1537@var{python-build-system} and @var{pyproject-build-system}. For the 1534of the @url{https://peps.python.org/pep-0517/, formal Python standard}
1538longest time, Python packages were built from an informally specified 1535for specifying build requirements: @var{pyproject-build-system}.
1539@file{setup.py} file. That worked amazingly well, considering Python's 1536The @var{python-build-system} which corresponds to the way Python
1540success, but was difficult to build tooling around. As a result, a host 1537packages were built before PEP517, using the informally specified
1541of alternative build systems emerged and the community eventually settled on a 1538@file{setup.py} file, is now deprecated. @var{pyproject-build-system}
1542@url{https://peps.python.org/pep-0517/, formal standard} for specifying build 1539will eventually be deprecated and renamed into
1543requirements. @var{pyproject-build-system} is Guix's implementation of this 1540@var{python-build-system} after its removal.
1544standard. It is considered ``experimental'' in that it does not yet support
1545all the various PEP-517 @emph{build backends}, but you are encouraged to try
1546it for new Python packages and report any problems. It will eventually be
1547deprecated and merged into @var{python-build-system}.
1548@end quotation 1541@end quotation
1549 1542
1550@subsubsection Specifying Dependencies 1543@subsubsection Specifying Dependencies
@@ -1556,21 +1549,21 @@ package source tree, with varying degrees of accuracy: in the
1556@file{requirements.txt}, or in @file{tox.ini} (the latter mostly for 1549@file{requirements.txt}, or in @file{tox.ini} (the latter mostly for
1557test dependencies). 1550test dependencies).
1558 1551
1559Your mission, when writing a recipe for a Python package, is to map 1552When editing a recipe for a Python package, the goal is to map these
1560these dependencies to the appropriate type of ``input'' (@pxref{package 1553dependencies to the appropriate type of ``input'' (@pxref{package
1561Reference, inputs}). Although the @code{pypi} importer normally does a 1554Reference, inputs}). Although the @code{pypi} importer normally does a
1562good job (@pxref{Invoking guix import}), you may want to check the 1555good job (@pxref{Invoking guix import}), please verify the following
1563following check list to determine which dependency goes where. 1556check list to determine which dependency goes where.
1564 1557
1565@itemize 1558@itemize
1566 1559
1567@item 1560@item
1568We currently package Python with @code{setuptools} and @code{pip} 1561Python is packaged @emph{without} @code{setuptools} and @code{pip}
1569installed per default. This is about to change, and users are encouraged 1562installed per default. @code{python-toolchain} provides a build
1570to use @code{python-toolchain} if they want a build environment for Python. 1563environment for Python.
1571 1564
1572@command{guix lint} will warn if @code{setuptools} or @code{pip} are 1565@command{guix lint} will warn if @code{pip} or other unneeded
1573added as native-inputs because they are generally not necessary. 1566native-inputs are added.
1574 1567
1575@item 1568@item
1576Python dependencies required at run time go into 1569Python dependencies required at run time go into
@@ -1585,9 +1578,9 @@ Python packages required only at build time---e.g., those listed under
1585for testing---e.g., those in @code{tests_require} or @file{tox.ini}---go into 1578for testing---e.g., those in @code{tests_require} or @file{tox.ini}---go into
1586@code{native-inputs}. The rationale is that (1) they do not need to be 1579@code{native-inputs}. The rationale is that (1) they do not need to be
1587propagated because they are not needed at run time, and (2) in a 1580propagated because they are not needed at run time, and (2) in a
1588cross-compilation context, it's the ``native'' input that we'd want. 1581cross-compilation context, it's the target ``native'' input.
1589 1582
1590Examples are the @code{pytest}, @code{mock}, and @code{nose} test 1583Examples are the @code{pytest}, @code{mock}, and @code{stestr} test
1591frameworks. Of course if any of these packages is also required at 1584frameworks. Of course if any of these packages is also required at
1592run-time, it needs to go to @code{propagated-inputs}. 1585run-time, it needs to go to @code{propagated-inputs}.
1593 1586