Overview
The CPython development workflow follows standard GitHub practices:- Create an issue (for non-trivial changes)
- Create a feature branch
- Make your changes
- Test your changes
- Commit your changes
- Push and create a pull request
- Address review feedback
- Merge when approved
Before You Start
Ensure you have:- Set up your development environment
- Built CPython successfully
- Familiarized yourself with the Developer Guide
Creating an Issue
For most changes, create an issue first:Check for existing issues
Search github.com/python/cpython/issues to avoid duplicates.
Create a new issue
If none exists, create a new issue describing:
- The problem or feature request
- Expected behavior
- Current behavior (for bugs)
- Python version
- Platform information
Trivial changes like fixing typos don’t require an issue.
Creating a Branch
Create a feature branch for your work:- Use
gh-NNNNNprefix (where NNNNN is the issue number) - Add a descriptive name
- Use hyphens, not underscores
gh-12345-fix-dict-memory-leakgh-67890-add-frozenset-optimization
Making Changes
Edit Code
Make your changes following the code style guide:Build and Test
After making changes, build and test:Add Tests
Always add tests for new features or bug fixes:Update Documentation
Update documentation for new features:Committing Changes
Commit Message Format
Follow the commit message format:Making the Commit
Commit Guidelines
- Make atomic commits (one logical change per commit)
- Write clear, concise commit messages
- Reference the issue number (gh-NNNNN)
- Explain why, not just what
- Sign your commits if required
Pushing and Creating a Pull Request
Pull Request Title Format
[3.13]is the branch namegh-NNNNNis the issue numberGH-MMMMMis the original PR number from main
Code Review Process
Responding to Reviews
CI/CD Checks
Your PR must pass all CI checks:- GitHub Actions: Linux, macOS, Windows builds
- Azure Pipelines: Additional platform coverage
- Tests: All test suites must pass
- Documentation: Doc builds must succeed
Keeping Your Branch Updated
Rebasing on Main
Keep your branch up to date with main:After Your PR is Merged
Backporting Changes
For bug fixes that need to be backported to maintenance branches:- Wait for the PR to be merged to main
- A core developer will typically handle backports
- If asked to backport yourself:
Working with Multiple PRs
If you’re working on multiple issues:Troubleshooting
Merge conflicts
Merge conflicts
When rebasing causes conflicts:
Failed CI checks
Failed CI checks
Common CI failures:
- Test failures: Run tests locally and fix
- Linting errors: Follow code style guide
- Doc build failures: Check .rst syntax
- Platform-specific: May need maintainer help
PR is stale
PR is stale
If your PR has been open for a while:
Need to update PR description
Need to update PR description
Edit the PR description on GitHub to:
- Update status
- Add more context
- Link related issues
Best Practices
- Small PRs: Keep changes focused and reviewable
- Test thoroughly: Don’t rely only on CI
- Be patient: Reviews can take time
- Be responsive: Address feedback promptly
- Be respectful: Follow the Code of Conduct
- Communicate: Ask questions if unclear
Next Steps
- Review code style guidelines
- Learn about documentation
- Join Python Discourse
- Read the full Developer Guide
