TopGit
GitHub Repo Review

CPython: the Python programming language source code

python/cpython
CTopGit review image for python/cpython
Review by Topgit.dev for python/cpython, with GitHub repository stats and README context.
Quick verdict

CPython is the reference implementation of Python — the actual C and Python source that becomes the python3 binary on your machine. It is not a library or a distribution, it is the language itself, published as an open, buildable repository. Worth cloning if you are patching the interpreter or building Python from source; irrelevant if you just run pip install.

Stars
★ 78.2k
Forks
⑂ 36.6k
Language
Python
License
See repository
Topic
—
Updated
Nov 2026
Homepage
GitHub

Inside the CPython monorepo

CPython is the GitHub repository that holds the entire Python interpreter's source code — the C runtime, the compiler, the bytecode virtual machine, and the full standard library, all in one tree. Clone it and you get Include/, Modules/, and Lib/ side by side, plus the build scripts (configure, Makefile) that turn that source into a working python3. The README opens with the exact version under development: Python 3.16.0 alpha 0.

Build options, PGO, and LTO optimizations

  • ✓The --enable-optimizations flag on ./configure turns on Profile Guided Optimization automatically, and can auto-enable Link Time Optimization on supported platforms.
  • ✓PGO works by building an instrumented interpreter first, running a training workload against it, then rebuilding the final binary from that profile data — done via make profile-opt.
  • ✓LTO is opt-in separately through --with-lto, letting the compiler optimize across .o file boundaries a normal build treats as opaque.
  • ✓Debug builds get their own workflow: mkdir a subdirectory, run ../configure --with-pydebug from inside it, so a debug tree never collides with a top-level build.
  • ✓make altinstall installs a version-suffixed binary (python3.X) instead of overwriting python3, which is how multiple Python versions coexist under one prefix.
  • ✓Two CI pipelines gate every change to main: GitHub Actions and Azure Pipelines, both badge-linked at the top of the README.
How this repository's GitHub stars have grown over time. Source: star-history.com.View the star history ↗

Building Python from source on Unix and macOS

On Unix, Linux, BSD, macOS, and Cygwin, the whole process is four commands: ./configure, make, make test, sudo make install. That last step installs the result as python3, not python — plan your PATH accordingly. Run ./configure --help first; there are a lot of options, and building a full installation typically pulls in third-party libraries the devguide's dependency list covers in detail. On macOS there are extra configure flags for framework and universal builds (documented in Mac/README.rst), and Windows follows a different path entirely, through PCbuild/readme.txt rather than the Unix configure/make flow. Not every standard library module builds or works on every platform — the README says so directly, without listing which ones.

Running the test suite

make test in the top-level directory runs the interpreter's own test suite; skipped-test messages about missing optional features are normal, but a traceback, a core dump, or a reported failure means something is actually broken. Resource-heavy tests are excluded by default — add them back with make buildbottest. When a specific test fails, rerun it verbose: make test TESTOPTS="-v test_os test_gdb" is the exact example from the README. Running several Python versions side by side comes down to one decision: pick a "primary" version and install it with make install, then use make altinstall for every other version so their binaries stay suffixed instead of overwriting each other.

Strengths

  • ✓One repository holds the interpreter, compiler, and standard library together, so a fix or a build touches a single tree instead of several coordinated projects.
  • ✓PGO and LTO are both first-class configure flags, not a separate patch set someone maintains on the side.
  • ✓Two independent CI systems build main on every push, so a broken build surfaces fast.
  • ✓The distribution ships with no GPL code, which the README states outright — clearing the way for use in proprietary projects.

Platform support and build dependencies

  • △This is source, not a Python installer — end users who just want to run Python should get a kit from python.org, not build from this repo.
  • △Building a full installation needs platform-specific third-party libraries, and the README punts the actual list to the external devguide page rather than stating it inline.
  • △Windows is not part of the same ./configure workflow at all; it is a separate build path through PCbuild, documented in a different file entirely.
  • △The README ships at version 3.16.0 alpha 0 — that's pre-release, unstable-by-definition code on main, not something to build for production.
  • △Not every standard library module builds or works on every platform, and the README does not say which ones are affected where.

Other Python implementations

PyPy — a JIT-compiled alternative implementation of Python, usually faster than CPython's bytecode interpreter for long-running CPU-bound code.MicroPython — a from-scratch reimplementation targeting microcontrollers and constrained embedded hardware, where CPython's footprint is too large.IronPython — implements Python on top of .NET's CLR instead of a standalone C runtime.Jython — compiles Python to JVM bytecode, useful specifically for embedding Python inside Java applications.

Frequently asked questions about CPython

What license is Python released under — is it GPL-compatible?

CPython is free and open source, released under its own permissive license (see the repository's LICENSE file for the exact terms). The README states the distribution contains no GNU General Public License (GPL) code, and while there are optional interfaces to some GNU code, the core distribution itself is not GPL-licensed.

Can I use CPython in proprietary or commercial projects?

CPython can be used in proprietary or commercial projects — the README states plainly that the distribution contains no GPL code, so nothing in it forces a copyleft license on your own code. A few optional interfaces touch GNU code, but they are not required for normal builds.

How do I build Python with Profile Guided Optimization (PGO)?

Run ./configure --enable-optimizations before make, which sets the default build targets to enable PGO automatically. Under the hood this builds an instrumented interpreter, runs a training workload against it, then rebuilds the final optimized binary from that profile — the same steps make profile-opt runs directly.

How do I install multiple Python versions on the same system?

Pick one version as your "primary" and install it with make install, which creates the prefix/bin/python3 symlink. Install every other version with make altinstall instead, which keeps binaries suffixed by version so they coexist under the same prefix without overwriting each other.

Does the CPython source contain any GPL-licensed code?

CPython's distribution contains no GNU General Public License (GPL) code — the README states this directly. There are interfaces to some GNU code available, but they are described as entirely optional, not part of the core build.

What build dependencies are required to compile CPython on Linux?

CPython's README does not list Linux build dependencies inline — it points to the devguide's dependency page for distribution-specific package lists instead. It does say a full installation needs various third-party libraries that differ depending on your build platform and configure settings, and that not every standard library module builds on every platform.

The problem it solves

Python the language and CPython the interpreter are not separate projects with separate homes — this repository is where "Python" as a concept and "python3" as a running binary actually meet. Without a canonical, buildable source tree, there would be no single place to file an interpreter bug, propose a language change, or build Python for a platform the official installers do not cover.

Best use cases

  • •Building a custom Python interpreter with PGO and LTO baked in for a performance-sensitive deployment.
  • •Bisecting or patching a CPython bug directly against main instead of waiting for the next release.
  • •Cross-compiling or packaging Python for a platform without an official python.org installer.
  • •Running the interpreter's own test suite (make test) to validate a patched build before shipping it.

Who should try it — and who should skip

Core maintainers, CPython contributors, embedders building a custom Python distribution, and anyone debugging at the interpreter or bytecode level belong here — this is where the fix actually lives. If you're writing a Python application, use a package manager and a kit from python.org instead; cloning this repo to run pip install is like compiling a browser from source to read a webpage. Packagers targeting a stripped-down or optimized build (PGO/LTO, custom module sets) also have a real reason to be in this tree.

Source & attribution

Facts and quotes sourced from the python/cpython GitHub repository and its README.

GitHub data · last synced Aug 14, 2026Reviewed by Henry
← Back to TopGit

Curious whether cpython is right for you?

Let ChatGPT, Claude, or Perplexity look into it — click below and see what AI actually says about cpython.

GitHub