4. C および C++ 拡張のビルド

A C extension for CPython is a shared library (for example, a .so file on Linux, .pyd on Windows), which exports an initialization function.

See 拡張モジュールの定義 for details.

4.1. setuptools による C および C++ 拡張のビルド

拡張モジュールのビルド、パッケージ化および配布には、サードパーティのツールが最適であり、このドキュメントの範囲外です。適切なツールの一つは Setuptools であり、ドキュメントは https://setuptools.pypa.io/en/latest/setuptools.html にあります。

The distutils module, which was included in the standard library until Python 3.12, is now maintained as part of Setuptools.