Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 1 | .. _extending-index: |
| 2 | |
| 3 | ################################################## |
| 4 | Extending and Embedding the Python Interpreter |
| 5 | ################################################## |
| 6 | |
Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 7 | This document describes how to write modules in C or C++ to extend the Python |
Georg Brandl | 4bfc96b | 2013-10-06 18:36:34 +0200 | [diff] [blame] | 8 | interpreter with new modules. Those modules can not only define new functions |
| 9 | but also new object types and their methods. The document also describes how |
| 10 | to embed the Python interpreter in another application, for use as an extension |
| 11 | language. Finally, it shows how to compile and link extension modules so that |
| 12 | they can be loaded dynamically (at run time) into the interpreter, if the |
| 13 | underlying operating system supports this feature. |
Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 14 | |
| 15 | This document assumes basic knowledge about Python. For an informal |
| 16 | introduction to the language, see :ref:`tutorial-index`. :ref:`reference-index` |
| 17 | gives a more formal definition of the language. :ref:`library-index` documents |
| 18 | the existing object types, functions and modules (both built-in and written in |
| 19 | Python) that give the language its wide application range. |
| 20 | |
| 21 | For a detailed description of the whole Python/C API, see the separate |
| 22 | :ref:`c-api-index`. |
| 23 | |
Nick Coghlan | 73188fb | 2013-12-10 21:18:32 +1000 | [diff] [blame] | 24 | .. note:: |
| 25 | |
| 26 | This guide only covers the basic tools for creating extensions provided |
| 27 | as part of this version of CPython. Third party tools may offer simpler |
| 28 | alternatives. Refer to the `binary extensions section |
Berker Peksag | 9fa7e2e | 2015-09-27 12:06:26 +0300 | [diff] [blame] | 29 | <https://packaging.python.org/en/latest/extensions/>`__ in the Python |
| 30 | Packaging User Guide for more information. |
Nick Coghlan | 73188fb | 2013-12-10 21:18:32 +1000 | [diff] [blame] | 31 | |
| 32 | |
Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 33 | .. toctree:: |
| 34 | :maxdepth: 2 |
Georg Brandl | a0eea59 | 2009-03-28 19:57:36 +0000 | [diff] [blame] | 35 | :numbered: |
Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 36 | |
| 37 | extending.rst |
| 38 | newtypes.rst |
| 39 | building.rst |
| 40 | windows.rst |
| 41 | embedding.rst |