| 1 |
Contributing to Pygame Zero |
| 2 |
=========================== |
| 3 |
|
| 4 |
.. highlight:: none |
| 5 |
|
| 6 |
The Pygame Zero project is hosted on GitHub: |
| 7 |
|
| 8 |
https://github.com/lordmauve/pgzero |
| 9 |
|
| 10 |
.. _report-issue: |
| 11 |
|
| 12 |
Reporting an bug or request |
| 13 |
--------------------------- |
| 14 |
|
| 15 |
You can report bugs, or request features that you think should be in Pygame |
| 16 |
Zero, using the `Github issue tracker`_. |
| 17 |
|
| 18 |
Here are some things to bear in mind before you do this: |
| 19 |
|
| 20 |
* It might not just be you! You should check if someone has already reported |
| 21 |
the issue by searching through the existing issues - both open and closed. |
| 22 |
|
| 23 |
* The developers need to know what version of Pygame Zero you are using, and |
| 24 |
what operating system you are running (Windows, Mac, Linux etc) and version |
| 25 |
(Windows 10, Ubuntu 16.04, etc). |
| 26 |
|
| 27 |
|
| 28 |
.. _`Github issue tracker`: https://github.com/lordmauve/pgzero/issues |
| 29 |
|
| 30 |
|
| 31 |
How to do a pull request |
| 32 |
------------------------ |
| 33 |
|
| 34 |
You can make changes to Pygame Zero by creating a pull request. |
| 35 |
|
| 36 |
It's a good idea to :ref:`report an issue <report-issue>` first, so that we can |
| 37 |
discuss whether your change makes sense. |
| 38 |
|
| 39 |
Github has `help on how to create a pull request`__, but here's the quick |
| 40 |
version: |
| 41 |
|
| 42 |
.. __: https://help.github.com/articles/creating-a-pull-request/ |
| 43 |
|
| 44 |
1. Make sure you are logged into Github. |
| 45 |
2. Go to the `Github page for Pygame Zero`_. |
| 46 |
3. Click "Fork" to create your own fork of the repository. |
| 47 |
4. Clone this fork to your own computer:: |
| 48 |
|
| 49 |
git clone [email protected]:yourusername/pgzero.git |
| 50 |
|
| 51 |
Remember to change ``yourusername`` to your Github username. |
| 52 |
|
| 53 |
5. Create a branch in which to do your changes. Pick a branch name that |
| 54 |
describes the change you want to make. :: |
| 55 |
|
| 56 |
git checkout -b my-new-branch master |
| 57 |
|
| 58 |
6. Make the changes you want. |
| 59 |
7. Add the files that you want to commit:: |
| 60 |
|
| 61 |
git add pgzero |
| 62 |
|
| 63 |
8. Commit the files with a clear commit message:: |
| 64 |
|
| 65 |
git commit -m "Fixed issue #42 by renaming parameters" |
| 66 |
|
| 67 |
You can do steps 6 to 8 as many times as you want until you're happy. |
| 68 |
|
| 69 |
9. Push the commit back to your fork. :: |
| 70 |
|
| 71 |
git push --set-upstream origin my-new-branch |
| 72 |
|
| 73 |
10. Go to the Github page for your fork, and click on the "Create pull request" |
| 74 |
button. |
| 75 |
|
| 76 |
|
| 77 |
.. _`Github page for Pygame Zero`: https://github.com/lordmauve/pgzero |
| 78 |
|
| 79 |
|
| 80 |
Development installation |
| 81 |
------------------------ |
| 82 |
|
| 83 |
It's possible to create a locally-editable install using pip. From the root directory of the checked out source, run:: |
| 84 |
|
| 85 |
pip3 install --editable . |
| 86 |
|
| 87 |
The installed version will now reflect any local changes you make. |
| 88 |
|
| 89 |
Alternatively, if you don't want to install it at all, it may be run with: |
| 90 |
|
| 91 |
python3 -m pgzero <name of pgzero script> |
| 92 |
|
| 93 |
For example: |
| 94 |
|
| 95 |
python3 -m pgzero examples/basic/demo1.py |
| 96 |
|
| 97 |
|
| 98 |
How to run tests |
| 99 |
---------------- |
| 100 |
|
| 101 |
The tests can be run with |
| 102 |
|
| 103 |
python3 setup.py test |
| 104 |
|
| 105 |
|
| 106 |
.. _translating: |
| 107 |
|
| 108 |
Helping to translate the documentation |
| 109 |
-------------------------------------- |
| 110 |
|
| 111 |
Pygame Zero's APIs will always be English, but we can bring Pygame Zero to more |
| 112 |
users around the world if the documentation is available in their language. |
| 113 |
|
| 114 |
If you are fluent in another language, please consider contributing by |
| 115 |
translating all or part of the documentation. |
| 116 |
|
| 117 |
The documentation is written in reStructuredText_, which is a text-based markup |
| 118 |
language for technical documentation. As much as possible, the existing |
| 119 |
formatting should be preserved. reStructuredText isn't too difficult once you |
| 120 |
get used to it. |
| 121 |
|
| 122 |
Creating a translation is done by creating a separate repository on Github with |
| 123 |
a copy of the documentation, rewritten (at least in part) into the language you |
| 124 |
would like to support. One advantage of this is that you can work on |
| 125 |
translations at your own pace, without having to submit pull requests back to |
| 126 |
the ``pgzero`` project itself. Please see the `translation guide`_ on Read The |
| 127 |
Docs for details. |
| 128 |
|
| 129 |
If this sounds like something you could tackle, here's how you might go about |
| 130 |
it: |
| 131 |
|
| 132 |
1. First, open an issue on the `pgzero issue tracker`_. You should search for |
| 133 |
an existing issue covering the translation you want to do, before opening a |
| 134 |
new one. This will help ensure that you don't do translation work that has |
| 135 |
already been done by someone else (perhaps you can collaborate instead). |
| 136 |
2. Create a new Github repository under your user, called pgzero-*language*, |
| 137 |
eg. ``pgzero-spanish`` if you're going to translate into Spanish. |
| 138 |
3. Clone the repository to your own computer. |
| 139 |
4. Download the Pygame Zero ``doc/`` directory and commit it in your project. |
| 140 |
You can do this by extracting them from `repository ZIP file`_. You only |
| 141 |
need the ``doc/`` directory from the ZIP file. You can delete the other |
| 142 |
files. |
| 143 |
5. Now, work through the .rst files in the docs directory, translating, using |
| 144 |
your preferred editor. You should commit regularly, and push your commits to |
| 145 |
Github. |
| 146 |
6. Post a link to your repository as a comment in the Github issue you created |
| 147 |
in step 1. You can do this as soon as you have some progress to show; this |
| 148 |
will help people collaborate with you on the translation if they are |
| 149 |
interested. |
| 150 |
7. `Set up the documentation to build on Read The Docs`__. Again, post a |
| 151 |
comment on the Github issue when you have this working. |
| 152 |
8. We can then link up the new, translated documentation with the Pygame Zero |
| 153 |
documentation. |
| 154 |
|
| 155 |
.. _reStructuredText: http://www.sphinx-doc.org/en/master/rest.html |
| 156 |
.. _`translation guide`: https://docs.readthedocs.io/en/latest |
| 157 |
/localization.html#project-with-multiple-translations |
| 158 |
.. _`pgzero issue tracker`: https://github.com/lordmauve/pgzero/issues/new |
| 159 |
.. _`repository ZIP file`: https://github.com/lordmauve/pgzero/archive/master.zip |
| 160 |
|
| 161 |
.. __: https://docs.readthedocs.io/en/latest/getting_started.html#import-your-docs |
| 162 |
|
| 163 |
Note that Pygame Zero will have updates, and the documentation will be changed |
| 164 |
accordingly. Using Git it is possible to see a diff of what changed in the |
| 165 |
English documentation, so that you can make corresponding changes in the |
| 166 |
translated documentation. |