Search results
GitHub repository
- CPython is the official reference implementation of Python written in the C programming language. The historical design is documented in PEP-0339. To better facilitate updates however, design internals are now hosted in the devguide site. Source code for CPython is easily accessible via the official GitHub repository.
dev.to/cwprogram/a-tour-of-cpython-compilation-cd5
- Introduction to CPython. When you type python at the console or install a Python distribution from python.org, you are running CPython. CPython is one of the many Python runtimes, maintained and written by different teams of developers.
- The Python Interpreter Process. Now that you’ve seen the Python grammar and memory management, you can follow the process from typing python to the part where your code is executed.
- The CPython Compiler and Execution Loop. In Part 2, you saw how the CPython interpreter takes an input, such as a file or string, and converts it into a logical Abstract Syntax Tree.
- Objects in CPython. CPython comes with a collection of basic types like strings, lists, tuples, dictionaries, and objects. All of these types are built-in.
- Overview
- General Information
- Contributing to CPython
- Using Python
- Build Instructions
- What's New
- Documentation
- Testing
- Installing multiple versions
- Release Schedule
Copyright © 2001-2024 Python Software Foundation. All rights reserved.
See the end of this file for further copyright and license information.
Contents
•General Information
•Contributing to CPython
•Using Python
•Website: https://www.python.org
•Source code: https://github.com/python/cpython
•Issue tracker: https://github.com/python/cpython/issues
•Documentation: https://docs.python.org
For more complete instructions on contributing to CPython development, see the Developer Guide.
Installable Python kits, and information about using Python, are available at python.org.
On Unix, Linux, BSD, macOS, and Cygwin:
This will install Python as python3.
You can pass many options to the configure script; run ./configure --help to find out more. On macOS case-insensitive file systems and on Cygwin, the executable is called python.exe; elsewhere it's just python.
Building a complete Python installation requires the use of various additional third-party libraries, depending on your build platform and configure options. Not all standard library modules are buildable or useable on all platforms. Refer to the Install dependencies section of the Developer Guide for current detailed information on dependencies for various Linux distributions and macOS.
On macOS, there are additional configure and build options related to macOS framework and universal builds. Refer to Mac/README.rst.
On Windows, see PCbuild/readme.txt.
We have a comprehensive overview of the changes in the What's New in Python 3.13 document. For a more detailed change log, read Misc/NEWS, but a full accounting of changes can only be gleaned from the commit history.
If you want to install multiple versions of Python, see the section below entitled "Installing multiple versions".
Documentation for Python 3.13 is online, updated daily.
It can also be downloaded in many formats for faster access. The documentation is downloadable in HTML, PDF, and reStructuredText formats; the latter version is primarily for documentation authors, translators, and people with special formatting requirements.
To test the interpreter, type make test in the top-level directory. The test set produces some output. You can generally ignore the messages about skipped tests due to optional features which can't be imported. If a message is printed about a failed test or a traceback or core dump is produced, something is wrong.
By default, tests are prevented from overusing resources like disk space and memory. To enable these tests, run make buildbottest.
If any tests fail, you can re-run the failing test(s) in verbose mode. For example, if test_os and test_gdb failed, you can run:
If the failure persists and appears to be a problem with Python rather than your environment, you can file a bug report and include relevant output from that command to show the issue.
On Unix and Mac systems if you intend to install multiple versions of Python using the same installation prefix (--prefix argument to the configure script) you must take care that your primary python executable is not overwritten by the installation of a different version. All files and directories installed using make altinstall contain the major and minor version and can thus live side-by-side. make install also creates ${prefix}/bin/python3 which refers to ${prefix}/bin/python3.X. If you intend to install multiple versions using the same prefix you must decide which version (if any) is your "primary" version. Install that version using make install. Install all other versions using make altinstall.
For example, if you want to install Python 2.7, 3.6, and 3.13 with 3.13 being the primary version, you would execute make install in your 3.13 build directory and make altinstall in the others.
See PEP 719 for Python 3.13 release details.
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.
Jun 16, 2013 · Cpython compiles the python source code file with .py extension into an intermediate bytecode which is usually given the .pyc extension, and gets executed by the Cpython Virtual Machine. This implementation of Python provides maximum compatibility with the Python packages and C extension modules.
CPython can be defined as both an interpreter and a compiler as it compiles Python code into bytecode before interpreting it. It has a foreign function interface with several languages, including C, in which one must explicitly write bindings in a language other than Python.
These instructions cover how to get a working copy of the source code and a compiled version of the CPython interpreter (CPython is the version of Python available from https://www.python.org/). It also gives an overview of the directory structure of the CPython source code.
Jun 26, 2024 · Source Code of CPython. The CPython source distribution comes with various tools, libraries, and components. To compile CPython from the source code, you need a C compiler, and some build tools according to your OS. In Windows, to download a copy of the CPython source code, you can use git to pull the latest version to a working copy locally: