1 This is Python version 3.9.0 alpha 0
2 ====================================
4 .. 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
8 .. image:: https://dev.azure.com/python/cpython/_apis/build/status/Azure%20Pipelines%20CI?branchName=master
9 :alt: CPython build status on Azure DevOps
10 :target: https://dev.azure.com/python/cpython/_build/latest?definitionId=4&branchName=master
12 .. image:: https://codecov.io/gh/python/cpython/branch/master/graph/badge.svg
13 :alt: CPython code coverage on Codecov
14 :target: https://codecov.io/gh/python/cpython
16 .. image:: https://img.shields.io/badge/zulip-join_chat-brightgreen.svg
17 :alt: Python Zulip chat
18 :target: https://python.zulipchat.com
21 Copyright (c) 2001-2019 Python Software Foundation. All rights reserved.
23 See the end of this file for further copyright and license information.
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
34 - Developer's Guide: https://devguide.python.org/
36 Contributing to CPython
37 -----------------------
39 For more complete instructions on contributing to CPython development,
40 see the `Developer Guide`_.
42 .. _Developer Guide: https://devguide.python.org/
47 Installable Python kits, and information about using Python, are available at
50 .. _python.org: https://www.python.org/
55 On Unix, Linux, BSD, macOS, and Cygwin::
62 This will install Python as ``python3``.
64 You can pass many options to the configure script; run ``./configure --help``
65 to find out more. On macOS and Cygwin, the executable is called ``python.exe``;
66 elsewhere it's just ``python``.
68 If you are running on macOS with the latest updates installed, make sure to install
69 OpenSSL or some other SSL software along with Homebrew or another package manager.
70 If issues persist, see https://devguide.python.org/setup/#macos-and-os-x for more
73 On macOS, if you have configured Python with ``--enable-framework``, you
74 should use ``make frameworkinstall`` to do the installation. Note that this
75 installs the Python executable in a place that is not normally on your PATH,
76 you may want to set up a symlink in ``/usr/local/bin``.
78 On Windows, see `PCbuild/readme.txt
79 <https://github.com/python/cpython/blob/master/PCbuild/readme.txt>`_.
81 If you wish, you can create a subdirectory and invoke configure from there.
86 ../configure --with-pydebug
90 (This will fail if you *also* built at the top-level directory. You should do
91 a ``make clean`` at the top-level first.)
93 To get an optimized build of Python, ``configure --enable-optimizations``
94 before you run ``make``. This sets the default make targets up to enable
95 Profile Guided Optimization (PGO) and may be used to auto-enable Link Time
96 Optimization (LTO) on some platforms. For more details, see the sections
100 Profile Guided Optimization
101 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
103 PGO takes advantage of recent versions of the GCC or Clang compilers. If used,
104 either via ``configure --enable-optimizations`` or by manually running
105 ``make profile-opt`` regardless of configure flags, the optimized build
106 process will perform the following steps:
108 The entire Python directory is cleaned of temporary files that may have
109 resulted from a previous compilation.
111 An instrumented version of the interpreter is built, using suitable compiler
112 flags for each flavour. Note that this is just an intermediary step. The
113 binary resulting from this step is not good for real life workloads as it has
114 profiling instructions embedded inside.
116 After the instrumented interpreter is built, the Makefile will run a training
117 workload. This is necessary in order to profile the interpreter execution.
118 Note also that any output, both stdout and stderr, that may appear at this step
121 The final step is to build the actual interpreter, using the information
122 collected from the instrumented one. The end result will be a Python binary
123 that is optimized; suitable for distribution or production installation.
126 Link Time Optimization
127 ^^^^^^^^^^^^^^^^^^^^^^
129 Enabled via configure's ``--with-lto`` flag. LTO takes advantage of the
130 ability of recent compiler toolchains to optimize across the otherwise
131 arbitrary ``.o`` file boundary when building final executables or shared
132 libraries for additional performance gains.
138 We have a comprehensive overview of the changes in the `What's New in Python
139 3.9 <https://docs.python.org/3.9/whatsnew/3.9.html>`_ document. For a more
140 detailed change log, read `Misc/NEWS
141 <https://github.com/python/cpython/blob/master/Misc/NEWS.d>`_, but a full
142 accounting of changes can only be gleaned from the `commit history
143 <https://github.com/python/cpython/commits/master>`_.
145 If you want to install multiple versions of Python, see the section below
146 entitled "Installing multiple versions".
152 `Documentation for Python 3.9 <https://docs.python.org/3.9/>`_ is online,
155 It can also be downloaded in many formats for faster access. The documentation
156 is downloadable in HTML, PDF, and reStructuredText formats; the latter version
157 is primarily for documentation authors, translators, and people with special
158 formatting requirements.
160 For information about building Python's documentation, refer to `Doc/README.rst
161 <https://github.com/python/cpython/blob/master/Doc/README.rst>`_.
164 Converting From Python 2.x to 3.x
165 ---------------------------------
167 Significant backward incompatible changes were made for the release of Python
168 3.0, which may cause programs written for Python 2 to fail when run with Python
169 3. For more information about porting your code from Python 2 to Python 3, see
170 the `Porting HOWTO <https://docs.python.org/3/howto/pyporting.html>`_.
176 To test the interpreter, type ``make test`` in the top-level directory. The
177 test set produces some output. You can generally ignore the messages about
178 skipped tests due to optional features which can't be imported. If a message
179 is printed about a failed test or a traceback or core dump is produced,
182 By default, tests are prevented from overusing resources like disk space and
183 memory. To enable these tests, run ``make testall``.
185 If any tests fail, you can re-run the failing test(s) in verbose mode. For
186 example, if ``test_os`` and ``test_gdb`` failed, you can run::
188 make test TESTOPTS="-v test_os test_gdb"
190 If the failure persists and appears to be a problem with Python rather than
191 your environment, you can `file a bug report <https://bugs.python.org>`_ and
192 include relevant output from that command to show the issue.
194 See `Running & Writing Tests <https://devguide.python.org/runtests/>`_
195 for more on running tests.
197 Installing multiple versions
198 ----------------------------
200 On Unix and Mac systems if you intend to install multiple versions of Python
201 using the same installation prefix (``--prefix`` argument to the configure
202 script) you must take care that your primary python executable is not
203 overwritten by the installation of a different version. All files and
204 directories installed using ``make altinstall`` contain the major and minor
205 version and can thus live side-by-side. ``make install`` also creates
206 ``${prefix}/bin/python3`` which refers to ``${prefix}/bin/pythonX.Y``. If you
207 intend to install multiple versions using the same prefix you must decide which
208 version (if any) is your "primary" version. Install that version using ``make
209 install``. Install all other versions using ``make altinstall``.
211 For example, if you want to install Python 2.7, 3.6, and 3.9 with 3.9 being the
212 primary version, you would execute ``make install`` in your 3.9 build directory
213 and ``make altinstall`` in the others.
216 Issue Tracker and Mailing List
217 ------------------------------
219 Bug reports are welcome! You can use the `issue tracker
220 <https://bugs.python.org>`_ to report bugs, and/or submit pull requests `on
221 GitHub <https://github.com/python/cpython>`_.
223 You can also follow development discussion on the `python-dev mailing list
224 <https://mail.python.org/mailman/listinfo/python-dev/>`_.
227 Proposals for enhancement
228 -------------------------
230 If you have a proposal to change Python, you may want to send an email to the
231 comp.lang.python or `python-ideas`_ mailing lists for initial feedback. A
232 Python Enhancement Proposal (PEP) may be submitted if your idea gains ground.
233 All current PEPs, as well as guidelines for submitting a new PEP, are listed at
234 `python.org/dev/peps/ <https://www.python.org/dev/peps/>`_.
236 .. _python-ideas: https://mail.python.org/mailman/listinfo/python-ideas/
242 See :pep:`596` for Python 3.9 release details.
245 Copyright and License Information
246 ---------------------------------
248 Copyright (c) 2001-2019 Python Software Foundation. All rights reserved.
250 Copyright (c) 2000 BeOpen.com. All rights reserved.
252 Copyright (c) 1995-2001 Corporation for National Research Initiatives. All
255 Copyright (c) 1991-1995 Stichting Mathematisch Centrum. All rights reserved.
257 See the file "LICENSE" for information on the history of this software, terms &
258 conditions for usage, and a DISCLAIMER OF ALL WARRANTIES.
260 This Python distribution contains *no* GNU General Public License (GPL) code,
261 so it may be used in proprietary projects. There are interfaces to some GNU
262 code but these are entirely optional.
264 All trademarks referenced herein are property of their respective holders.