Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 65702fb

Browse files
authored
Merge pull request #47 from lukelbd/nbsphinx-docs
Organize documentation and sync ipython notebooks instead of nbconvert-generated RST files
2 parents 3224bbd + 0c6d581 commit 65702fb

File tree

243 files changed

+9525
-1413260
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

243 files changed

+9525
-1413260
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
exclude_paths:
33
- 'docs/**'
4+
- 'proplot/tests/**'
45
- 'proplot/fonts/**'
56
- 'proplot/colors/**'
67
- 'proplot/cycles/**'
78
- 'proplot/cmaps/**'
8-
- 'proplot/cmaps_rejects/**'

‎.gitattributes

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# Strips notebook output for diffs and when staging files
2-
# Download with 'pip install nbstripout'
31
# See: https://github.com/kynan/nbstripout
42
*.ipynb filter=nbstripout
53
*.ipynb diff=ipynb
6-

‎.gitconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# See: https://github.com/kynan/nbstripout
2+
[diff "ipynb"]
3+
textconv = nbstripout -t
4+
[filter "nbstripout"]
5+
clean = "f() { echo >&2 \"clean: nbstripout $1\"; nbstripout; }; f %f"
6+
smudge = "f() { echo >&2 \"smudge: cat $1\"; cat; }; f %f"
7+
required = true

‎.gitignore

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,29 @@
66
# PyPi stuff
77
build
88
dist
9+
.eggs
910
*.egg-info
1011

11-
# Builds made during testing
12+
# Local docs builds
1213
docs/api
1314
docs/_build
1415

15-
# Deleted
16-
trash
17-
notebooks*
18-
garbage
16+
# Notebook stuff
17+
**/tests/*.ipynb
18+
.ipynb_checkpoints
1919

2020
# Python extras
2121
*.log
2222
*.pyc
2323
.*.pyc
2424
__pycache__
2525

26-
# Notebooks
27-
# NOTE: For now ignore, contributors just need RST files to build docs and
28-
# have personal control over quickstart.
29-
*.ipynb
30-
.ipynb_checkpoints
31-
3226
# OS files
3327
.DS_Store
3428
.DS_Store?
3529
._*
3630
.Trashes
31+
32+
# Old files
33+
trash
34+
garbage

‎.readthedocs.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# .readthedocs.yml
2+
# Read the Docs configuration file
3+
version: 2
4+
5+
# Sphinx config
6+
sphinx:
7+
builder: html
8+
configuration: docs/conf.py
9+
10+
# Python config
11+
build:
12+
image: latest
13+
python:
14+
version: 3.6
15+
conda:
16+
environment: docs/environment.yml

‎.travis.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Travis Continuos Integration
2+
# Currently only tests notebook files
3+
# Based on http://conda.pydata.org/docs/travis.html
4+
# Not sure why pip install . is necessary since conf.py adds it
5+
# to the the path. Maybe nbsphinx executes in separate environment.
6+
sudo: false # use container based build
7+
language: python
8+
notifications:
9+
email: false
10+
11+
python:
12+
- "3.6"
13+
14+
before_install:
15+
- wget http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
16+
- bash miniconda.sh -b -p $HOME/miniconda
17+
- export PATH="$HOME/miniconda/bin:$PATH"
18+
- hash -r
19+
- conda config --set always_yes yes --set changeps1 no --set show_channel_urls true
20+
- conda update -q conda
21+
- conda info -a
22+
23+
install:
24+
- conda env create -n proplot-dev --file docs/environment.yml
25+
- source activate proplot-dev
26+
- conda install pip
27+
- conda list
28+
- which conda
29+
- which python
30+
- pip install .
31+
- python setup.py install --user
32+
33+
script:
34+
- pushd docs
35+
- make html
36+
- popd
37+

‎CHANGELOG.rst

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
=================
2-
Changelog History
2+
Changelog history
33
=================
44

5-
ProPlot v1.0.0
6-
==============
7-
First official release. Coming soon! Future changes and releases will be documented.
5+
ProPlot v1.0
6+
============
7+
First official release (ETA: Spring 2020) after which we will start broadcasting this project more loudly. We will bump to this version when some major refactoring tasks have been completed.
8+
9+
ProPlot v0.1
10+
============
11+
This will be the first version when ProPlot is released on pypi. Changes thereafter will be listed here. Think of the v0 releases as "beta versions".
812

913
Internals/Minor Fixes
1014
---------------------

‎HOWTOCONTRIBUTE.rst

Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
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+

‎HOWTORELEASE.rst

Lines changed: 0 additions & 24 deletions
This file was deleted.

‎INSTALL.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Installation
2+
============
3+
4+
This package is a work-in-progress -- currently, there is no formal release
5+
on PyPi (ETA: January 2020). For the time being, you may install directly from Github using:
6+
7+
.. code-block:: bash
8+
9+
pip install git+https://github.com/lukelbd/proplot.git
10+
11+
To upgrade to the latest version, run ``pip uninstall proplot``, then re-install.
12+
13+
The dependencies are `matplotlib <https://matplotlib.org/>`__ and `numpy <http://www.numpy.org/>`__. The optional geographic mapping features require `cartopy <https://scitools.org.uk/cartopy/docs/latest/>`__ and/or `basemap <https://matplotlib.org/basemap/index.html>`__.
14+

0 commit comments

Comments
 (0)