Debian Codegraph @

Doc/extending/index.rst

raw
1 .. _extending-index:
2
3 ##################################################
4 Extending and Embedding the Python Interpreter
5 ##################################################
6
7 This document describes how to write modules in C or C++ to extend the Python
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.
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
24
25 Recommended third party tools
26 =============================
27
28 This guide only covers the basic tools for creating extensions provided
29 as part of this version of CPython. Some :ref:`third party tools
30 <c-api-tools>` offer both simpler and more sophisticated approaches to creating
31 C and C++ extensions for Python.
32
33
34 Creating extensions without third party tools
35 =============================================
36
37 This section of the guide covers creating C and C++ extensions without
38 assistance from third party tools. It is intended primarily for creators
39 of those tools, rather than being a recommended way to create your own
40 C extensions.
41
42 .. seealso::
43
44 :pep:`489` -- Multi-phase extension module initialization
45
46 .. toctree::
47 :maxdepth: 2
48 :numbered:
49
50 extending.rst
51 newtypes_tutorial.rst
52 newtypes.rst
53 building.rst
54 windows.rst
55
56 Embedding the CPython runtime in a larger application
57 =====================================================
58
59 Sometimes, rather than creating an extension that runs inside the Python
60 interpreter as the main application, it is desirable to instead embed
61 the CPython runtime inside a larger application. This section covers
62 some of the details involved in doing that successfully.
63
64 .. toctree::
65 :maxdepth: 2
66 :numbered:
67
68 embedding.rst