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