Python Developer’s Guide

This guide is a comprehensive resource for contributing to Python – for both new and experienced contributors. It is maintained by the same community that maintains Python. We welcome your contributions to Python!

Quick reference

Here are the basic steps needed to get set up and contribute a patch. This is meant as a checklist, once you know the basics. For complete instructions please see the setup guide.

  1. Install and set up Git and other dependencies (see the Git Setup page for detailed information).

  2. Fork the CPython repository to your GitHub account and get the source code using:

    git clone https://github.com/<your_username>/cpython
    cd cpython
    
  3. Build Python:

    ./configure --with-pydebug && make -j
    
    ./configure --with-pydebug && make -j
    
    PCbuild\build.bat -e -d
    

    See also more detailed instructions, how to install and build dependencies, and the platform-specific pages for Unix, macOS, and Windows.

  4. Run the tests:

    ./python -m test -j3
    
    ./python.exe -m test -j3
    

    Note: Most macOS systems use ./python.exe in order to avoid filename conflicts with the Python directory.

    .\python.bat -m test -j3
    
  5. Create a new branch where your work for the issue will go, e.g.:

    git checkout -b fix-issue-12345 main
    

    If an issue does not already exist, please create it. Trivial issues (e.g. typo fixes) do not require any issue to be created.

  6. Once you fixed the issue, run the tests, and the patchcheck:

    make patchcheck
    
    make patchcheck
    
    .\python.bat Tools\patchcheck\patchcheck.py
    

    If everything is ok, commit.

  7. Push the branch on your fork on GitHub and create a pull request. Include the issue number using gh-NNNN in the pull request description. For example:

    gh-12345: Fix some bug in spam module
    
  8. Add a News entry into the Misc/NEWS.d directory as individual file. The news entry can be created by using blurb-it, or the blurb tool and its blurb