|
| 1 | +================== |
| 2 | +Contribution guide |
| 3 | +================== |
| 4 | + |
| 5 | +Contributions are highly welcomed and appreciated. Every little help counts, |
| 6 | +so do not hesitate! You can make a high impact on ProPlot just by using it and |
| 7 | +reporting `issues <https://github.com/lukelbd/proplot/issues>`__. |
| 8 | + |
| 9 | +The following sections cover some general guidelines |
| 10 | +regarding development in ProPlot for maintainers and contributors. |
| 11 | +Nothing here is set in stone and can't be changed. |
| 12 | +Feel free to suggest improvements or changes in the workflow. |
| 13 | + |
| 14 | +Feature requests and feedback |
| 15 | +============================= |
| 16 | + |
| 17 | +We are eager to hear about your requests for new features and any suggestions about the |
| 18 | +API, infrastructure, and so on. Feel free to submit these as |
| 19 | +`issues <https://github.com/lukelbd/proplot/issues/new>`__ with the label "feature." |
| 20 | + |
| 21 | +Please make sure to explain in detail how the feature should work and keep the scope as |
| 22 | +narrow as possible. This will make it easier to implement in small PRs. |
| 23 | + |
| 24 | + |
| 25 | +Report bugs |
| 26 | +=========== |
| 27 | + |
| 28 | +Report bugs for ProPlot in the `issue tracker <https://github.com/lukelbd/proplot/issues>`__ |
| 29 | +with the label "bug". |
| 30 | + |
| 31 | +If you are reporting a bug, please include: |
| 32 | + |
| 33 | +* Your operating system name and version. |
| 34 | +* Any details about your local setup that might be helpful in troubleshooting, |
| 35 | + specifically the Python interpreter version, installed libraries, and ProPlot |
| 36 | + version. |
| 37 | +* Detailed steps to reproduce the bug. |
| 38 | + |
| 39 | +If you can write a demonstration test that currently fails but *should* pass, |
| 40 | +that is a very useful commit to make as well, even if you cannot fix the bug itself. |
| 41 | + |
| 42 | + |
| 43 | +Fix bugs |
| 44 | +======== |
| 45 | + |
| 46 | +Look through the `GitHub issues for bugs <https://github.com/lukelbd/proplot/labels/bug>`__. |
| 47 | + |
| 48 | +Talk to developers to find out how you can fix specific bugs. |
| 49 | + |
| 50 | +Write documentation |
| 51 | +=================== |
| 52 | + |
| 53 | +ProPlot could always use better documentation. For small changes, you can edit documentation files directly in the GitHub web interface, |
| 54 | +without using a local copy. |
| 55 | + |
| 56 | +* The documentation is written in reStructuredText with `numpydoc <https://numpydoc.readthedocs.io/en/latest/>`__ style headers. |
| 57 | +* The `default ReST role <https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-default_role>`__ is ``'py:obj'``. This is meant to encourage populating docstrings with links to the API reference. ProPlot uses `intersphinx <http://www.sphinx-doc.org/en/stable/ext/intersphinx.html>`__, so you can also link to sphinx documentation from other projects, e.g. matplotlib. In general, you should compress your links with a tilde, e.g. ``~path.to.function``. |
| 58 | +* When editing the ipython notebooks found in ``docs``, make sure to put your example descriptions inside reStructedText cells, not markdown cells. This lets us populate the descriptions with sphinx links. See `this guide <https://nbsphinx.readthedocs.io/en/0.4.3/raw-cells.html#Usage>`__ for how to convert cells to ReST. |
| 59 | + |
| 60 | +Some helpful ReST guides are located `here <http://docutils.sourceforge.net/docs/user/rst/quickref.html>`__ and `here <https://github.com/ralsina/rst-cheatsheet/blob/master/rst-cheatsheet.rst>`__. |
| 61 | + |
| 62 | +.. note:: |
| 63 | + To build the documentation locally, use the following commands: |
| 64 | + |
| 65 | + .. code:: bash |
| 66 | +
|
| 67 | + cd docs |
| 68 | + pip install requirements.txt |
| 69 | + make html |
| 70 | +
|
| 71 | + The built documentation should be available in the ``docs/_build/html``. |
| 72 | + |
| 73 | +Preparing pull requests |
| 74 | +======================= |
| 75 | + |
| 76 | +#. Fork the |
| 77 | + `proplot GitHub repository <https://github.com/lukelbd/proplot>`__. It's |
| 78 | + fine to use ProPlot as your fork repository name because it will live |
| 79 | + under your user. |
| 80 | + |
| 81 | +#. Clone your fork locally using `git <https://git-scm.com/>`__, connect your repository |
| 82 | + to the upstream (main project), and create a branch: |
| 83 | + |
| 84 | + .. code-block:: bash |
| 85 | +
|
| 86 | + git clone [email protected]:YOUR_GITHUB_USERNAME/proplot.git |
| 87 | + cd proplot |
| 88 | + git remote add upstream [email protected]:lukelbd/proplot.git |
| 89 | + git checkout -b your-bugfix-feature-branch-name master |
| 90 | +
|
| 91 | + If you need some help with git, follow the |
| 92 | + `quick start guide <https://git.wiki.kernel.org/index.php/QuickStart>`__. |
| 93 | + |
| 94 | +#. If you intend to make changes / add examples to the ipython notebooks, |
| 95 | + you need to install and configure |
| 96 | + `nbstripout <https://github.com/kynan/nbstripout>`__ with |
| 97 | + |
| 98 | + .. code-block:: bash |
| 99 | +
|
| 100 | + cd proplot |
| 101 | + pip install nbstripout |
| 102 | + git config --local include.path ../.gitconfig |
| 103 | +
|
| 104 | + This strips notebook cell output when files are staged, which reduces the |
| 105 | + repo storage size and lets us use |
| 106 | + `nbsphinx <https://nbsphinx.readthedocs.io/en/0.4.3/>`__ |
| 107 | + to test each ``git push``, since ``nbsphinx`` must then re-run every cell. |
| 108 | + |
| 109 | + The ``git config`` command associates the filters declared in |
| 110 | + ``proplot/.gitattributes`` with the operations described in ``proplot/.gitconfig`` |
| 111 | + by adding them to the *recognized* local configuration file |
| 112 | + ``proplot/.git/config``. |
| 113 | + |
| 114 | +#. Make an editable install of ProPlot by running: |
| 115 | + |
| 116 | + .. code-block:: bash |
| 117 | +
|
| 118 | + pip install -e . |
| 119 | +
|
| 120 | + This way when you ``import proplot``, your |
| 121 | + local copy is used. Make sure matplotlib is already installed. |
| 122 | + |
| 123 | +#. Break your edits up into reasonably sized commits. |
| 124 | + |
| 125 | + .. code-block:: bash |
| 126 | +
|
| 127 | + git commit -a -m "<commit message>" |
| 128 | + git push -u |
| 129 | +
|
| 130 | + The commit messages should be short, sweet, and use the imperative mood, |
| 131 | + e.g. "Fix bug" instead of "Fixed bug". |
| 132 | + |
| 133 | + .. |
| 134 | + #. Run all the tests. Now running tests is as simple as issuing this command: |
| 135 | + .. code-block:: bash |
| 136 | + coverage run --source proplot -m py.test |
| 137 | + This command will run tests via the ``pytest`` tool against Python 3.7. |
| 138 | +
|
| 139 | +#. Create a new changelog entry in ``CHANGELOG.rst``: |
| 140 | + |
| 141 | + - The entry should be entered as: |
| 142 | + |
| 143 | + .. code-block:: |
| 144 | +
|
| 145 | + <description> (:pr:`<PR number>`) `<author name>`_ |
| 146 | +
|
| 147 | + where ``<description>`` is the description of the PR related to the change, ``<PR number>`` is the pull request number, and ``<author name>`` is your first and last name. |
| 148 | + |
| 149 | + - Add yourself to list of authors at the end of ``CHANGELOG.rst`` file if not there yet, in alphabetical order. |
| 150 | + |
| 151 | +#. Finally, submit a pull request through the GitHub website using this data: |
| 152 | + |
| 153 | + .. code-block:: |
| 154 | +
|
| 155 | + head-fork: YOUR_GITHUB_USERNAME/proplot |
| 156 | + compare: your-branch-name |
| 157 | +
|
| 158 | + base-fork: lukelbd/proplot |
| 159 | + base: master |
| 160 | +
|
| 161 | +Note that you can create the Pull Request while you're working on this. The PR will update |
| 162 | +as you add more commits. ProPlot developers and contributors can then review your code |
| 163 | +and offer suggestions. |
| 164 | + |
| 165 | +Release procedure |
| 166 | +================= |
| 167 | + |
| 168 | +ProPlot will follow semantic versioning, e.g. v1.0.0. A major version causes incompatible |
| 169 | +API changes, a minor version adds functionality, and a patch covers bug fixes. |
| 170 | + |
| 171 | +#. Create a new branch ``release-vX.x.x`` with the version for the release. |
| 172 | + |
| 173 | +#. Update ``CHANGELOG.rst``, and make sure all new changes, features are reflected in the documentation. |
| 174 | + |
| 175 | +#. Open a new pull request for this branch targeting ``master``. |
| 176 | + |
| 177 | +#. After all tests pass and the PR has been approved, merge the PR into ``master``. |
| 178 | + |
| 179 | +#. Pull down the new version of master: |
| 180 | + |
| 181 | + .. code-block:: bash |
| 182 | +
|
| 183 | + git checkout master |
| 184 | + git pull |
| 185 | +
|
| 186 | +#. Tag a release and push to github: |
| 187 | + |
| 188 | + .. code-block:: bash |
| 189 | +
|
| 190 | + git tag -a v1.0.0 -m "Version 1.0.0" |
| 191 | + git push origin master --tags |
| 192 | +
|
| 193 | +#. Build and publish release on PyPI: |
| 194 | + |
| 195 | + .. code-block:: bash |
| 196 | +
|
| 197 | + git clean -xfd # remove files not checked into git |
| 198 | + python setup.py sdist bdist_wheel --universal # build package |
| 199 | + twine upload dist/* # register and push to pypi |
| 200 | +
|
0 commit comments