Skip to content

Opening a pull request

Dan Lawrence edited this page Feb 13, 2023 · 7 revisions

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.

Pull Request: Step-by-Step

The standard process for opening a pull request is the same across all open source GitHub based projects.

  1. 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:

    image

  2. Checkout/clone your new fork to your local computer. The GitHub interface gives you a lot of options here:

    image

    Personally I use my preferred IDE PyCharm to Clone from this menu:

    image

    where I just paste in the URL of the repository.

  3. 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 PyCharms interface here:

    image

    Found in the bottom right hand corner of PyCharm's main window. Though there are many tools and ways to make branches.

  4. 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.

  5. 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.

  6. Run your changes through the linting programs. That means something like: black test/blit_test.py in the Terminal (PyCharm has one built in) for python code or clang-format src_c/math.c -i for C code. black is easy to install from PyPI but clang-format may require a bit more effort ons ome platforms. I personally grab the latest LLVM release (-win64.exe) from this page.

  7. Commit everything to your local repository with a short sensible 1 line commit message. This message will eventually be visible in the public github repo so you want it to make some sense.

  8. Push your local repository changes to your personal remote fork.

  9. 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!

Clone this wiki locally