1 This is Python version 3.6.1
2 ============================
3
4 .. image:: https://travis-ci.org/python/cpython.svg?branch=3.6
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/3.6/graph/badge.svg
9 :alt: CPython code coverage on Codecov
10 :target: https://codecov.io/gh/python/cpython
11
12 Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
13 2012, 2013, 2014, 2015, 2016, 2017 Python Software Foundation. All rights
14 reserved.
15
16 See the end of this file for further copyright and license information.
17
18 General Information
19 -------------------
20
21 - Website: https://www.python.org
22 - Source code: https://github.com/python/cpython
23 - Issue tracker: https://bugs.python.org
24 - Documentation: https://docs.python.org
25 - Developer's Guide: https://docs.python.org/devguide/
26
27 Contributing to CPython
28 -----------------------
29
30 For more complete instructions on contributing to CPython development,
31 see the `Developer Guide`_.
32
33 .. _Developer Guide: https://docs.python.org/devguide/
34
35 Using Python
36 ------------
37
38 Installable Python kits, and information about using Python, are available at
39 `python.org`_.
40
41 .. _python.org: https://www.python.org/
42
43
44 Build Instructions
45 ------------------
46
47 On Unix, Linux, BSD, macOS, and Cygwin::
48
49 ./configure
50 make
51 make test
52 sudo make install
53
54 This will install Python as python3.
55
56 You can pass many options to the configure script; run ``./configure --help``
57 to find out more. On macOS and Cygwin, the executable is called ``python.exe``;
58 elsewhere it's just ``python``.
59
60 On macOS, if you have configured Python with ``--enable-framework``, you
61 should use ``make frameworkinstall`` to do the installation. Note that this
62 installs the Python executable in a place that is not normally on your PATH,
63 you may want to set up a symlink in ``/usr/local/bin``.
64
65 On Windows, see `PCbuild/readme.txt
66 <https://github.com/python/cpython/blob/3.6/PCbuild/readme.txt>`_.
67
68 If you wish, you can create a subdirectory and invoke configure from there.
69 For example::
70
71 mkdir debug
72 cd debug
73 ../configure --with-pydebug
74 make
75 make test
76
77 (This will fail if you *also* built at the top-level directory. You should do
78 a ``make clean`` at the toplevel first.)
79
80 To get an optimized build of Python, ``configure --enable-optimizations``
81 before you run ``make``. This sets the default make targets up to enable
82 Profile Guided Optimization (PGO) and may be used to auto-enable Link Time
83 Optimization (LTO) on some platforms. For more details, see the sections
84 below.
85
86
87 Profile Guided Optimization
88 ---------------------------
89
90 PGO takes advantage of recent versions of the GCC or Clang compilers. If ran,
91 ``make profile-opt`` will do several steps.
92
93 First, the entire Python directory is cleaned of temporary files that may have
94 resulted in a previous compilation.
95
96 Then, an instrumented version of the interpreter is built, using suitable
97 compiler flags for each flavour. Note that this is just an intermediary step
98 and the binary resulted after this step is not good for real life workloads, as
99 it has profiling instructions embedded inside.
100
101 After this instrumented version of the interpreter is built, the Makefile will
102 automatically run a training workload. This is necessary in order to profile
103 the interpreter execution. Note also that any output, both stdout and stderr,
104 that may appear at this step is suppressed.
105
106 Finally, the last step is to rebuild the interpreter, using the information
107 collected in the previous one. The end result will be a Python binary that is
108 optimized and suitable for distribution or production installation.
109
110
111 Link Time Optimization
112 ----------------------
113
114 Enabled via configure's ``--with-lto`` flag. LTO takes advantage of the
115 ability of recent compiler toolchains to optimize across the otherwise
116 arbitrary ``.o`` file boundary when building final executables or shared
117 libraries for additional performance gains.
118
119
120 What's New
121 ----------
122
123 We have a comprehensive overview of the changes in the `What's New in Python
124 3.6 <https://docs.python.org/3.6/whatsnew/3.6.html>`_ document. For a more
125 detailed change log, read `Misc/NEWS
126 <https://github.com/python/cpython/blob/3.6/Misc/NEWS>`_, but a full
127 accounting of changes can only be gleaned from the `commit history
128 <https://github.com/python/cpython/commits/3.6>`_.
129
130 If you want to install multiple versions of Python see the section below
131 entitled "Installing multiple versions".
132
133
134 Documentation
135 -------------
136
137 `Documentation for Python 3.6 <https://docs.python.org/3.6/>`_ is online,
138 updated daily.
139
140 It can also be downloaded in many formats for faster access. The documentation
141 is downloadable in HTML, PDF, and reStructuredText formats; the latter version
142 is primarily for documentation authors, translators, and people with special
143 formatting requirements.
144
145 For information about building Python's documentation, refer to `Doc/README.rst
146 <https://github.com/python/cpython/blob/3.6/Doc/README.rst>`_.
147
148
149 Converting From Python 2.x to 3.x
150 ---------------------------------
151
152 Significant backward incompatible changes were made for the release of Python
153 3.0, which may cause programs written for Python 2 to fail when run with Python
154 3. For more information about porting your code from Python 2 to Python 3, see
155 the `Porting HOWTO <https://docs.python.org/3/howto/pyporting.html>`_.
156
157
158 Testing
159 -------
160
161 To test the interpreter, type ``make test`` in the top-level directory. The
162 test set produces some output. You can generally ignore the messages about
163 skipped tests due to optional features which can't be imported. If a message
164 is printed about a failed test or a traceback or core dump is produced,
165 something is wrong.
166
167 By default, tests are prevented from overusing resources like disk space and
168 memory. To enable these tests, run ``make testall``.
169
170 If any tests fail, you can re-run the failing test(s) in verbose mode::
171
172 make test TESTOPTS="-v test_that_failed"
173
174 If the failure persists and appears to be a problem with Python rather than
175 your environment, you can `file a bug report <https://bugs.python.org>`_ and
176 include relevant output from that command to show the issue.
177
178
179 Installing multiple versions
180 ----------------------------
181
182 On Unix and Mac systems if you intend to install multiple versions of Python
183 using the same installation prefix (``--prefix`` argument to the configure
184 script) you must take care that your primary python executable is not
185 overwritten by the installation of a different version. All files and
186 directories installed using ``make altinstall`` contain the major and minor
187 version and can thus live side-by-side. ``make install`` also creates
188 ``${prefix}/bin/python3`` which refers to ``${prefix}/bin/pythonX.Y``. If you
189 intend to install multiple versions using the same prefix you must decide which
190 version (if any) is your "primary" version. Install that version using ``make
191 install``. Install all other versions using ``make altinstall``.
192
193 For example, if you want to install Python 2.7, 3.5, and 3.6 with 3.6 being the
194 primary version, you would execute ``make install`` in your 3.6 build directory
195 and ``make altinstall`` in the others.
196
197
198 Issue Tracker and Mailing List
199 ------------------------------
200
201 Bug reports are welcome! You can use the `issue tracker
202 <https://bugs.python.org>`_ to report bugs, and/or submit pull requests `on
203 GitHub <https://github.com/python/cpython>`_.
204
205 You can also follow development discussion on the `python-dev mailing list
206 <https://mail.python.org/mailman/listinfo/python-dev/>`_.
207
208
209 Proposals for enhancement
210 -------------------------
211
212 If you have a proposal to change Python, you may want to send an email to the
213 comp.lang.python or `python-ideas`_ mailing lists for initial feedback. A
214 Python Enhancement Proposal (PEP) may be submitted if your idea gains ground.
215 All current PEPs, as well as guidelines for submitting a new PEP, are listed at
216 `python.org/dev/peps/ <https://www.python.org/dev/peps/>`_.
217
218 .. _python-ideas: https://mail.python.org/mailman/listinfo/python-ideas/
219
220
221 Release Schedule
222 ----------------
223
224 See :pep:`494` for Python 3.6 release details.
225
226
227 Copyright and License Information
228 ---------------------------------
229
230 Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
231 2012, 2013, 2014, 2015, 2016 Python Software Foundation. All rights reserved.
232
233 Copyright (c) 2000 BeOpen.com. All rights reserved.
234
235 Copyright (c) 1995-2001 Corporation for National Research Initiatives. All
236 rights reserved.
237
238 Copyright (c) 1991-1995 Stichting Mathematisch Centrum. All rights reserved.
239
240 See the file "LICENSE" for information on the history of this software, terms &
241 conditions for usage, and a DISCLAIMER OF ALL WARRANTIES.
242
243 This Python distribution contains *no* GNU General Public License (GPL) code,
244 so it may be used in proprietary projects. There are interfaces to some GNU
245 code but these are entirely optional.
246
247 All trademarks referenced herein are property of their respective holders.
248