-
-
Notifications
You must be signed in to change notification settings - Fork 152
Opening a pull request
So you want to fix a bug, or add an amazing new feature to pygame and you want to know how to get started?
The answer, is with a pull request.
The standard process for opening a pull request is the same across all open source GitHub based projects.
-
Create a fork of the pygame-ce repository on your own github profile. You do this by clicking the 'Fork' button on the top right hand side of the repository:
-
Checkout/clone your new fork to your local computer. The GitHub interface gives you a lot of options here:
Personally I use my preferred IDE PyCharm to Clone from this menu:
Where I just paste in the URL of the repository.
-
Create a new branch from the main branch of your forked, cloned local repository where you will make your changes. Try to give it a sensible name that relates to your changes, this will help reviewers later. I personally make branches with PyCharm's interface here:
Found in the bottom right hand corner of PyCharm's main window. Though there are many tools and ways to make branches.
-
Time to actually make your changes. This is a whole separate topic but we will assume you have successfully fixed a bug or made that amazing new feature.
-
Make sure your code actually compiles and does what it is supposed to do with a bit of testing. Better still write some unit/CI tests for the fix or new feature.
-
Run your changes through the linting and autoformatting programs. That means something like:
ruff format test/blit_test.py
in the terminal/command line for python code, orclang-format src_c/math.c -i
for C code. PyCharm has a terminal built in, but you can also use your normal OS terminal/shell.ruff
is easy to install from PyPI using pip, butclang-format
may require a bit more effort on some platforms to make it actually work. I personally grab the latest LLVM release (-win64.exe) from this page and install the python package from PyPI.
- This step can also be performed automatically before a commit by setting up
pre-commit
and using the hooks provided bypygame-ce
. If changes need to be made to be compliant, then the pre-commit hook will make the changes for you and will abort the commit. Re-add the modified files and try your commit again.
-
Commit everything to your local repository with a short sensible one line commit message. This message will eventually be visible in the public github repo so you want it to make some sense.
-
Push your local repository changes to your personal remote fork.
-
Finally navigate to the main pygame Community Edition repository online and you should see a yellow box asking if you want to make a pull request from your recently pushed remote branch. Do so and you will finally open a pull request that the community can review and hopefully merge into the main repository. If all goes well your code may be in the next release of Pygame Community Edition!