blob: c6cca80b41273a0fbf02aa67e89b59f5ffd8c421 [file] [log] [blame]
Ned Deily4829bc62016-09-12 17:29:04 -04001This is Python version 3.7.0 alpha 1
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
8.. image:: https://codecov.io/gh/python/cpython/branch/master/graph/badge.svg
9 :alt: CPython code coverage on Codecov
10 :target: https://codecov.io/gh/python/cpython
11
Benjamin Petersonf606e682011-12-31 22:42:26 -060012Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
Benjamin Petersone527dd32017-01-01 22:04:13 -0600132012, 2013, 2014, 2015, 2016, 2017 Python Software Foundation. All rights
14reserved.
Guido van Rossum4405cf32007-08-30 17:16:55 +000015
Zachary Wared50f1882017-02-13 22:01:03 -060016See the end of this file for further copyright and license information.
17
Guido van Rossum1c896e32007-08-29 23:03:30 +000018
Ned Batchelder3cdbd682017-02-13 12:05:47 -050019Using Python
20------------
21
22Installable Python kits, and information about using Python, are available at
23`python.org`_.
24
25.. _python.org: https://www.python.org/
26
Guido van Rossum50e9fb92006-08-17 05:42:55 +000027
Benjamin Peterson1da43e52009-06-26 13:21:52 +000028Build Instructions
29------------------
Guido van Rossum3ff96dd1996-07-30 18:05:04 +000030
Victor Stinnerd783b012017-02-11 02:21:38 +010031On Unix, Linux, BSD, OSX, and Cygwin::
Benjamin Peterson1da43e52009-06-26 13:21:52 +000032
33 ./configure
34 make
35 make test
36 sudo make install
37
38This will install Python as python3.
39
Zachary Wared50f1882017-02-13 22:01:03 -060040You can pass many options to the configure script; run ``./configure --help``
41to find out more. On OSX and Cygwin, the executable is called ``python.exe``;
Victor Stinnerd783b012017-02-11 02:21:38 +010042elsewhere it's just ``python``.
Benjamin Peterson1da43e52009-06-26 13:21:52 +000043
Zachary Wared50f1882017-02-13 22:01:03 -060044On Mac OS X, if you have configured Python with ``--enable-framework``, you
45should use ``make frameworkinstall`` to do the installation. Note that this
46installs the Python executable in a place that is not normally on your PATH,
47you may want to set up a symlink in ``/usr/local/bin``.
Benjamin Peterson1da43e52009-06-26 13:21:52 +000048
Zachary Wared50f1882017-02-13 22:01:03 -060049On Windows, see `PCbuild/readme.txt
50<https://github.com/python/cpython/blob/master/PCbuild/readme.txt>`_.
Benjamin Peterson1da43e52009-06-26 13:21:52 +000051
Larry Hastingsf92f6c82015-09-12 17:28:39 +010052If you wish, you can create a subdirectory and invoke configure from there.
Victor Stinnerd783b012017-02-11 02:21:38 +010053For example::
Benjamin Peterson1da43e52009-06-26 13:21:52 +000054
55 mkdir debug
56 cd debug
57 ../configure --with-pydebug
58 make
59 make test
60
Zachary Wared50f1882017-02-13 22:01:03 -060061(This will fail if you *also* built at the top-level directory. You should do
62a ``make clean`` at the toplevel first.)
Benjamin Peterson1da43e52009-06-26 13:21:52 +000063
Zachary Wared50f1882017-02-13 22:01:03 -060064To get an optimized build of Python, ``configure --enable-optimizations``
65before you run ``make``. This sets the default make targets up to enable
66Profile Guided Optimization (PGO) and may be used to auto-enable Link Time
67Optimization (LTO) on some platforms. For more details, see the sections
68below.
Brett Cannon7188a3e2015-09-18 15:13:44 -070069
70
71Profile Guided Optimization
72---------------------------
73
Zachary Wared50f1882017-02-13 22:01:03 -060074PGO takes advantage of recent versions of the GCC or Clang compilers. If ran,
75``make profile-opt`` will do several steps.
Brett Cannon7188a3e2015-09-18 15:13:44 -070076
Zachary Wared50f1882017-02-13 22:01:03 -060077First, the entire Python directory is cleaned of temporary files that may have
78resulted in a previous compilation.
Brett Cannon7188a3e2015-09-18 15:13:44 -070079
80Then, an instrumented version of the interpreter is built, using suitable
Zachary Wared50f1882017-02-13 22:01:03 -060081compiler flags for each flavour. Note that this is just an intermediary step
82and the binary resulted after this step is not good for real life workloads, as
83it has profiling instructions embedded inside.
Brett Cannon7188a3e2015-09-18 15:13:44 -070084
Zachary Wared50f1882017-02-13 22:01:03 -060085After this instrumented version of the interpreter is built, the Makefile will
86automatically run a training workload. This is necessary in order to profile
87the interpreter execution. Note also that any output, both stdout and stderr,
88that may appear at this step is suppressed.
Brett Cannon7188a3e2015-09-18 15:13:44 -070089
90Finally, the last step is to rebuild the interpreter, using the information
Zachary Wared50f1882017-02-13 22:01:03 -060091collected in the previous one. The end result will be a Python binary that is
92optimized and suitable for distribution or production installation.
Brett Cannon7188a3e2015-09-18 15:13:44 -070093
Benjamin Peterson1da43e52009-06-26 13:21:52 +000094
Gregory P. Smith ext:(%20%5BGoogle%20Inc.%5D)014d52f2016-09-08 18:33:00 +000095Link Time Optimization
96----------------------
97
Zachary Wared50f1882017-02-13 22:01:03 -060098Enabled via configure's ``--with-lto`` flag. LTO takes advantage of the
99ability of recent compiler toolchains to optimize across the otherwise
100arbitrary ``.o`` file boundary when building final executables or shared
101libraries for additional performance gains.
Gregory P. Smith ext:(%20%5BGoogle%20Inc.%5D)014d52f2016-09-08 18:33:00 +0000102
103
Benjamin Peterson1da43e52009-06-26 13:21:52 +0000104What's New
105----------
106
Zachary Wared50f1882017-02-13 22:01:03 -0600107We have a comprehensive overview of the changes in the `What's New in Python
1083.7 <https://docs.python.org/3.7/whatsnew/3.7.html>`_ document. For a more
109detailed change log, read `Misc/NEWS
110<https://github.com/python/cpython/blob/master/Misc/NEWS>`_, but a full
111accounting of changes can only be gleaned from the `commit history
112<https://github.com/python/cpython/commits/master>`_.
Benjamin Peterson1da43e52009-06-26 13:21:52 +0000113
114If you want to install multiple versions of Python see the section below
115entitled "Installing multiple versions".
Guido van Rossum8d90f9d1997-05-22 20:13:25 +0000116
Guido van Rossumf501b4e1996-10-25 14:32:48 +0000117
Guido van Rossumc07d5fa2000-09-01 22:50:02 +0000118Documentation
119-------------
Guido van Rossum91cb9d21995-04-10 11:47:38 +0000120
Victor Stinnerd783b012017-02-11 02:21:38 +0100121`Documentation for Python 3.7 <https://docs.python.org/3.7/>`_ is online,
122updated daily.
Guido van Rossumc07d5fa2000-09-01 22:50:02 +0000123
Georg Brandl62069d32010-07-31 08:56:11 +0000124It can also be downloaded in many formats for faster access. The documentation
125is downloadable in HTML, PDF, and reStructuredText formats; the latter version
126is primarily for documentation authors, translators, and people with special
127formatting requirements.
Benjamin Peterson2a691a82008-03-31 01:51:45 +0000128
Ezio Melotti802bf8a2013-08-16 21:32:25 +0300129If you would like to contribute to the development of Python, relevant
Zachary Wared50f1882017-02-13 22:01:03 -0600130documentation is available in the `Python Developer's Guide
Victor Stinnerd783b012017-02-11 02:21:38 +0100131<https://docs.python.org/devguide/>`_.
Ezio Melotti802bf8a2013-08-16 21:32:25 +0300132
Zachary Wared50f1882017-02-13 22:01:03 -0600133For information about building Python's documentation, refer to `Doc/README.txt
134<https://github.com/python/cpython/blob/master/Doc/README.txt>`_.
Ezio Melotti802bf8a2013-08-16 21:32:25 +0300135
Guido van Rossumc07d5fa2000-09-01 22:50:02 +0000136
Barry Warsaw97f005d2008-12-03 16:46:14 +0000137Converting From Python 2.x to 3.x
Guido van Rossum1c896e32007-08-29 23:03:30 +0000138---------------------------------
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000139
Zachary Wared50f1882017-02-13 22:01:03 -0600140Significant backward incompatible changes were made for the release of Python
1413.0, which may cause programs written for Python 2 to fail when run with Python
1423. For more information about porting your code from Python 2 to Python 3, see
143the `Porting HOWTO <https://docs.python.org/3/howto/pyporting.html>`_.
Benjamin Peterson1da43e52009-06-26 13:21:52 +0000144
Christian Heimesdd15f6c2008-03-16 00:07:10 +0000145
Benjamin Petersonad3d5c22009-02-26 03:38:59 +0000146Testing
147-------
148
Zachary Wared50f1882017-02-13 22:01:03 -0600149To test the interpreter, type ``make test`` in the top-level directory. The
150test set produces some output. You can generally ignore the messages about
151skipped tests due to optional features which can't be imported. If a message
152is printed about a failed test or a traceback or core dump is produced,
153something is wrong.
Benjamin Petersonad3d5c22009-02-26 03:38:59 +0000154
155By default, tests are prevented from overusing resources like disk space and
Victor Stinnerd783b012017-02-11 02:21:38 +0100156memory. To enable these tests, run ``make testall``.
Benjamin Petersonad3d5c22009-02-26 03:38:59 +0000157
Zachary Wared50f1882017-02-13 22:01:03 -0600158If any tests fail, you can re-run the failing test(s) in verbose mode::
Benjamin Petersonad3d5c22009-02-26 03:38:59 +0000159
Zachary Wared50f1882017-02-13 22:01:03 -0600160 make test TESTOPTS="-v test_that_failed"
Benjamin Petersonad3d5c22009-02-26 03:38:59 +0000161
Zachary Wared50f1882017-02-13 22:01:03 -0600162If the failure persists and appears to be a problem with Python rather than
163your environment, you can `file a bug report <https://bugs.python.org>`_ and
164include relevant output from that command to show the issue.
Benjamin Petersonad3d5c22009-02-26 03:38:59 +0000165
166
Christian Heimesdd15f6c2008-03-16 00:07:10 +0000167Installing multiple versions
168----------------------------
169
170On Unix and Mac systems if you intend to install multiple versions of Python
Zachary Wared50f1882017-02-13 22:01:03 -0600171using the same installation prefix (``--prefix`` argument to the configure
172script) you must take care that your primary python executable is not
173overwritten by the installation of a different version. All files and
174directories installed using ``make altinstall`` contain the major and minor
175version and can thus live side-by-side. ``make install`` also creates
176``${prefix}/bin/python3`` which refers to ``${prefix}/bin/pythonX.Y``. If you
177intend to install multiple versions using the same prefix you must decide which
178version (if any) is your "primary" version. Install that version using ``make
179install``. Install all other versions using ``make altinstall``.
Christian Heimesdd15f6c2008-03-16 00:07:10 +0000180
Ned Deily190042a2016-12-23 04:10:46 -0500181For example, if you want to install Python 2.7, 3.6, and 3.7 with 3.7 being the
Victor Stinnerd783b012017-02-11 02:21:38 +0100182primary version, you would execute ``make install`` in your 3.7 build directory
183and ``make altinstall`` in the others.
Christian Heimesdd15f6c2008-03-16 00:07:10 +0000184
185
Guido van Rossum1c896e32007-08-29 23:03:30 +0000186Issue Tracker and Mailing List
187------------------------------
Michael W. Hudson71dcc3e2005-02-22 15:33:26 +0000188
Zachary Wared50f1882017-02-13 22:01:03 -0600189Bug reports are welcome! You can use the `issue tracker
190<https://bugs.python.org>`_ to report bugs, and/or submit pull requests `on
191GitHub <https://github.com/python/cpython>`_.
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000192
Zachary Wared50f1882017-02-13 22:01:03 -0600193You can also follow development discussion on the `python-dev mailing list
194<https://mail.python.org/mailman/listinfo/python-dev/>`_.
Georg Brandl81299ad2006-02-20 10:24:06 +0000195
Michael W. Hudson71dcc3e2005-02-22 15:33:26 +0000196
Benjamin Peterson1da43e52009-06-26 13:21:52 +0000197Proposals for enhancement
198-------------------------
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000199
Benjamin Peterson1da43e52009-06-26 13:21:52 +0000200If you have a proposal to change Python, you may want to send an email to the
Zachary Wared50f1882017-02-13 22:01:03 -0600201comp.lang.python or `python-ideas`_ mailing lists for initial feedback. A
202Python Enhancement Proposal (PEP) may be submitted if your idea gains ground.
203All current PEPs, as well as guidelines for submitting a new PEP, are listed at
Victor Stinnerd783b012017-02-11 02:21:38 +0100204`python.org/dev/peps/ <https://www.python.org/dev/peps/>`_.
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000205
Ned Batchelder3cdbd682017-02-13 12:05:47 -0500206.. _python-ideas: https://mail.python.org/mailman/listinfo/python-ideas/
Guido van Rossum1c896e32007-08-29 23:03:30 +0000207
Zachary Wared50f1882017-02-13 22:01:03 -0600208
Benjamin Peterson1da43e52009-06-26 13:21:52 +0000209Release Schedule
210----------------
Guido van Rossum1c896e32007-08-29 23:03:30 +0000211
Victor Stinnerd783b012017-02-11 02:21:38 +0100212See :pep:`537` for Python 3.7 release details.
Guido van Rossumef0f1292007-08-30 14:51:05 +0000213
214
215Copyright and License Information
216---------------------------------
217
Georg Brandla7d2f002013-03-23 16:06:13 +0100218Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
Benjamin Petersonf1dcdd92016-01-01 11:53:14 -06002192012, 2013, 2014, 2015, 2016 Python Software Foundation. All rights reserved.
Guido van Rossumef0f1292007-08-30 14:51:05 +0000220
Georg Brandl260a7882011-02-20 10:29:04 +0000221Copyright (c) 2000 BeOpen.com. All rights reserved.
Guido van Rossumef0f1292007-08-30 14:51:05 +0000222
Georg Brandl260a7882011-02-20 10:29:04 +0000223Copyright (c) 1995-2001 Corporation for National Research Initiatives. All
224rights reserved.
Guido van Rossumef0f1292007-08-30 14:51:05 +0000225
Georg Brandl260a7882011-02-20 10:29:04 +0000226Copyright (c) 1991-1995 Stichting Mathematisch Centrum. All rights reserved.
Guido van Rossumef0f1292007-08-30 14:51:05 +0000227
Zachary Wared50f1882017-02-13 22:01:03 -0600228See the file "LICENSE" for information on the history of this software, terms &
229conditions for usage, and a DISCLAIMER OF ALL WARRANTIES.
Guido van Rossumef0f1292007-08-30 14:51:05 +0000230
Larry Hastingsf92f6c82015-09-12 17:28:39 +0100231This Python distribution contains *no* GNU General Public License (GPL) code,
232so it may be used in proprietary projects. There are interfaces to some GNU
233code but these are entirely optional.
Guido van Rossumef0f1292007-08-30 14:51:05 +0000234
Georg Brandl260a7882011-02-20 10:29:04 +0000235All trademarks referenced herein are property of their respective holders.