blob: 9b708f10a2f71c476905a11b5f410bc9cb065b3b [file] [log] [blame]
Pablo Galindoa342a492022-03-16 11:25:44 +00001This is Python version 3.10.3
Pablo Galindob494f592021-10-04 18:27:07 +01002=============================
Guido van Rossum91447632000-04-11 17:11:09 +00003
Ernest W. Durbin IIId2b0ce62020-08-21 17:34:06 -04004.. image:: https://travis-ci.com/python/cpython.svg?branch=master
Victor Stinnerc9b62b42017-02-13 16:57:30 +01005 :alt: CPython build status on Travis CI
Ernest W. Durbin IIId2b0ce62020-08-21 17:34:06 -04006 :target: https://travis-ci.com/python/cpython
Victor Stinnerc9b62b42017-02-13 16:57:30 +01007
Steve Dower6a263cf2019-12-16 11:15:08 -08008.. image:: https://github.com/python/cpython/workflows/Tests/badge.svg
9 :alt: CPython build status on GitHub Actions
10 :target: https://github.com/python/cpython/actions
11
Steve Dower680d26e2018-09-24 08:04:33 -040012.. image:: https://dev.azure.com/python/cpython/_apis/build/status/Azure%20Pipelines%20CI?branchName=master
13 :alt: CPython build status on Azure DevOps
Steve Dowerb7d613f2018-09-11 10:47:46 -070014 :target: https://dev.azure.com/python/cpython/_build/latest?definitionId=4&branchName=master
Steve Dower757b73c2018-08-31 08:11:35 -070015
Erlend Egeberg Aaslandbef7b262021-04-02 05:30:40 +020016.. image:: https://img.shields.io/badge/discourse-join_chat-brightgreen.svg
17 :alt: Python Discourse chat
18 :target: https://discuss.python.org/
Steve Dower757b73c2018-08-31 08:11:35 -070019
Mariattab57eea12018-06-29 13:43:45 -070020
Miss Islington (bot)35955e42022-01-02 13:13:04 -080021Copyright (c) 2001-2022 Python Software Foundation. All rights reserved.
Guido van Rossum4405cf32007-08-30 17:16:55 +000022
Zachary Wared50f1882017-02-13 22:01:03 -060023See the end of this file for further copyright and license information.
24
INADA Naoki7c8b3fa2017-02-28 16:26:58 +090025.. contents::
26
Mariattae32ec932017-02-25 08:59:26 -080027General Information
28-------------------
29
30- Website: https://www.python.org
31- Source code: https://github.com/python/cpython
32- Issue tracker: https://bugs.python.org
33- Documentation: https://docs.python.org
Lisa Hewus Fresh384899d2017-08-30 09:37:43 -070034- Developer's Guide: https://devguide.python.org/
Mariattae32ec932017-02-25 08:59:26 -080035
Nick Coghlan1b3d88e2017-02-18 12:01:47 +053036Contributing to CPython
37-----------------------
38
39For more complete instructions on contributing to CPython development,
40see the `Developer Guide`_.
41
Lisa Hewus Fresh384899d2017-08-30 09:37:43 -070042.. _Developer Guide: https://devguide.python.org/
Guido van Rossum1c896e32007-08-29 23:03:30 +000043
Ned Batchelder3cdbd682017-02-13 12:05:47 -050044Using Python
45------------
46
47Installable Python kits, and information about using Python, are available at
48`python.org`_.
49
50.. _python.org: https://www.python.org/
51
Benjamin Peterson1da43e52009-06-26 13:21:52 +000052Build Instructions
53------------------
Guido van Rossum3ff96dd1996-07-30 18:05:04 +000054
Paul Schreiberc0866852017-02-20 08:08:59 -050055On Unix, Linux, BSD, macOS, and Cygwin::
Benjamin Peterson1da43e52009-06-26 13:21:52 +000056
57 ./configure
58 make
59 make test
60 sudo make install
61
Suriyaa ✌️️7e3fb402019-01-02 02:57:42 +010062This will install Python as ``python3``.
Benjamin Peterson1da43e52009-06-26 13:21:52 +000063
Zachary Wared50f1882017-02-13 22:01:03 -060064You can pass many options to the configure script; run ``./configure --help``
Ned Deily19d68422019-10-14 08:16:10 -040065to find out more. On macOS case-insensitive file systems and on Cygwin,
66the executable is called ``python.exe``; elsewhere it's just ``python``.
Benjamin Peterson1da43e52009-06-26 13:21:52 +000067
Ned Deily19d68422019-10-14 08:16:10 -040068Building a complete Python installation requires the use of various
69additional third-party libraries, depending on your build platform and
70configure options. Not all standard library modules are buildable or
71useable on all platforms. Refer to the
72`Install dependencies <https://devguide.python.org/setup/#install-dependencies>`_
73section of the `Developer Guide`_ for current detailed information on
74dependencies for various Linux distributions and macOS.
atg7000ee994d72018-06-07 19:33:20 -070075
Ned Deily19d68422019-10-14 08:16:10 -040076On macOS, there are additional configure and build options related
77to macOS framework and universal builds. Refer to `Mac/README.rst
78<https://github.com/python/cpython/blob/master/Mac/README.rst>`_.
Benjamin Peterson1da43e52009-06-26 13:21:52 +000079
Zachary Wared50f1882017-02-13 22:01:03 -060080On Windows, see `PCbuild/readme.txt
81<https://github.com/python/cpython/blob/master/PCbuild/readme.txt>`_.
Benjamin Peterson1da43e52009-06-26 13:21:52 +000082
Larry Hastingsf92f6c82015-09-12 17:28:39 +010083If you wish, you can create a subdirectory and invoke configure from there.
Victor Stinnerd783b012017-02-11 02:21:38 +010084For example::
Benjamin Peterson1da43e52009-06-26 13:21:52 +000085
86 mkdir debug
87 cd debug
88 ../configure --with-pydebug
89 make
90 make test
91
Zachary Wared50f1882017-02-13 22:01:03 -060092(This will fail if you *also* built at the top-level directory. You should do
Hossein Pourbozorg5f2b3b02019-05-02 12:47:55 +043093a ``make clean`` at the top-level first.)
Benjamin Peterson1da43e52009-06-26 13:21:52 +000094
Zachary Wared50f1882017-02-13 22:01:03 -060095To get an optimized build of Python, ``configure --enable-optimizations``
96before you run ``make``. This sets the default make targets up to enable
97Profile Guided Optimization (PGO) and may be used to auto-enable Link Time
98Optimization (LTO) on some platforms. For more details, see the sections
99below.
Brett Cannon7188a3e2015-09-18 15:13:44 -0700100
Brett Cannon7188a3e2015-09-18 15:13:44 -0700101Profile Guided Optimization
Evan Klitzke6db764a2017-02-27 22:32:07 -0800102^^^^^^^^^^^^^^^^^^^^^^^^^^^
Brett Cannon7188a3e2015-09-18 15:13:44 -0700103
Gregory P. Smithb87c1c92018-04-19 08:58:17 -0700104PGO takes advantage of recent versions of the GCC or Clang compilers. If used,
Gregory P. Smith93f9a8a2018-05-16 10:34:47 -0500105either via ``configure --enable-optimizations`` or by manually running
106``make profile-opt`` regardless of configure flags, the optimized build
107process will perform the following steps:
Brett Cannon7188a3e2015-09-18 15:13:44 -0700108
Gregory P. Smith93f9a8a2018-05-16 10:34:47 -0500109The entire Python directory is cleaned of temporary files that may have
110resulted from a previous compilation.
Brett Cannon7188a3e2015-09-18 15:13:44 -0700111
Gregory P. Smith93f9a8a2018-05-16 10:34:47 -0500112An instrumented version of the interpreter is built, using suitable compiler
Miss Islington (bot)7261b292021-05-28 13:03:10 -0700113flags for each flavor. Note that this is just an intermediary step. The
114binary resulting from this step is not good for real-life workloads as it has
Gregory P. Smith93f9a8a2018-05-16 10:34:47 -0500115profiling instructions embedded inside.
Brett Cannon7188a3e2015-09-18 15:13:44 -0700116
Gregory P. Smith93f9a8a2018-05-16 10:34:47 -0500117After the instrumented interpreter is built, the Makefile will run a training
Miss Islington (bot)7261b292021-05-28 13:03:10 -0700118workload. This is necessary in order to profile the interpreter's execution.
Gregory P. Smith93f9a8a2018-05-16 10:34:47 -0500119Note also that any output, both stdout and stderr, that may appear at this step
120is suppressed.
Brett Cannon7188a3e2015-09-18 15:13:44 -0700121
Gregory P. Smith93f9a8a2018-05-16 10:34:47 -0500122The final step is to build the actual interpreter, using the information
123collected from the instrumented one. The end result will be a Python binary
124that is optimized; suitable for distribution or production installation.
Brett Cannon7188a3e2015-09-18 15:13:44 -0700125
Benjamin Peterson1da43e52009-06-26 13:21:52 +0000126
Gregory P. Smith ext:(%20%5BGoogle%20Inc.%5D)014d52f2016-09-08 18:33:00 +0000127Link Time Optimization
Evan Klitzke6db764a2017-02-27 22:32:07 -0800128^^^^^^^^^^^^^^^^^^^^^^
Gregory P. Smith ext:(%20%5BGoogle%20Inc.%5D)014d52f2016-09-08 18:33:00 +0000129
Zachary Wared50f1882017-02-13 22:01:03 -0600130Enabled via configure's ``--with-lto`` flag. LTO takes advantage of the
131ability of recent compiler toolchains to optimize across the otherwise
132arbitrary ``.o`` file boundary when building final executables or shared
133libraries for additional performance gains.
Gregory P. Smith ext:(%20%5BGoogle%20Inc.%5D)014d52f2016-09-08 18:33:00 +0000134
135
Benjamin Peterson1da43e52009-06-26 13:21:52 +0000136What's New
137----------
138
Zachary Wared50f1882017-02-13 22:01:03 -0600139We have a comprehensive overview of the changes in the `What's New in Python
Pablo Galindod4fe0982020-05-19 03:33:01 +01001403.10 <https://docs.python.org/3.10/whatsnew/3.10.html>`_ document. For a more
Zachary Wared50f1882017-02-13 22:01:03 -0600141detailed change log, read `Misc/NEWS
Mariatta1b8f6122017-09-13 16:47:33 -0700142<https://github.com/python/cpython/blob/master/Misc/NEWS.d>`_, but a full
Zachary Wared50f1882017-02-13 22:01:03 -0600143accounting of changes can only be gleaned from the `commit history
144<https://github.com/python/cpython/commits/master>`_.
Benjamin Peterson1da43e52009-06-26 13:21:52 +0000145
Hossein Pourbozorg5f2b3b02019-05-02 12:47:55 +0430146If you want to install multiple versions of Python, see the section below
Benjamin Peterson1da43e52009-06-26 13:21:52 +0000147entitled "Installing multiple versions".
Guido van Rossum8d90f9d1997-05-22 20:13:25 +0000148
Guido van Rossumf501b4e1996-10-25 14:32:48 +0000149
Guido van Rossumc07d5fa2000-09-01 22:50:02 +0000150Documentation
151-------------
Guido van Rossum91cb9d21995-04-10 11:47:38 +0000152
Pablo Galindod4fe0982020-05-19 03:33:01 +0100153`Documentation for Python 3.10 <https://docs.python.org/3.10/>`_ is online,
Victor Stinnerd783b012017-02-11 02:21:38 +0100154updated daily.
Guido van Rossumc07d5fa2000-09-01 22:50:02 +0000155
Georg Brandl62069d32010-07-31 08:56:11 +0000156It can also be downloaded in many formats for faster access. The documentation
157is downloadable in HTML, PDF, and reStructuredText formats; the latter version
158is primarily for documentation authors, translators, and people with special
159formatting requirements.
Benjamin Peterson2a691a82008-03-31 01:51:45 +0000160
Rogerb3f1f592017-02-15 17:54:05 -0500161For information about building Python's documentation, refer to `Doc/README.rst
162<https://github.com/python/cpython/blob/master/Doc/README.rst>`_.
Ezio Melotti802bf8a2013-08-16 21:32:25 +0300163
Guido van Rossumc07d5fa2000-09-01 22:50:02 +0000164
Barry Warsaw97f005d2008-12-03 16:46:14 +0000165Converting From Python 2.x to 3.x
Guido van Rossum1c896e32007-08-29 23:03:30 +0000166---------------------------------
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000167
Zachary Wared50f1882017-02-13 22:01:03 -0600168Significant backward incompatible changes were made for the release of Python
1693.0, which may cause programs written for Python 2 to fail when run with Python
1703. For more information about porting your code from Python 2 to Python 3, see
171the `Porting HOWTO <https://docs.python.org/3/howto/pyporting.html>`_.
Benjamin Peterson1da43e52009-06-26 13:21:52 +0000172
Christian Heimesdd15f6c2008-03-16 00:07:10 +0000173
Benjamin Petersonad3d5c22009-02-26 03:38:59 +0000174Testing
175-------
176
Zachary Wared50f1882017-02-13 22:01:03 -0600177To test the interpreter, type ``make test`` in the top-level directory. The
178test set produces some output. You can generally ignore the messages about
179skipped tests due to optional features which can't be imported. If a message
180is printed about a failed test or a traceback or core dump is produced,
181something is wrong.
Benjamin Petersonad3d5c22009-02-26 03:38:59 +0000182
183By default, tests are prevented from overusing resources like disk space and
Victor Stinnerd783b012017-02-11 02:21:38 +0100184memory. To enable these tests, run ``make testall``.
Benjamin Petersonad3d5c22009-02-26 03:38:59 +0000185
Aaron Ang0f914b52018-04-09 14:09:31 -0700186If any tests fail, you can re-run the failing test(s) in verbose mode. For
187example, if ``test_os`` and ``test_gdb`` failed, you can run::
Benjamin Petersonad3d5c22009-02-26 03:38:59 +0000188
Aaron Ang0f914b52018-04-09 14:09:31 -0700189 make test TESTOPTS="-v test_os test_gdb"
Benjamin Petersonad3d5c22009-02-26 03:38:59 +0000190
Zachary Wared50f1882017-02-13 22:01:03 -0600191If the failure persists and appears to be a problem with Python rather than
192your environment, you can `file a bug report <https://bugs.python.org>`_ and
193include relevant output from that command to show the issue.
Benjamin Petersonad3d5c22009-02-26 03:38:59 +0000194
Michael Osipovcae8ff92018-08-17 23:43:34 +0200195See `Running & Writing Tests <https://devguide.python.org/runtests/>`_
196for more on running tests.
Benjamin Petersonad3d5c22009-02-26 03:38:59 +0000197
Christian Heimesdd15f6c2008-03-16 00:07:10 +0000198Installing multiple versions
199----------------------------
200
201On Unix and Mac systems if you intend to install multiple versions of Python
Zachary Wared50f1882017-02-13 22:01:03 -0600202using the same installation prefix (``--prefix`` argument to the configure
203script) you must take care that your primary python executable is not
204overwritten by the installation of a different version. All files and
205directories installed using ``make altinstall`` contain the major and minor
206version and can thus live side-by-side. ``make install`` also creates
207``${prefix}/bin/python3`` which refers to ``${prefix}/bin/pythonX.Y``. If you
208intend to install multiple versions using the same prefix you must decide which
209version (if any) is your "primary" version. Install that version using ``make
210install``. Install all other versions using ``make altinstall``.
Christian Heimesdd15f6c2008-03-16 00:07:10 +0000211
Pablo Galindod4fe0982020-05-19 03:33:01 +0100212For example, if you want to install Python 2.7, 3.6, and 3.10 with 3.10 being the
213primary version, you would execute ``make install`` in your 3.10 build directory
Victor Stinnerd783b012017-02-11 02:21:38 +0100214and ``make altinstall`` in the others.
Christian Heimesdd15f6c2008-03-16 00:07:10 +0000215
216
Guido van Rossum1c896e32007-08-29 23:03:30 +0000217Issue Tracker and Mailing List
218------------------------------
Michael W. Hudson71dcc3e2005-02-22 15:33:26 +0000219
Zachary Wared50f1882017-02-13 22:01:03 -0600220Bug reports are welcome! You can use the `issue tracker
221<https://bugs.python.org>`_ to report bugs, and/or submit pull requests `on
222GitHub <https://github.com/python/cpython>`_.
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000223
Zachary Wared50f1882017-02-13 22:01:03 -0600224You can also follow development discussion on the `python-dev mailing list
225<https://mail.python.org/mailman/listinfo/python-dev/>`_.
Georg Brandl81299ad2006-02-20 10:24:06 +0000226
Michael W. Hudson71dcc3e2005-02-22 15:33:26 +0000227
Benjamin Peterson1da43e52009-06-26 13:21:52 +0000228Proposals for enhancement
229-------------------------
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000230
Benjamin Peterson1da43e52009-06-26 13:21:52 +0000231If you have a proposal to change Python, you may want to send an email to the
Miss Islington (bot)c6c120d2021-08-23 12:23:48 -0700232`comp.lang.python`_ or `python-ideas`_ mailing lists for initial feedback. A
Zachary Wared50f1882017-02-13 22:01:03 -0600233Python Enhancement Proposal (PEP) may be submitted if your idea gains ground.
234All current PEPs, as well as guidelines for submitting a new PEP, are listed at
Victor Stinnerd783b012017-02-11 02:21:38 +0100235`python.org/dev/peps/ <https://www.python.org/dev/peps/>`_.
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000236
Ned Batchelder3cdbd682017-02-13 12:05:47 -0500237.. _python-ideas: https://mail.python.org/mailman/listinfo/python-ideas/
Miss Islington (bot)c6c120d2021-08-23 12:23:48 -0700238.. _comp.lang.python: https://mail.python.org/mailman/listinfo/python-list
Guido van Rossum1c896e32007-08-29 23:03:30 +0000239
Zachary Wared50f1882017-02-13 22:01:03 -0600240
Benjamin Peterson1da43e52009-06-26 13:21:52 +0000241Release Schedule
242----------------
Guido van Rossum1c896e32007-08-29 23:03:30 +0000243
Nishit666f5832020-10-09 15:02:15 +0530244See :pep:`619` for Python 3.10 release details.
Guido van Rossumef0f1292007-08-30 14:51:05 +0000245
246
247Copyright and License Information
248---------------------------------
249
Miss Islington (bot)35955e42022-01-02 13:13:04 -0800250Copyright (c) 2001-2022 Python Software Foundation. All rights reserved.
Guido van Rossumef0f1292007-08-30 14:51:05 +0000251
Georg Brandl260a7882011-02-20 10:29:04 +0000252Copyright (c) 2000 BeOpen.com. All rights reserved.
Guido van Rossumef0f1292007-08-30 14:51:05 +0000253
Georg Brandl260a7882011-02-20 10:29:04 +0000254Copyright (c) 1995-2001 Corporation for National Research Initiatives. All
255rights reserved.
Guido van Rossumef0f1292007-08-30 14:51:05 +0000256
Georg Brandl260a7882011-02-20 10:29:04 +0000257Copyright (c) 1991-1995 Stichting Mathematisch Centrum. All rights reserved.
Guido van Rossumef0f1292007-08-30 14:51:05 +0000258
Will Binns3112aab2020-08-24 17:00:12 +0200259See the `LICENSE <https://github.com/python/cpython/blob/master/LICENSE>`_ for
260information on the history of this software, terms & conditions for usage, and a
261DISCLAIMER OF ALL WARRANTIES.
Guido van Rossumef0f1292007-08-30 14:51:05 +0000262
Larry Hastingsf92f6c82015-09-12 17:28:39 +0100263This Python distribution contains *no* GNU General Public License (GPL) code,
264so it may be used in proprietary projects. There are interfaces to some GNU
265code but these are entirely optional.
Guido van Rossumef0f1292007-08-30 14:51:05 +0000266
Georg Brandl260a7882011-02-20 10:29:04 +0000267All trademarks referenced herein are property of their respective holders.