|
1 | | -.. _contrib: |
2 | | - |
3 | | -================== |
4 | | -How to contribute? |
5 | | -================== |
6 | | - |
7 | | -Contributions of any size are greatly appreciated! You can |
8 | | -make a significant impact on UltraPlot by just using it and |
9 | | -reporting `issues <https://github.com/ultraplot/ultraplot/issues>`__. |
10 | | - |
11 | | -The following sections cover some general guidelines |
12 | | -regarding UltraPlot development for new contributors. Feel |
13 | | -free to suggest improvements or changes to this workflow. |
14 | | - |
15 | | -.. _contrib_features: |
16 | | - |
17 | | -Feature requests |
18 | | -================ |
19 | | - |
20 | | -We are eager to hear your requests for new features and |
21 | | -suggestions regarding the current API. You can submit these as |
22 | | -`issues <https://github.com/ultraplot/ultraplot/issues/new>`__ on Github. |
23 | | -Please make sure to explain in detail how the feature should work and keep the scope as |
24 | | -narrow as possible. This will make it easier to implement in small pull requests. |
25 | | - |
26 | | -If you are feeling inspired, feel free to add the feature yourself and |
27 | | -submit a pull request! |
28 | | - |
29 | | -.. _contrib_bugs: |
30 | | - |
31 | | -Report bugs |
32 | | -=========== |
33 | | - |
34 | | -Bugs should be reported using the Github |
35 | | -`issues <https://github.com/ultraplot/ultraplot/issues>`__ page. When reporting a |
36 | | -bug, please follow the template message and include copy-pasteable code that |
37 | | -reproduces the issue. This is critical for contributors to fix the bug quickly. |
38 | | - |
39 | | -If you can figure out how to fix the bug yourself, feel free to submit |
40 | | -a pull request. |
41 | | - |
42 | | -.. _contrib_tets: |
43 | | - |
44 | | -Write tests |
45 | | -=========== |
46 | | - |
47 | | -Most modern python packages have ``test_*.py`` scripts that are run by `pytest` |
48 | | -via continuous integration services like `Travis <https://travis-ci.com>`__ |
49 | | -whenever commits are pushed to the repository. Currently, UltraPlot's continuous |
50 | | -integration includes only the examples that appear on the website User Guide (see |
51 | | -`.travis.yml`), and `Casper van Elteren <https://github.com/cvanelteren>` runs additional tests |
52 | | -manually. This approach leaves out many use cases and leaves the project more |
53 | | -vulnerable to bugs. Improving ultraplot's continuous integration using `pytest` |
54 | | -and `pytest-mpl` is a *critical* item on our to-do list. |
55 | | - |
56 | | -If you can think of a useful test for ultraplot, feel free to submit a pull request. |
57 | | -Your test will be used in the future. |
58 | | - |
59 | | -.. _contrib_docs: |
60 | | - |
61 | | -Write documentation |
62 | | -=================== |
63 | | - |
64 | | -Documentation can always be improved. For minor changes, you can edit docstrings and |
65 | | -documentation files directly in the GitHub web interface without using a local copy. |
66 | | - |
67 | | -* The docstrings are written in |
68 | | - `reStructuredText <http://docutils.sourceforge.net/docs/user/rst/quickref.html>`__ |
69 | | - with `numpydoc <https://numpydoc.readthedocs.io/en/latest/>`__ style headers. |
70 | | - They are embedded in the :ref:`API reference` section using a |
71 | | - `fork of sphinx-automodapi <https://github.com/lukelbd/sphinx-automodapi>`__. |
72 | | -* Other sections are written using ``.rst`` files and ``.py`` files in the ``docs`` |
73 | | - folder. The ``.py`` files are translated to python notebooks via |
74 | | - `jupytext <https://jupytext.readthedocs.io/en/latest/>`__ then embedded in |
75 | | - the User Guide using `nbsphinx <https://nbsphinx.readthedocs.io/en/0.5.0/>`__. |
76 | | -* The `default ReST role <https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-default_role>`__ |
77 | | - is ``py:obj``. Please include ``py:obj`` links whenever discussing particular |
78 | | - functions or classes -- for example, if you are discussing the |
79 | | - :func:`~ultraplot.axes.Axes.format` method, please write |
80 | | - ```:func:`~ultraplot.axes.Axes.format` ``` rather than ``format``. ultraplot also uses |
81 | | - `intersphinx <http://www.sphinx-doc.org/en/stable/ext/intersphinx.html>`__ |
82 | | - so you can link to external packages like matplotlib and cartopy. |
83 | | - |
84 | | -To build the documentation locally, use the following commands: |
85 | | - |
86 | | -.. code:: bash |
87 | | -
|
88 | | - cd docs |
89 | | - # Install dependencies to the base conda environment.. |
90 | | - conda env update -f environment.yml |
91 | | - # ...or create a new conda environment |
92 | | - # conda env create -n ultraplot-dev --file docs/environment.yml |
93 | | - # source activate ultraplot-dev |
94 | | - # Create HTML documentation |
95 | | - make html |
96 | | -
|
97 | | -The built documentation should be available in ``docs/_build/html``. |
98 | | - |
99 | | -.. _contrib_pr: |
100 | | - |
101 | | -Preparing pull requests |
102 | | -======================= |
103 | | - |
104 | | -New features and bug fixes should be addressed using pull requests. |
105 | | -Here is a quick guide for submitting pull requests: |
106 | | - |
107 | | -#. Fork the |
108 | | - `ultraplot GitHub repository <https://github.com/ultraplot/ultraplot>`__. It's |
109 | | - fine to keep "ultraplot" as the fork repository name because it will live |
110 | | - under your account. |
111 | | - |
112 | | -#. Clone your fork locally using `git <https://git-scm.com/>`__, connect your |
113 | | - repository to the upstream (main project), and create a branch as follows: |
114 | | - |
115 | | - .. code-block:: bash |
116 | | -
|
117 | | - git clone git@github.com:YOUR_GITHUB_USERNAME/ultraplot.git |
118 | | - cd ultraplot |
119 | | - git remote add upstream git@github.com:ultraplot/ultraplot.git |
120 | | - git checkout -b your-branch-name master |
121 | | -
|
122 | | - If you need some help with git, follow the |
123 | | - `quick start guide <https://git.wiki.kernel.org/index.php/QuickStart>`__. |
124 | | - |
125 | | -#. Make an editable install of ultraplot by running: |
126 | | - |
127 | | - .. code-block:: bash |
128 | | -
|
129 | | - pip install -e . |
130 | | -
|
131 | | - This way ``import ultraplot`` imports your local copy, |
132 | | - rather than the stable version you last downloaded from PyPi. |
133 | | - You can ``import ultraplot; print(ultraplot.__file__)`` to verify your |
134 | | - local copy has been imported. |
135 | | - |
136 | | -#. Install `pre-commit <https://pre-commit.com>`__ and its hook on the |
137 | | - ``ultraplot`` repo as follows: |
138 | | - |
139 | | - .. code-block:: bash |
140 | | -
|
141 | | - pip install --user pre-commit |
142 | | - pre-commit install |
143 | | -
|
144 | | - Afterwards ``pre-commit`` will run whenever you commit. |
145 | | - `pre-commit <https://pre-commit.com/>`__ is a framework for managing and |
146 | | - maintaining multi-language pre-commit hooks to |
147 | | - ensure code-style and code formatting is consistent. |
148 | | - |
149 | | -#. You can now edit your local working copy as necessary. Please follow |
150 | | - the `PEP8 style guide <https://www.python.org/dev/peps/pep-0008/>`__. |
151 | | - and try to generally adhere to the |
152 | | - `black <https://black.readthedocs.io/en/stable/>`__ subset of the PEP8 style |
153 | | - (we may automatically enforce the "black" style in the future). |
154 | | - When committing, ``pre-commit`` will modify the files as needed, |
155 | | - or will generally be clear about what you need to do to pass the pre-commit test. |
156 | | - |
157 | | - Please break your edits up into reasonably sized commits: |
158 | | - |
159 | | - |
160 | | - .. code-block:: bash |
161 | | -
|
162 | | - git commit -a -m "<commit message>" |
163 | | - git push -u |
164 | | -
|
165 | | - The commit messages should be short, sweet, and use the imperative mood, |
166 | | - e.g. "Fix bug" instead of "Fixed bug". |
167 | | - |
168 | | - .. |
169 | | - #. Run all the tests. Now running tests is as simple as issuing this command: |
170 | | - .. code-block:: bash |
171 | | - coverage run --source ultraplot -m py.test |
172 | | - This command will run tests via the ``pytest`` tool against Python 3.7. |
173 | | -
|
174 | | -#. If you intend to make changes or add examples to the user guide, you may want to |
175 | | - open the ``docs/*.py`` files as |
176 | | - `jupyter notebooks <https://jupyter-notebook.readthedocs.io/en/stable/>`__. |
177 | | - This can be done by |
178 | | - `installing jupytext <https://jupytext.readthedocs.io/en/latest/install.html>`__, |
179 | | - starting a jupyter session, and opening the ``.py`` files from the ``Files`` page. |
180 | | - |
181 | | -#. When you're finished, create a new changelog entry in ``CHANGELOG.rst``. |
182 | | - The entry should be entered as: |
183 | | - |
184 | | - .. code-block:: |
185 | | -
|
186 | | - * <description> (:pr:`<PR number>`) by `<author name>`_. |
187 | | -
|
188 | | - where ``<description>`` is the description of the PR related to the change, |
189 | | - ``<PR number>`` is the pull request number, and ``<author name>`` is your first |
190 | | - and last name. Make sure to add yourself to the list of authors at the end of |
191 | | - ``CHANGELOG.rst`` and the list of contributors in ``docs/authors.rst``. |
192 | | - Also make sure to add the changelog entry under one of the valid |
193 | | - ``.. rubric:: <heading>`` headings listed at the top of ``CHANGELOG.rst``. |
194 | | - |
195 | | -#. Finally, submit a pull request through the GitHub website using this data: |
196 | | - |
197 | | - .. code-block:: |
198 | | -
|
199 | | - head-fork: YOUR_GITHUB_USERNAME/ultraplot |
200 | | - compare: your-branch-name |
201 | | -
|
202 | | - base-fork: ultraplot/ultraplot |
203 | | - base: master |
204 | | -
|
205 | | -Note that you can create the pull request before you're finished with your |
206 | | -feature addition or bug fix. The PR will update as you add more commits. UltraPlot |
207 | | -developers and contributors can then review your code and offer suggestions. |
208 | | - |
209 | | -.. _contrib_release: |
210 | | - |
211 | | -Release procedure |
212 | | -================= |
213 | | -Ultraplot follows EffVer (`Effectual Versioning <https://jacobtomlinson.dev/effver/>`_). Changes to the version number ``X.Y.Z`` will reflect the effect on users: the major version ``X`` will be incremented for changes that require user attention (like breaking changes), the minor version ``Y`` will be incremented for safe feature additions, and the patch number ``Z`` will be incremented for changes users can safely ignore. |
214 | | - |
215 | | -While version 1.0 has been released, we are still in the process of ensuring proplot is fully replaced by ultraplot as we continue development under the ultraplot name. During this transition, the versioning scheme reflects both our commitment to stable APIs and the ongoing work to complete this transition. The minor version number is incremented when changes require user attention (like deprecations or style changes), and the patch number is incremented for additions and fixes that users can safely adopt. |
216 | | - |
217 | | -For now, `Casper van Eltern <https://github.com/cvanelteren>`__ is the only one who can |
218 | | -publish releases on PyPi, but this will change in the future. Releases should |
219 | | -be carried out as follows: |
220 | | - |
221 | | -#. Create a new branch ``release-vX.Y.Z`` with the version for the release. |
222 | | - |
223 | | -#. Make sure to update ``CHANGELOG.rst`` and that all new changes are reflected |
224 | | - in the documentation: |
225 | | - |
226 | | - .. code-block:: bash |
227 | | -
|
228 | | - git add CHANGELOG.rst |
229 | | - git commit -m 'Update changelog' |
230 | | -
|
231 | | -#. Open a new pull request for this branch targeting ``master``. |
232 | | - |
233 | | -#. After all tests pass and the pull request has been approved, merge into |
234 | | - ``master``. |
235 | | - |
236 | | -#. Get the latest version of the master branch: |
237 | | - |
238 | | - .. code-block:: bash |
239 | | -
|
240 | | - git checkout master |
241 | | - git pull |
242 | | -
|
243 | | -#. Tag the current commit and push to github: |
244 | | - |
245 | | - .. code-block:: bash |
246 | | -
|
247 | | - git tag -a vX.Y.Z -m "Version X.Y.Z" |
248 | | - git push origin master --tags |
249 | | -
|
250 | | -#. Build and publish release on PyPI: |
251 | | - |
252 | | - .. code-block:: bash |
253 | | -
|
254 | | - # Remove previous build products and build the package |
255 | | - rm -r dist build *.egg-info |
256 | | - python setup.py sdist bdist_wheel |
257 | | - # Check the source and upload to the test repository |
258 | | - twine check dist/* |
259 | | - twine upload --repository-url https://test.pypi.org/legacy/ dist/* |
260 | | - # Go to https://test.pypi.org/project/ultraplot/ and make sure everything looks ok |
261 | | - # Then make sure the package is installable |
262 | | - pip install --index-url https://test.pypi.org/simple/ ultraplot |
263 | | - # Register and push to pypi |
264 | | - twine upload dist/* |
| 1 | +.. include:: docs/contributing.rst |
0 commit comments