|
| 1 | +# Contributing |
| 2 | + |
| 3 | +Thanks for thinking of a way to help improve this library! Remember that contributions come in all shapes and sizes beyond writing bug fixes. Contributing to [documentation](#documentation), opening new [issues](https://github.com/ianhi/mpl-playback/issues) for bugs, asking for clarification on things you find unclear, and requesting new features, are all super valuable contributions. |
| 4 | + |
| 5 | +## Code Improvements |
| 6 | + |
| 7 | +All development for this library happens on GitHub at [mpl-playback](https://github.com/ianhi/mpl-playback). We recommend you work with a [Conda](https://www.anaconda.com/products/individual) environment (or an alternative virtual environment like [`venv`](https://docs.python.org/3/library/venv.html)). |
| 8 | + |
| 9 | +```bash |
| 10 | +git clone <your fork> |
| 11 | +cd mpl-playback |
| 12 | +mamba env create -n mpl-playback python matplotlib -c conda-forge |
| 13 | +conda activate mpl-playback |
| 14 | +pip install pre-commit |
| 15 | +pre-commit install |
| 16 | +``` |
| 17 | + |
| 18 | +The `mamba env create` command installs all Python packages that are useful when working on the source code of `mpl_playback` and its documentation. You can also install these packages separately: |
| 19 | + |
| 20 | +```bash |
| 21 | +pip install -e .[doc] |
| 22 | +``` |
| 23 | + |
| 24 | +The {command}`-e .` flag installs the `mpl_playback` folder in ["editable" mode](https://pip.pypa.io/en/stable/cli/pip_install/#editable-installs) and {command}`[dev]` installs the [optional dependencies](https://setuptools.readthedocs.io/en/latest/userguide/dependency_management.html#optional-dependencies) you need for developing `mpl_playback`. |
| 25 | + |
| 26 | +### Seeing your changes |
| 27 | + |
| 28 | +If you are working in a Jupyter Notebook, then in order to see your code changes you will need to either: |
| 29 | + |
| 30 | +- Restart the Kernel every time you make a change to the code. |
| 31 | +- Make the function reload from the source file every time you run it by using [autoreload](https://ipython.readthedocs.io/en/stable/config/extensions/autoreload.html), e.g.: |
| 32 | + |
| 33 | + ```python |
| 34 | + %load_ext autoreload |
| 35 | + %autoreload 2 |
| 36 | + from mpl_playback import .... |
| 37 | + ``` |
| 38 | + |
| 39 | +### Working with Git |
| 40 | + |
| 41 | +Using Git/GitHub can confusing (<https://xkcd.com/1597>), so if you're new to Git, you may find it helpful to use a program like [GitHub Desktop](https://desktop.github.com) and to follow a [guide](https://github.com/firstcontributions/first-contributions#first-contributions). |
| 42 | + |
| 43 | +Also feel free to ask for help/advice on the relevant GitHub [issue](https://github.com/ianhi/mpl-playback/issues). |
| 44 | + |
| 45 | +## Documentation |
| 46 | + |
| 47 | +Our documentation on Read the Docs ([mpl-playback.rtfd.io](https://mpl-playback.readthedocs.io)) is built with [Sphinx](https://www.sphinx-doc.org) from the notebooks in the `docs` folder. It contains both Markdown files and Jupyter notebooks. |
| 48 | + |
| 49 | +If you open the `index.html` file in your browser you should now be able to see the rendered documentation. |
| 50 | + |
| 51 | +Alternatively, you can use [sphinx-autobuild](https://github.com/executablebooks/sphinx-autobuild) to continuously watch source files for changes and rebuild the documentation for you. Sphinx-autobuild will be installed automatically by the above `pip` command, so all you need to do is run: |
| 52 | + |
| 53 | +```bash |
| 54 | +tox -e doclive |
| 55 | +``` |
| 56 | + |
| 57 | +In a few seconds your web browser should open up the documentation. Now whenever you save a file the documentation will automatically regenerate and the webpage will refresh for you! |
0 commit comments