This article has multiple issues. Please help improve it or discuss these issues on the talk page . (Learn how and when to remove these messages) |
Original author(s) | Guido van Rossum |
---|---|
Developer(s) | Python core developers and the Python community, supported by the Python Software Foundation |
Initial release | 26 January 1994 |
Stable release | |
Repository | https://github.com/python/cpython |
Written in | C, Python |
Platform | 42 platforms; see § Distribution |
Available in | English |
Type | Python Programming Language Interpreter |
License | Python Software Foundation License |
Website | www |
CPython is the reference implementation of the Python programming language. Written in C and Python, CPython is the default and most widely used implementation of the Python language.
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.
A particular feature of CPython is that it makes use of a global interpreter lock (GIL) on each CPython interpreter process, which means that within a single process, only one thread may be processing Python bytecode at any one time. [2] This does not mean that there is no point in multithreading; the most common multithreading scenario is where threads are mostly waiting on external processes to complete.
This can happen when multiple threads are servicing separate clients. One thread may be waiting for a client to reply, and another may be waiting for a database query to execute, while the third thread is actually processing Python code.
However, the GIL does mean that CPython is not suitable for processes that implement CPU-intensive algorithms in Python code that could potentially be distributed across multiple cores.
In real-world applications, situations where the GIL is a significant bottleneck are quite rare. This is because Python is an inherently slow language and is generally not used for CPU-intensive or time-sensitive operations. Python is typically used at the top level and calls functions in libraries to perform specialized tasks. These libraries are generally not written in Python, and Python code in another thread can be executed while a call to one of these underlying processes takes place. The non-Python library being called to perform the CPU-intensive task is not subject to the GIL and may concurrently execute many threads on multiple processors without restriction.
Concurrency of Python code can only be achieved with separate CPython interpreter processes managed by a multitasking operating system. This complicates communication between concurrent Python processes, though the multiprocessing module mitigates this somewhat; it means that applications that really can benefit from concurrent Python-code execution can be implemented with limited overhead.
The presence of the GIL simplifies the implementation of CPython, and makes it easier to implement multi-threaded applications that do not benefit from concurrent Python code execution. However, without a GIL, multiprocessing apps must make sure all common code is thread safe.
Although many proposals have been made to eliminate the GIL, the general consensus has been that in most cases, the advantages of the GIL outweigh the disadvantages; in the few cases where the GIL is a bottleneck, the application should be built around the multiprocessing structure. To help allow more parallelism, an improvement was released in October 2023 to allow a separate GIL per subinterpreter in a single Python process and have been described as "threads with opt-in sharing". [3] [4]
After several debates, a project was launched in 2023 to propose making the GIL optional from version 3.13 of Python, [5] which is scheduled for release in October 2024. [6]
Unladen Swallow was an optimization branch of CPython, intended to be fully compatible and significantly faster. It aimed to achieve its goals by supplementing CPython's custom virtual machine with a just-in-time compiler built using LLVM.
The project had stated a goal of a speed improvement by a factor of five over CPython; [7] this goal was not met. [8]
The project was sponsored by Google, and the project owners, Thomas Wouters, Jeffrey Yasskin, and Collin Winter, are full-time Google employees; however, most project contributors were not Google employees. [9] Unladen Swallow was hosted on Google Code. [10]
Like many things regarding the Python language, the name Unladen Swallow is a Monty Python reference, specifically to the joke about the airspeed velocity of unladen swallows in Monty Python and the Holy Grail .
Although it fell short of all published goals, Unladen Swallow did produce some code that got added to the main Python implementation, such as improvements to the cPickle module. [11]
In July 2010, some observers speculated on whether the project was dead or dying since the 2009 Q4 milestone had not yet been released. [12] The traffic on Unladen's mailing list had decreased from 500 messages in January 2010 to fewer than 10 in September 2010. [13] It has also been reported that Unladen lost Google's funding. [14] In November 2010, one of the main developers announced that "Jeffrey and I have been pulled on to other projects of higher importance to Google." [15]
The 2009 Q4 development branch was created on 26 January 2010, [16] but no advertising was made on the website. Further, regarding the long-term plans, and as the project missed the Python 2.7 release, a Python Enhancement Proposal (PEP) [8] was accepted, which proposed a merge of Unladen Swallow into a special py3k-jit branch of Python's official repository. As of July 2010, this work was ongoing. [17] This merging would have taken some time, since Unladen Swallow was originally based on Python 2.6 [18] with which Python 3 broke compatibility (see Python 3000 for more details). However, the PEP was subsequently withdrawn.
In early 2011, it became clear that the project was stopped. [19]
Officially supported tier-1 platforms are Linux for 64-bit Intel using a GCC toolchain, macOS for 64-bit Intel and ARM, and Microsoft Windows for 32- and 64-bit Intel. Official tier-2 support exists for Linux for 64-bit ARM, wasm32 (Web Assembly) with WASI runtime support, and Linux for 64-bit Intel using a clang toolchain. Official supported tier-3 systems include 64-bit ARM Windows, 64-bit iOS, Raspberry Pi OS (Linux for armv7 with hard float), Linux for 64-bit PowerPC in little-endian mode, and Linux for s390x.
More platforms have working implementations, including: [23]
PEP 11 [24] lists platforms which are not supported in CPython by the Python Software Foundation. These platforms can still be supported by external ports. These ports include:
External ports not integrated to Python Software Foundation's official version of CPython, with links to its main development site, often include additional modules for platform-specific functionalities, like graphics and sound API for PSP and SMS and camera API for S60. These ports include:
These Python versions are distributed with currently-supported enterprise Linux distributions. [33] The support status of Python in the table refers to support from the Python core team, and not from the distribution maintainer.
Distribution version | Distribution end-of-life | Python version | |
---|---|---|---|
Ubuntu 22.04 LTS (Jammy Jellyfish) | 3.10 | ||
Ubuntu 20.04 LTS (Focal Fossa) | 2030-04 [34] [ needs update ] | [35] | [36] | 3.8
Ubuntu 18.04 LTS (Bionic Beaver) | 2028-04 [37] | [38] | 2.7[39] | 3.6
Ubuntu 16.04 LTS (Xenial Xerus) | 2021-04-30 [40] [ needs update ] | [38] | 2.7[39] | 3.5
Debian 12 | 2028-06 [41] | [41] | 3.11|
Debian 11 | 2026-06 [42] | [42] | 3.9|
Debian 10 | 2024-06 [43] [ needs update ] | [44] | 2.7[45] [ needs update ] | 3.7
Debian 9 | 2022-06-30 [46] [ needs update ] | [47] | 2.7[48] | 3.5
Red Hat Enterprise Linux 8 | 2029 | [49] | 2.73.6 |
Red Hat Enterprise Linux 7 | 2024-11-30 [50] | [51] | 2.7|
CentOS 8 | 2029-05-31 | 2.7 | 3.6 |
CentOS 7 | 2024-06-30[ needs update ] | [52] | 2.7|
SUSE Linux Enterprise Server 15 | 2031-07-31 | [53] | 2.73.6 |
SUSE Linux Enterprise Server 12 | 2027-10-31 | [54] | 2.7|
SUSE Linux Enterprise Server 11 | 2022-03-31[ needs update ] | [54] | 2.7|
Old version, not maintained Old version, still maintained Latest version |
CPython is one of several "production-quality" Python implementations including: Jython, written in Java for the Java virtual machine (JVM); PyPy, written in RPython and translated into C; and IronPython, written in C# for the Common Language Infrastructure. There are also several experimental implementations. [55]
A Linux distribution is an operating system made from a software collection that includes the Linux kernel and often a package management system. They are often obtained from the website of each distribution, which are available for a wide variety of systems ranging from embedded devices and personal computers to servers and powerful supercomputers.
Python is a high-level, general-purpose programming language. Its design philosophy emphasizes code readability with the use of significant indentation.
Unified Extensible Firmware Interface is a specification that defines an architecture for the platform firmware used for booting a computer's hardware and its interface for interaction with the operating system. Examples of firmware that implement the specification are AMI Aptio, Phoenix SecureCore, TianoCore EDK II, InsydeH2O.
Software versioning is the process of assigning either unique version names or unique version numbers to unique states of computer software. Within a given version number category, these numbers are generally assigned in increasing order and correspond to new developments in the software. At a fine-grained level, revision control is used for keeping track of incrementally-different versions of information, whether or not this information is computer software, in order to be able to roll any changes back.
IronPython is an implementation of the Python programming language targeting the .NET and Mono frameworks. The project is currently maintained by a group of volunteers at GitHub. It is free and open-source software, and can be implemented with Python Tools for Visual Studio, which is a free and open-source extension for Microsoft's Visual Studio IDE.
PyPy is an implementation of the Python programming language. PyPy often runs faster than the standard implementation CPython because PyPy uses a just-in-time compiler. Most Python code runs well on PyPy except for code that depends on CPython extensions, which either does not work or incurs some overhead when run in PyPy.
GNU variants are operating systems based upon the GNU operating system. According to the GNU project and others, these also include most operating systems using the Linux kernel and a few others using BSD-based kernels.
A global interpreter lock (GIL) is a mechanism used in computer-language interpreters to synchronize the execution of threads so that only one native thread can execute basic operations at a time. As a general rule, an interpreter that uses GIL will see only one thread to execute at a time, even if it runs on a multi-core processor, although some implementations provide for CPU intensive code to release the GIL, allowing multiple threads to use multiple cores. Some popular interpreters that have GIL are CPython and Ruby MRI.
WeeChat is a free and open-source Internet Relay Chat client that is designed to be light and fast. It is released under the terms of the GNU GPL-3.0-or-later and has been developed since 2003.
The Haskell Platform is a collection of software packages, tools and libraries that create a common platform for using and developing applications in Haskell. With the Haskell Platform, Haskell follows the same principle as Python: "Batteries included". Since 2022, the Haskell Platform has been deprecated.
Peppermint OS is a Linux distribution based on Debian and Devuan Stable, and formerly based on Ubuntu. It uses the Xfce desktop environment. It aims to provide a familiar environment for newcomers to Linux, which requires relatively low hardware resources to run.
KVIrc is a graphical IRC client for Linux, Unix, Mac OS and Windows. The name is an acronym of K Visual IRC in which the K stands for a dependency to KDE, which became optional from version 2.0.0. The software is based on the Qt framework and its code is released under a modified GNU General Public License.
Bodhi Linux is a light-weight Linux distribution based on Ubuntu that uses an Enlightenment DR17-based fork called Moksha as its desktop environment. The philosophy for the distribution is to provide a minimal base system so that users can install the software they want. In turn, the distribution only includes software that is essential to most users, such as a file manager (Thunar), a terminal emulator (Terminology), and a web browser. To install additional software, Bodhi Linux developers maintain a browser-based app store that uses apturl to install programs.
A delta update is a software update that requires the user to download only those parts of the software's code that are new, or have been changed from their previous state, in contrast to having to download the entire program. The use of delta updates can save significant amounts of time and computing bandwidth. The name "delta" derives from the mathematical science use of the Greek letter delta, Δ or δ to denote change.
Linspire is a commercial operating system based on Debian and Ubuntu and currently owned by PC/OpenSystems LLC. It had been owned by Linspire. Inc. from 2001 to 2008, and then by Xandros from 2008 to 2017.
Zim is a graphical text editor designed to maintain a collection of locally stored wiki-pages, a personal wiki. It works as a personal knowledge base and note-taking software application that operates on text files using markdown. Each wiki-page can contain things like text with simple formatting, links to other pages, attachments, and images. Additional plugins, such as an equation editor and spell-checker, are also available. The wiki-pages are stored in a folder structure in plain text files with wiki formatting. Zim can be used with the Getting Things Done method.
OpenZFS is an open-source implementation of the ZFS file system and volume manager initially developed by Sun Microsystems for the Solaris operating system, and is now maintained by the OpenZFS Project. Similar to the original ZFS, the implementation supports features like data compression, data deduplication, copy-on-write clones, snapshots, RAID-Z, and virtual devices that can create filesystems that span multiple disks.
Thonny is a free and open-source integrated development environment for Python that is designed for beginners. It was created by Aivar Annamaa, an Estonian programmer. It supports different ways of stepping through code, step-by-step expression evaluation, detailed visualization of the call stack and a mode for explaining the concepts of references and heap.
{{cite web}}
: Missing or empty |title=
(help)