Files
cpython/InternalDocs/structure.md
T
a7501f07da Move doc on structure from devguide to InternalDocs (GH-142237)
Co-Authored-By: Paul Ross <[email protected]>
Co-Authored-By: Carol Willing <[email protected]>
Co-Authored-By: Hugo van Kemenade <[email protected]>
Co-Authored-By: Ezio Melotti <[email protected]>
Co-Authored-By: Adam Turner <[email protected]>
2025-12-15 15:19:02 +01:00

1.3 KiB

CPython source code

This section gives an overview of CPython's code structure and provides a summary of file locations for modules and built-ins.

Source code layout

For a Python module, the typical layout is:

  • Lib/<module>.py
  • Modules/_<module>.c (if there's also a C accelerator module)
  • Lib/test/test_<module>.py
  • Doc/library/<module>.rst

For an extension module, the typical layout is:

  • Modules/<module>module.c
  • Lib/test/test_<module>.py
  • Doc/library/<module>.rst

For builtin types, the typical layout is:

For builtin functions, the typical layout is:

Some exceptions to these layouts are: