Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-92584: Redirect to Setuptools' guidance on extension modules #108030

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions Doc/extending/building.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
..
The guides to building C and C++ extensions are fairly out of date
and would benefit from re-writing in terms of a simple primer,
with specific reference to sysconfig, and how a modules can be build
'by hand', rather than via setuptools, CMake, meson, etc.
If you're reading this and would like to have a go, please do!
See https://github.com/python/cpython/issues/108064 for discussion.

.. highlight:: c

.. _building:
Expand Down Expand Up @@ -45,13 +53,15 @@ See the *"Multiple modules in one library"* section in :pep:`489` for details.

.. highlight:: c

.. _building-on-windows:
.. _install-index:
.. _setuptools-index:

Building C and C++ Extensions with setuptools
=============================================

Python 3.12 and newer no longer come with distutils. Please refer to the
``setuptools`` documentation at
https://setuptools.readthedocs.io/en/latest/setuptools.html
``setuptools`` documentation for `building extension modules`_
to learn more about how build and distribute C/C++ extensions with setuptools.

.. _building extension modules: https://setuptools.pypa.io/en/latest/userguide/ext_modules.html
7 changes: 3 additions & 4 deletions Doc/extending/extending.rst
Original file line number Diff line number Diff line change
Expand Up @@ -458,10 +458,9 @@ Compilation and Linkage

There are two more things to do before you can use your new extension: compiling
and linking it with the Python system. If you use dynamic loading, the details
may depend on the style of dynamic loading your system uses; see the chapters
about building extension modules (chapter :ref:`building`) and additional
information that pertains only to building on Windows (chapter
:ref:`building-on-windows`) for more information about this.
may depend on the style of dynamic loading your system uses; see the chapter
about building extension modules (chapter :ref:`building`)
for more information about this.

If you can't use dynamic loading, or if you want to make your module a permanent
part of the Python interpreter, you will have to change the configuration setup
Expand Down
1 change: 0 additions & 1 deletion Doc/extending/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ C extensions.
newtypes_tutorial.rst
newtypes.rst
building.rst
windows.rst

Embedding the CPython runtime in a larger application
=====================================================
Expand Down
135 changes: 0 additions & 135 deletions Doc/extending/windows.rst

This file was deleted.

2 changes: 0 additions & 2 deletions Doc/using/windows.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1266,8 +1266,6 @@ releases. These files are in the :file:`PCbuild` directory.

Check :file:`PCbuild/readme.txt` for general information on the build process.

For extension modules, consult :ref:`building-on-windows`.


Other Platforms
===============
Expand Down
2 changes: 1 addition & 1 deletion Include/pyport.h
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ extern char * _getpty(int *, int, mode_t, int);
/* public Python functions and data are imported */
/* Under Cygwin, auto-import functions to prevent compilation */
/* failures similar to those described at the bottom of 4.1: */
/* http://docs.python.org/extending/windows.html#a-cookbook-approach */
/* https://docs.python.org/3.2/extending/windows.html#a-cookbook-approach */
# if !defined(__CYGWIN__)
# define PyAPI_FUNC(RTYPE) Py_IMPORTED_SYMBOL RTYPE
# endif /* !__CYGWIN__ */
Expand Down