blob: 76d70b3e2d6d13a41518f5d780bdbcddb528886c [file] [log] [blame]
Łukasz Langafa919fd2019-10-14 15:34:47 +02001This is Python version 3.8.0
2============================
Guido van Rossum91447632000-04-11 17:11:09 +00003
Zachary Ware50290e32019-10-11 11:30:03 -05004.. image:: https://travis-ci.org/python/cpython.svg?branch=3.8
Victor Stinnerc9b62b42017-02-13 16:57:30 +01005 :alt: CPython build status on Travis CI
Zachary Ware50290e32019-10-11 11:30:03 -05006 :target: https://travis-ci.org/python/cpython/branches
Victor Stinnerc9b62b42017-02-13 16:57:30 +01007
Zachary Ware50290e32019-10-11 11:30:03 -05008.. image:: https://dev.azure.com/python/cpython/_apis/build/status/Azure%20Pipelines%20CI?branchName=3.8
Steve Dower680d26e2018-09-24 08:04:33 -04009 :alt: CPython build status on Azure DevOps
Zachary Ware50290e32019-10-11 11:30:03 -050010 :target: https://dev.azure.com/python/cpython/_build/latest?definitionId=4&branchName=3.8
Steve Dower757b73c2018-08-31 08:11:35 -070011
Zachary Ware50290e32019-10-11 11:30:03 -050012.. image:: https://codecov.io/gh/python/cpython/branch/3.8/graph/badge.svg
Victor Stinnerc9b62b42017-02-13 16:57:30 +010013 :alt: CPython code coverage on Codecov
Zachary Ware50290e32019-10-11 11:30:03 -050014 :target: https://codecov.io/gh/python/cpython/branch/3.8
Victor Stinnerc9b62b42017-02-13 16:57:30 +010015
Mariattab57eea12018-06-29 13:43:45 -070016.. image:: https://img.shields.io/badge/zulip-join_chat-brightgreen.svg
17 :alt: Python Zulip chat
18 :target: https://python.zulipchat.com
Steve Dower757b73c2018-08-31 08:11:35 -070019
Mariattab57eea12018-06-29 13:43:45 -070020
Benjamin Peterson9a69ae82019-01-02 07:46:53 -080021Copyright (c) 2001-2019 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``
Miss Islington (bot)80f85322019-10-14 05:35:28 -070065to 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
Miss Islington (bot)80f85322019-10-14 05:35:28 -070068Building 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
Miss Islington (bot)80f85322019-10-14 05:35:28 -070076On macOS, there are additional configure and build options related
77to macOS framework and universal builds. Refer to `Mac/README.rst
Ned Deilyc0c6ae92019-10-14 09:14:21 -040078<https://github.com/python/cpython/blob/3.8/Mac/README.rst>`_.
Benjamin Peterson1da43e52009-06-26 13:21:52 +000079
Zachary Wared50f1882017-02-13 22:01:03 -060080On Windows, see `PCbuild/readme.txt
Ned Deilyc0c6ae92019-10-14 09:14:21 -040081<https://github.com/python/cpython/blob/3.8/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
113flags for each flavour. Note that this is just an intermediary step. The
114binary resulting from this step is not good for real life workloads as it has
115profiling 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
118workload. This is necessary in order to profile the interpreter execution.
119Note 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
Ned Deily5489bda2018-01-31 17:44:09 -05001403.8 <https://docs.python.org/3.8/whatsnew/3.8.html>`_ document. For a more
Zachary Wared50f1882017-02-13 22:01:03 -0600141detailed change log, read `Misc/NEWS
Ned Deilyc0c6ae92019-10-14 09:14:21 -0400142<https://github.com/python/cpython/blob/3.8/Misc/NEWS.d>`_, but a full
Zachary Wared50f1882017-02-13 22:01:03 -0600143accounting of changes can only be gleaned from the `commit history
Ned Deilyc0c6ae92019-10-14 09:14:21 -0400144<https://github.com/python/cpython/commits/3.8>`_.
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
Ned Deily5489bda2018-01-31 17:44:09 -0500153`Documentation for Python 3.8 <https://docs.python.org/3.8/>`_ 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
Ned Deilyc0c6ae92019-10-14 09:14:21 -0400162<https://github.com/python/cpython/blob/3.8/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
Ned Deily5489bda2018-01-31 17:44:09 -0500212For example, if you want to install Python 2.7, 3.6, and 3.8 with 3.8 being the
213primary version, you would execute ``make install`` in your 3.8 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
Zachary Wared50f1882017-02-13 22:01:03 -0600232comp.lang.python or `python-ideas`_ mailing lists for initial feedback. A
233Python 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/
Guido van Rossum1c896e32007-08-29 23:03:30 +0000238
Zachary Wared50f1882017-02-13 22:01:03 -0600239
Benjamin Peterson1da43e52009-06-26 13:21:52 +0000240Release Schedule
241----------------
Guido van Rossum1c896e32007-08-29 23:03:30 +0000242
Ned Deily5489bda2018-01-31 17:44:09 -0500243See :pep:`569` for Python 3.8 release details.
Guido van Rossumef0f1292007-08-30 14:51:05 +0000244
245
246Copyright and License Information
247---------------------------------
248
Benjamin Peterson9a69ae82019-01-02 07:46:53 -0800249Copyright (c) 2001-2019 Python Software Foundation. All rights reserved.
Guido van Rossumef0f1292007-08-30 14:51:05 +0000250
Georg Brandl260a7882011-02-20 10:29:04 +0000251Copyright (c) 2000 BeOpen.com. All rights reserved.
Guido van Rossumef0f1292007-08-30 14:51:05 +0000252
Georg Brandl260a7882011-02-20 10:29:04 +0000253Copyright (c) 1995-2001 Corporation for National Research Initiatives. All
254rights reserved.
Guido van Rossumef0f1292007-08-30 14:51:05 +0000255
Georg Brandl260a7882011-02-20 10:29:04 +0000256Copyright (c) 1991-1995 Stichting Mathematisch Centrum. All rights reserved.
Guido van Rossumef0f1292007-08-30 14:51:05 +0000257
Zachary Wared50f1882017-02-13 22:01:03 -0600258See the file "LICENSE" for information on the history of this software, terms &
259conditions for usage, and a DISCLAIMER OF ALL WARRANTIES.
Guido van Rossumef0f1292007-08-30 14:51:05 +0000260
Larry Hastingsf92f6c82015-09-12 17:28:39 +0100261This Python distribution contains *no* GNU General Public License (GPL) code,
262so it may be used in proprietary projects. There are interfaces to some GNU
263code but these are entirely optional.
Guido van Rossumef0f1292007-08-30 14:51:05 +0000264
Georg Brandl260a7882011-02-20 10:29:04 +0000265All trademarks referenced herein are property of their respective holders.