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:1
Check for existing issues
Search github.com/python/cpython/issues to avoid duplicates.
2
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
3
Discuss the approach
For significant changes, discuss the implementation approach before writing code.
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
1
Push your branch
2
Create pull request
Visit GitHub and click “Create pull request” or use the GitHub CLI:
3
Fill out PR template
Your PR description should include:
- Summary of changes
- Link to the issue (“Fixes #12345”)
- Testing done
- Any breaking changes
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
1
Read feedback carefully
Review all comments from maintainers and other contributors.
2
Make requested changes
3
Reply to comments
Respond to review comments, especially if you disagree or need clarification.
4
Request re-review
After addressing feedback, request a re-review from the reviewer.
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
1
Update your local repository
2
Delete your feature branch
3
Close related issues
If not automatically closed, manually close the issue with a comment linking to the merged PR.
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
