blob: c65f6e29d41394d257368d5a1b7d7804c1740c5e [file] [log] [blame]
Ned Deily5489bda2018-01-31 17:44:09 -05001This is Python version 3.8.0 alpha 0
2====================================
Guido van Rossum91447632000-04-11 17:11:09 +00003
Victor Stinnerc9b62b42017-02-13 16:57:30 +01004.. image:: https://travis-ci.org/python/cpython.svg?branch=master
5 :alt: CPython build status on Travis CI
6 :target: https://travis-ci.org/python/cpython
7
Zachary Wared31b28e2017-03-05 15:45:53 -06008.. image:: https://ci.appveyor.com/api/projects/status/4mew1a93xdkbf5ua/branch/master?svg=true
9 :alt: CPython build status on Appveyor
10 :target: https://ci.appveyor.com/project/python/cpython/branch/master
11
Steve Dowerb7d613f2018-09-11 10:47:46 -070012.. image:: https://dev.azure.com/python/cpython/_apis/build/status/Linux-Buildbot?branchName=master&label=Linux
13 :alt: CPython build status on Azure DevOps (Linux)
14 :target: https://dev.azure.com/python/cpython/_build/latest?definitionId=6&branchName=master
Steve Dower757b73c2018-08-31 08:11:35 -070015
Steve Dowerb7d613f2018-09-11 10:47:46 -070016.. image:: https://dev.azure.com/python/cpython/_apis/build/status/macOS-Buildbot?branchName=master&label=macOS
17 :alt: CPython build status on Azure DevOps (macOS)
18 :target: https://dev.azure.com/python/cpython/_build/latest?definitionId=5&branchName=master
Steve Dower757b73c2018-08-31 08:11:35 -070019
Steve Dowerb7d613f2018-09-11 10:47:46 -070020.. image:: https://dev.azure.com/python/cpython/_apis/build/status/Windows-Buildbot?branchName=master&label=Windows
21 :alt: CPython build status on Azure DevOps (Windows)
22 :target: https://dev.azure.com/python/cpython/_build/latest?definitionId=4&branchName=master
Steve Dower757b73c2018-08-31 08:11:35 -070023
Victor Stinnerc9b62b42017-02-13 16:57:30 +010024.. image:: https://codecov.io/gh/python/cpython/branch/master/graph/badge.svg
25 :alt: CPython code coverage on Codecov
26 :target: https://codecov.io/gh/python/cpython
27
Mariattab57eea12018-06-29 13:43:45 -070028.. image:: https://img.shields.io/badge/zulip-join_chat-brightgreen.svg
29 :alt: Python Zulip chat
30 :target: https://python.zulipchat.com
Steve Dower757b73c2018-08-31 08:11:35 -070031
Mariattab57eea12018-06-29 13:43:45 -070032
Benjamin Petersonf606e682011-12-31 22:42:26 -060033Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
Benjamin Peterson65f2a6d2018-01-04 22:34:19 -0800342012, 2013, 2014, 2015, 2016, 2017, 2018 Python Software Foundation. All rights
Benjamin Petersone527dd32017-01-01 22:04:13 -060035reserved.
Guido van Rossum4405cf32007-08-30 17:16:55 +000036
Zachary Wared50f1882017-02-13 22:01:03 -060037See the end of this file for further copyright and license information.
38
INADA Naoki7c8b3fa2017-02-28 16:26:58 +090039.. contents::
40
Mariattae32ec932017-02-25 08:59:26 -080041General Information
42-------------------
43
44- Website: https://www.python.org
45- Source code: https://github.com/python/cpython
46- Issue tracker: https://bugs.python.org
47- Documentation: https://docs.python.org
Lisa Hewus Fresh384899d2017-08-30 09:37:43 -070048- Developer's Guide: https://devguide.python.org/
Mariattae32ec932017-02-25 08:59:26 -080049
Nick Coghlan1b3d88e2017-02-18 12:01:47 +053050Contributing to CPython
51-----------------------
52
53For more complete instructions on contributing to CPython development,
54see the `Developer Guide`_.
55
Lisa Hewus Fresh384899d2017-08-30 09:37:43 -070056.. _Developer Guide: https://devguide.python.org/
Guido van Rossum1c896e32007-08-29 23:03:30 +000057
Ned Batchelder3cdbd682017-02-13 12:05:47 -050058Using Python
59------------
60
61Installable Python kits, and information about using Python, are available at
62`python.org`_.
63
64.. _python.org: https://www.python.org/
65
Benjamin Peterson1da43e52009-06-26 13:21:52 +000066Build Instructions
67------------------
Guido van Rossum3ff96dd1996-07-30 18:05:04 +000068
Paul Schreiberc0866852017-02-20 08:08:59 -050069On Unix, Linux, BSD, macOS, and Cygwin::
Benjamin Peterson1da43e52009-06-26 13:21:52 +000070
71 ./configure
72 make
73 make test
74 sudo make install
75
76This will install Python as python3.
77
Zachary Wared50f1882017-02-13 22:01:03 -060078You can pass many options to the configure script; run ``./configure --help``
Paul Schreiberc0866852017-02-20 08:08:59 -050079to find out more. On macOS and Cygwin, the executable is called ``python.exe``;
Victor Stinnerd783b012017-02-11 02:21:38 +010080elsewhere it's just ``python``.
Benjamin Peterson1da43e52009-06-26 13:21:52 +000081
atg7000ee994d72018-06-07 19:33:20 -070082If you are running on macOS with the latest updates installed, make sure to install
83openSSL or some other SSL software along with Homebrew or another package manager.
84If issues persist, see https://devguide.python.org/setup/#macos-and-os-x for more
85information.
86
Paul Schreiberc0866852017-02-20 08:08:59 -050087On macOS, if you have configured Python with ``--enable-framework``, you
Zachary Wared50f1882017-02-13 22:01:03 -060088should use ``make frameworkinstall`` to do the installation. Note that this
89installs the Python executable in a place that is not normally on your PATH,
90you may want to set up a symlink in ``/usr/local/bin``.
Benjamin Peterson1da43e52009-06-26 13:21:52 +000091
Zachary Wared50f1882017-02-13 22:01:03 -060092On Windows, see `PCbuild/readme.txt
93<https://github.com/python/cpython/blob/master/PCbuild/readme.txt>`_.
Benjamin Peterson1da43e52009-06-26 13:21:52 +000094
Larry Hastingsf92f6c82015-09-12 17:28:39 +010095If you wish, you can create a subdirectory and invoke configure from there.
Victor Stinnerd783b012017-02-11 02:21:38 +010096For example::
Benjamin Peterson1da43e52009-06-26 13:21:52 +000097
98 mkdir debug
99 cd debug
100 ../configure --with-pydebug
101 make
102 make test
103
Zachary Wared50f1882017-02-13 22:01:03 -0600104(This will fail if you *also* built at the top-level directory. You should do
105a ``make clean`` at the toplevel first.)
Benjamin Peterson1da43e52009-06-26 13:21:52 +0000106
Zachary Wared50f1882017-02-13 22:01:03 -0600107To get an optimized build of Python, ``configure --enable-optimizations``
108before you run ``make``. This sets the default make targets up to enable
109Profile Guided Optimization (PGO) and may be used to auto-enable Link Time
110Optimization (LTO) on some platforms. For more details, see the sections
111below.
Brett Cannon7188a3e2015-09-18 15:13:44 -0700112
113
114Profile Guided Optimization
Evan Klitzke6db764a2017-02-27 22:32:07 -0800115^^^^^^^^^^^^^^^^^^^^^^^^^^^
Brett Cannon7188a3e2015-09-18 15:13:44 -0700116
Gregory P. Smithb87c1c92018-04-19 08:58:17 -0700117PGO takes advantage of recent versions of the GCC or Clang compilers. If used,
Gregory P. Smith93f9a8a2018-05-16 10:34:47 -0500118either via ``configure --enable-optimizations`` or by manually running
119``make profile-opt`` regardless of configure flags, the optimized build
120process will perform the following steps:
Brett Cannon7188a3e2015-09-18 15:13:44 -0700121
Gregory P. Smith93f9a8a2018-05-16 10:34:47 -0500122The entire Python directory is cleaned of temporary files that may have
123resulted from a previous compilation.
Brett Cannon7188a3e2015-09-18 15:13:44 -0700124
Gregory P. Smith93f9a8a2018-05-16 10:34:47 -0500125An instrumented version of the interpreter is built, using suitable compiler
126flags for each flavour. Note that this is just an intermediary step. The
127binary resulting from this step is not good for real life workloads as it has
128profiling instructions embedded inside.
Brett Cannon7188a3e2015-09-18 15:13:44 -0700129
Gregory P. Smith93f9a8a2018-05-16 10:34:47 -0500130After the instrumented interpreter is built, the Makefile will run a training
131workload. This is necessary in order to profile the interpreter execution.
132Note also that any output, both stdout and stderr, that may appear at this step
133is suppressed.
Brett Cannon7188a3e2015-09-18 15:13:44 -0700134
Gregory P. Smith93f9a8a2018-05-16 10:34:47 -0500135The final step is to build the actual interpreter, using the information
136collected from the instrumented one. The end result will be a Python binary
137that is optimized; suitable for distribution or production installation.
Brett Cannon7188a3e2015-09-18 15:13:44 -0700138
Benjamin Peterson1da43e52009-06-26 13:21:52 +0000139
Gregory P. Smith ext:(%20%5BGoogle%20Inc.%5D)014d52f2016-09-08 18:33:00 +0000140Link Time Optimization
Evan Klitzke6db764a2017-02-27 22:32:07 -0800141^^^^^^^^^^^^^^^^^^^^^^
Gregory P. Smith ext:(%20%5BGoogle%20Inc.%5D)014d52f2016-09-08 18:33:00 +0000142
Zachary Wared50f1882017-02-13 22:01:03 -0600143Enabled via configure's ``--with-lto`` flag. LTO takes advantage of the
144ability of recent compiler toolchains to optimize across the otherwise
145arbitrary ``.o`` file boundary when building final executables or shared
146libraries for additional performance gains.
Gregory P. Smith ext:(%20%5BGoogle%20Inc.%5D)014d52f2016-09-08 18:33:00 +0000147
148
Benjamin Peterson1da43e52009-06-26 13:21:52 +0000149What's New
150----------
151
Zachary Wared50f1882017-02-13 22:01:03 -0600152We have a comprehensive overview of the changes in the `What's New in Python
Ned Deily5489bda2018-01-31 17:44:09 -05001533.8 <https://docs.python.org/3.8/whatsnew/3.8.html>`_ document. For a more
Zachary Wared50f1882017-02-13 22:01:03 -0600154detailed change log, read `Misc/NEWS
Mariatta1b8f6122017-09-13 16:47:33 -0700155<https://github.com/python/cpython/blob/master/Misc/NEWS.d>`_, but a full
Zachary Wared50f1882017-02-13 22:01:03 -0600156accounting of changes can only be gleaned from the `commit history
157<https://github.com/python/cpython/commits/master>`_.
Benjamin Peterson1da43e52009-06-26 13:21:52 +0000158
159If you want to install multiple versions of Python see the section below
160entitled "Installing multiple versions".
Guido van Rossum8d90f9d1997-05-22 20:13:25 +0000161
Guido van Rossumf501b4e1996-10-25 14:32:48 +0000162
Guido van Rossumc07d5fa2000-09-01 22:50:02 +0000163Documentation
164-------------
Guido van Rossum91cb9d21995-04-10 11:47:38 +0000165
Ned Deily5489bda2018-01-31 17:44:09 -0500166`Documentation for Python 3.8 <https://docs.python.org/3.8/>`_ is online,
Victor Stinnerd783b012017-02-11 02:21:38 +0100167updated daily.
Guido van Rossumc07d5fa2000-09-01 22:50:02 +0000168
Georg Brandl62069d32010-07-31 08:56:11 +0000169It can also be downloaded in many formats for faster access. The documentation
170is downloadable in HTML, PDF, and reStructuredText formats; the latter version
171is primarily for documentation authors, translators, and people with special
172formatting requirements.
Benjamin Peterson2a691a82008-03-31 01:51:45 +0000173
Rogerb3f1f592017-02-15 17:54:05 -0500174For information about building Python's documentation, refer to `Doc/README.rst
175<https://github.com/python/cpython/blob/master/Doc/README.rst>`_.
Ezio Melotti802bf8a2013-08-16 21:32:25 +0300176
Guido van Rossumc07d5fa2000-09-01 22:50:02 +0000177
Barry Warsaw97f005d2008-12-03 16:46:14 +0000178Converting From Python 2.x to 3.x
Guido van Rossum1c896e32007-08-29 23:03:30 +0000179---------------------------------
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000180
Zachary Wared50f1882017-02-13 22:01:03 -0600181Significant backward incompatible changes were made for the release of Python
1823.0, which may cause programs written for Python 2 to fail when run with Python
1833. For more information about porting your code from Python 2 to Python 3, see
184the `Porting HOWTO <https://docs.python.org/3/howto/pyporting.html>`_.
Benjamin Peterson1da43e52009-06-26 13:21:52 +0000185
Christian Heimesdd15f6c2008-03-16 00:07:10 +0000186
Benjamin Petersonad3d5c22009-02-26 03:38:59 +0000187Testing
188-------
189
Zachary Wared50f1882017-02-13 22:01:03 -0600190To test the interpreter, type ``make test`` in the top-level directory. The
191test set produces some output. You can generally ignore the messages about
192skipped tests due to optional features which can't be imported. If a message
193is printed about a failed test or a traceback or core dump is produced,
194something is wrong.
Benjamin Petersonad3d5c22009-02-26 03:38:59 +0000195
196By default, tests are prevented from overusing resources like disk space and
Victor Stinnerd783b012017-02-11 02:21:38 +0100197memory. To enable these tests, run ``make testall``.
Benjamin Petersonad3d5c22009-02-26 03:38:59 +0000198
Aaron Ang0f914b52018-04-09 14:09:31 -0700199If any tests fail, you can re-run the failing test(s) in verbose mode. For
200example, if ``test_os`` and ``test_gdb`` failed, you can run::
Benjamin Petersonad3d5c22009-02-26 03:38:59 +0000201
Aaron Ang0f914b52018-04-09 14:09:31 -0700202 make test TESTOPTS="-v test_os test_gdb"
Benjamin Petersonad3d5c22009-02-26 03:38:59 +0000203
Zachary Wared50f1882017-02-13 22:01:03 -0600204If the failure persists and appears to be a problem with Python rather than
205your environment, you can `file a bug report <https://bugs.python.org>`_ and
206include relevant output from that command to show the issue.
Benjamin Petersonad3d5c22009-02-26 03:38:59 +0000207
Michael Osipovcae8ff92018-08-17 23:43:34 +0200208See `Running & Writing Tests <https://devguide.python.org/runtests/>`_
209for more on running tests.
Benjamin Petersonad3d5c22009-02-26 03:38:59 +0000210
Christian Heimesdd15f6c2008-03-16 00:07:10 +0000211Installing multiple versions
212----------------------------
213
214On Unix and Mac systems if you intend to install multiple versions of Python
Zachary Wared50f1882017-02-13 22:01:03 -0600215using the same installation prefix (``--prefix`` argument to the configure
216script) you must take care that your primary python executable is not
217overwritten by the installation of a different version. All files and
218directories installed using ``make altinstall`` contain the major and minor
219version and can thus live side-by-side. ``make install`` also creates
220``${prefix}/bin/python3`` which refers to ``${prefix}/bin/pythonX.Y``. If you
221intend to install multiple versions using the same prefix you must decide which
222version (if any) is your "primary" version. Install that version using ``make
223install``. Install all other versions using ``make altinstall``.
Christian Heimesdd15f6c2008-03-16 00:07:10 +0000224
Ned Deily5489bda2018-01-31 17:44:09 -0500225For example, if you want to install Python 2.7, 3.6, and 3.8 with 3.8 being the
226primary version, you would execute ``make install`` in your 3.8 build directory
Victor Stinnerd783b012017-02-11 02:21:38 +0100227and ``make altinstall`` in the others.
Christian Heimesdd15f6c2008-03-16 00:07:10 +0000228
229
Guido van Rossum1c896e32007-08-29 23:03:30 +0000230Issue Tracker and Mailing List
231------------------------------
Michael W. Hudson71dcc3e2005-02-22 15:33:26 +0000232
Zachary Wared50f1882017-02-13 22:01:03 -0600233Bug reports are welcome! You can use the `issue tracker
234<https://bugs.python.org>`_ to report bugs, and/or submit pull requests `on
235GitHub <https://github.com/python/cpython>`_.
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000236
Zachary Wared50f1882017-02-13 22:01:03 -0600237You can also follow development discussion on the `python-dev mailing list
238<https://mail.python.org/mailman/listinfo/python-dev/>`_.
Georg Brandl81299ad2006-02-20 10:24:06 +0000239
Michael W. Hudson71dcc3e2005-02-22 15:33:26 +0000240
Benjamin Peterson1da43e52009-06-26 13:21:52 +0000241Proposals for enhancement
242-------------------------
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000243
Benjamin Peterson1da43e52009-06-26 13:21:52 +0000244If you have a proposal to change Python, you may want to send an email to the
Zachary Wared50f1882017-02-13 22:01:03 -0600245comp.lang.python or `python-ideas`_ mailing lists for initial feedback. A
246Python Enhancement Proposal (PEP) may be submitted if your idea gains ground.
247All current PEPs, as well as guidelines for submitting a new PEP, are listed at
Victor Stinnerd783b012017-02-11 02:21:38 +0100248`python.org/dev/peps/ <https://www.python.org/dev/peps/>`_.
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000249
Ned Batchelder3cdbd682017-02-13 12:05:47 -0500250.. _python-ideas: https://mail.python.org/mailman/listinfo/python-ideas/
Guido van Rossum1c896e32007-08-29 23:03:30 +0000251
Zachary Wared50f1882017-02-13 22:01:03 -0600252
Benjamin Peterson1da43e52009-06-26 13:21:52 +0000253Release Schedule
254----------------
Guido van Rossum1c896e32007-08-29 23:03:30 +0000255
Ned Deily5489bda2018-01-31 17:44:09 -0500256See :pep:`569` for Python 3.8 release details.
Guido van Rossumef0f1292007-08-30 14:51:05 +0000257
258
259Copyright and License Information
260---------------------------------
261
Georg Brandla7d2f002013-03-23 16:06:13 +0100262Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
Benjamin Peterson65f2a6d2018-01-04 22:34:19 -08002632012, 2013, 2014, 2015, 2016, 2017, 2018 Python Software Foundation. All rights
Christian Heimes0c72a0c2017-09-07 13:59:13 -0700264reserved.
Guido van Rossumef0f1292007-08-30 14:51:05 +0000265
Georg Brandl260a7882011-02-20 10:29:04 +0000266Copyright (c) 2000 BeOpen.com. All rights reserved.
Guido van Rossumef0f1292007-08-30 14:51:05 +0000267
Georg Brandl260a7882011-02-20 10:29:04 +0000268Copyright (c) 1995-2001 Corporation for National Research Initiatives. All
269rights reserved.
Guido van Rossumef0f1292007-08-30 14:51:05 +0000270
Georg Brandl260a7882011-02-20 10:29:04 +0000271Copyright (c) 1991-1995 Stichting Mathematisch Centrum. All rights reserved.
Guido van Rossumef0f1292007-08-30 14:51:05 +0000272
Zachary Wared50f1882017-02-13 22:01:03 -0600273See the file "LICENSE" for information on the history of this software, terms &
274conditions for usage, and a DISCLAIMER OF ALL WARRANTIES.
Guido van Rossumef0f1292007-08-30 14:51:05 +0000275
Larry Hastingsf92f6c82015-09-12 17:28:39 +0100276This Python distribution contains *no* GNU General Public License (GPL) code,
277so it may be used in proprietary projects. There are interfaces to some GNU
278code but these are entirely optional.
Guido van Rossumef0f1292007-08-30 14:51:05 +0000279
Georg Brandl260a7882011-02-20 10:29:04 +0000280All trademarks referenced herein are property of their respective holders.