@@ -37,14 +37,20 @@ You need to have suitable C compiler and Python development headers installed.
3737On Linux, headers are often in a package like ``python3-dev ``
3838or ``python3-devel ``.
3939
40+ You need to be able to install Python packages.
41+ This tutorial uses `pip <https://pip.pypa.io/ >`__ (``pip install ``), but you
42+ can substitute any tool that can build and install ``pyproject.toml ``-based
43+ projects, like `uv <https://docs.astral.sh/uv/ >`_ (``uv pip install ``).
44+ Preferably, have a :ref: `virtual environment <venv-def >` activated.
45+
4046
4147.. note ::
4248
4349 This tutorial uses APIs that were added in CPython 3.15.
4450 To create an extension that's compatible with earlier versions of CPython,
4551 please follow an earlier version of this documentation.
4652
47- This tutorial uses some syntax added in C11 and C++20.
53+ This tutorial uses C syntax added in C11 and C++20.
4854 If your extension needs to be compatible with earlier standards,
4955 please follow tutorials in documentation for Python 3.14 or below.
5056
@@ -113,7 +119,7 @@ Running your build tool
113119=======================
114120
115121With only the includes in place, your extension won't do anything.
116- Still, it's a good time to try compiling and importing it.
122+ Still, it's a good time to compile it and try to import it.
117123This will ensure that your build tool works, so that you can make
118124and test incremental changes as you follow the rest of the text.
119125
@@ -170,10 +176,9 @@ Now, build install the *project in the current directory* (``.``) via ``pip``:
170176 .. tip ::
171177
172178 If you don't have ``pip `` installed, run ``python -m ensurepip ``,
173- preferably in a :mod: `virtual environment <venv> `.
174- You can also use another tool that can build and install
175- ``pyproject.toml ``-based projects, like
176- `uv <https://docs.astral.sh/uv/ >`_ (``uv pip install . ``).
179+ preferably in a :ref: `virtual environment <venv-def >`.
180+ (Or, if you prefer another tool that can build and install
181+ ``pyproject.toml ``-based projects, use that.)
177182
178183.. _meson-python : https://mesonbuild.com/meson-python/
179184.. _virtual environment : https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/#create-and-use-virtual-environments
@@ -263,8 +268,8 @@ Define this array just before your export hook:
263268 {0, NULL}
264269 };
265270
266- For both name and docstring , the values are C strings -- that is,
267- NUL-terminated UTF-8 encoded byte arrays.
271+ For both :c:data: ` Py_mod_name ` and :c:data: ` Py_mod_doc ` , the values are C
272+ strings -- that is, NUL-terminated UTF-8 encoded byte arrays.
268273
269274Note the zero-filled sentinel entry at the end.
270275If you forget it, you'll trigger undefined behavior.
@@ -595,7 +600,7 @@ add the following function to your module for now:
595600
596601 This is a shim for an old-style :ref: `initialization function <extension-export-hook >`,
597602which was required in extension modules for CPython 3.14 and below.
598- Current CPython will not call it, but some build tools may still assume that
603+ Current CPython does not need it, but some build tools may still assume that
599604all extension modules need to define it.
600605
601606If you use this workaround, you will get the exception
0 commit comments