Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.3k
gh-133678: Document C API third party tools#134526
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes from1 commit
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -838,3 +838,44 @@ after every statement run by the interpreter.) | ||
Please refer to :file:`Misc/SpecialBuilds.txt` in the Python source distribution | ||
for more detailed information. | ||
.. _c-api-tools: | ||
Recommended third party tools | ||
============================= | ||
The following third party tools offer both simpler and more sophisticated | ||
approaches to creating C and C++ extensions for Python: | ||
vstinner marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
* `Cython <https://cython.org/>`_ | ||
* `cffi <https://cffi.readthedocs.io>`_ | ||
* `HPy <https://hpyproject.org/>`_ | ||
* `nanobind <https://github.com/wjakob/nanobind>`_ (C++) | ||
* `Numba <https://numba.pydata.org/>`_ | ||
* `pybind11 <https://pybind11.readthedocs.io/>`_ (C++) | ||
* `PyO3 <https://pyo3.rs/>`_ (Rust) | ||
* `SWIG <https://www.swig.org>`_ | ||
Using tools such as these can help avoid writing code that is tightly bound to | ||
a particular version of CPython, avoid reference counting errors, and focus | ||
more on your own code than on using the CPython API. In general, new versions | ||
of Python can be supported by updating the tool, and your code will often use | ||
newer and more efficient APIs automatically. Some tools also support compiling | ||
for other implementations of Python from a single set of sources. | ||
Directly coding against the CPython C API should, in most cases, be your last | ||
resort rather than the first. | ||
vstinner marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
These projects are not supported by the same people who maintain Python, and | ||
issues need to be raised with the projects directly. Remember to check that the | ||
project is still maintained and supported, as the list above may become | ||
outdated. | ||
.. seealso:: | ||
`Python Packaging User Guide: Binary Extensions <https://packaging.python.org/guides/packaging-binary-extensions/>`_ | ||
The Python Packaging User Guide not only covers several available | ||
tools that simplify the creation of binary extensions, but also | ||
discusses the various reasons why creating an extension module may be | ||
desirable in the first place. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -26,19 +26,9 @@ Recommended third party tools | ||
============================= | ||
This guide only covers the basic tools for creating extensions provided | ||
as part of this version of CPython. :ref:`Recommended third party tools | ||
<c-api-tools>` offer both simpler and more sophisticated approaches to creating | ||
vstinner marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
C and C++ extensions for Python. | ||
Creating extensions without third party tools | ||
Uh oh!
There was an error while loading.Please reload this page.