Skip to content

Commit 7ca0fd6

Browse files
authored
Merge pull request #83 from jklymak/doc-move-to-sphinx
DOC: move to sphinx
2 parents 7a5611b + bcec3c5 commit 7ca0fd6

File tree

11 files changed

+234
-42
lines changed

11 files changed

+234
-42
lines changed

.circleci/config.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
version: 2.1
2+
3+
orbs:
4+
python: circleci/[email protected]
5+
6+
jobs:
7+
build_docs:
8+
executor: python/default
9+
steps:
10+
- checkout
11+
- python/install-deps
12+
- run:
13+
name: Build cheatsheets and docs
14+
command: make all
15+
- persist_to_workspace:
16+
root: docs/_build/html
17+
paths: .
18+
- store_artifacts:
19+
path: docs/_build/html/
20+
21+
workflows:
22+
main:
23+
jobs:
24+
- build_docs

.github/workflows/main.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,11 @@ jobs:
6161
path: |
6262
cheatsheets.pdf
6363
handout-*.pdf
64+
./docs/_build/html/
6465
- name: Publish cheatsheets and handouts
6566
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
6667
uses: peaceiris/actions-gh-pages@v3
6768
with:
6869
github_token: ${{ secrets.GITHUB_TOKEN }}
69-
publish_dir: ./build/
70+
publish_dir: ./docs/_build/html/
7071
force_orphan: true

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,9 @@ handout-*.png
1616
# ----------------------------------
1717
figures/*.pdf
1818
fonts/**/*.[ot]tf
19+
20+
# html build
21+
docs/_build/*
22+
23+
# OS specific
24+
.DS_Store

Makefile

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@ SRC := $(wildcard *.tex)
44
default: all
55

66
.PHONY: all
7-
all: logos figures cheatsheets handouts
8-
mkdir -p ./build/
9-
cp cheatsheets*.p* ./build/
10-
cp handout-*.p* ./build/
7+
all: logos figures cheatsheets handouts docs
118

129
.PHONY: logos
1310
logos:
@@ -16,11 +13,11 @@ logos:
1613
.PHONY: figures
1714
figures:
1815
# generate the figures
19-
cd scripts && for script in *.py; do echo $$script; python $$script; done
16+
cd scripts && for script in *.py; do echo $$script; MPLBACKEND="agg" python $$script; done
2017
# crop the figures
2118
cd figures && for figure in *.pdf; do echo $$figure; pdfcrop $$figure $$figure; done
2219
# regenerate some figures that should not be cropped
23-
cd scripts && python styles.py
20+
cd scripts && MPLBACKEND="agg" python styles.py
2421

2522
.PHONY: cheatsheets
2623
cheatsheets:
@@ -44,6 +41,13 @@ check:
4441
./check-num-pages.sh handout-intermediate.pdf 1
4542
./check-links.py cheatsheets.pdf
4643

44+
.PHONY: docs
45+
docs:
46+
make -C docs/ html
47+
cp ./cheatsheets*.p* ./docs/_build/html
48+
cp ./handout-*.p* ./docs/_build/html
49+
50+
4751
.PHONY: fonts
4852
fonts:
4953
make -C fonts/

build/index.html

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

docs/Makefile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?= -W
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = .
9+
BUILDDIR = _build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
show:
16+
@python -c "import webbrowser; webbrowser.open_new_tab('file://$(shell pwd)/build/html/index.html')"
17+
18+
.PHONY: help Makefile
19+
20+
# Catch-all target: route all unknown targets to Sphinx using the new
21+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
22+
%: Makefile
23+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/_static/favicon.ico

22 KB
Binary file not shown.

docs/conf.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import datetime
2+
3+
# -- Project information -----------------------------------------------------
4+
5+
html_title = 'Visualization with Python'
6+
project = "Matplotlib cheatsheets"
7+
copyright = (
8+
f"2012 - {datetime.datetime.now().year} The Matplotlib development team"
9+
)
10+
author = "Matplotlib Developers"
11+
12+
# -- General configuration ---------------------------------------------------
13+
14+
# Add any Sphinx extension module names here, as strings. They can be
15+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
16+
# ones.
17+
extensions = []
18+
19+
# Add any paths that contain templates here, relative to this directory.
20+
21+
templates_path = []
22+
23+
# List of patterns, relative to source directory, that match files and
24+
# directories to ignore when looking for source files.
25+
# This pattern also affects html_static_path and html_extra_path.
26+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
27+
28+
# -- Options for HTML output -------------------------------------------------
29+
30+
html_css_files = ['css/normalize.css', 'css/landing.css']
31+
html_theme = "mpl_sphinx_theme"
32+
html_favicon = "_static/favicon.ico"
33+
html_theme_options = {
34+
"logo_link": "https://matplotlib.org/stable/",
35+
"native_site": False,
36+
}
37+
38+
# Add any paths that contain custom static files (such as style sheets) here,
39+
# relative to this directory. They are copied after the theme static files,
40+
# so a file named "default.css" will overwrite the theme's "default.css".
41+
html_static_path = ["_static"]

docs/index.rst

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
.. title:: Matplotlib cheatsheets
2+
3+
***********************************
4+
Matplotlib cheatsheets and handouts
5+
***********************************
6+
7+
Cheatsheets
8+
***********
9+
10+
.. container:: twocol
11+
12+
.. container::
13+
14+
.. image:: ../cheatsheets-1.png
15+
:width: 270px
16+
:align: center
17+
:alt: image of first page of cheatsheets
18+
19+
20+
.. container::
21+
22+
.. image:: ../cheatsheets-2.png
23+
:width: 270px
24+
:align: center
25+
:alt: image of second page of cheatsheets
26+
27+
28+
`Cheatsheets [pdf] <./cheatsheets.pdf>`_
29+
30+
31+
32+
Handouts
33+
********
34+
35+
.. container:: twocol
36+
37+
.. container::
38+
39+
.. image:: ../handout-beginner.png
40+
:width: 270px
41+
:align: center
42+
:alt: image of beginner handout
43+
44+
`Beginner [pdf] <./handout-beginner.pdf>`_
45+
46+
47+
.. container::
48+
49+
.. image:: ../handout-intermediate.png
50+
:width: 270px
51+
:align: center
52+
:alt: image of intermediate handout
53+
54+
`Intermediate [pdf] <./handout-intermediate.pdf>`_
55+
56+
57+
.. container::
58+
59+
.. image:: ../handout-tips.png
60+
:width: 270px
61+
:align: center
62+
:alt: image of tips handout
63+
64+
`Tips [pdf] <./handout-tips.pdf>`_
65+

requirements/requirements.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,7 @@ pdfx
55
pip-tools
66
pre-commit
77
scipy
8+
sphinx
9+
mpl-sphinx-theme
810

911
--no-binary shapely

requirements/requirements.txt

Lines changed: 61 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,25 @@
11
#
2-
# This file is autogenerated by pip-compile
2+
# This file is autogenerated by pip-compile with python 3.9
33
# To update, run:
44
#
55
# pip-compile requirements.in
66
#
77
--no-binary shapely
88

9+
alabaster==0.7.12
10+
# via sphinx
911
appdirs==1.4.4
1012
# via virtualenv
13+
babel==2.9.1
14+
# via sphinx
15+
beautifulsoup4==4.10.0
16+
# via pydata-sphinx-theme
1117
bump2version==1.0.1
1218
# via -r requirements.in
1319
cartopy==0.19.0.post1
1420
# via -r requirements.in
21+
certifi==2021.10.8
22+
# via requests
1523
cffi==1.15.0
1624
# via cryptography
1725
cfgv==3.2.0
@@ -20,6 +28,8 @@ chardet==4.0.0
2028
# via
2129
# pdfminer.six
2230
# pdfx
31+
charset-normalizer==2.0.7
32+
# via requests
2333
click==8.0.0
2434
# via pip-tools
2535
cryptography==35.0.0
@@ -28,26 +38,37 @@ cycler==0.10.0
2838
# via matplotlib
2939
distlib==0.3.1
3040
# via virtualenv
41+
docutils==0.17.1
42+
# via
43+
# pydata-sphinx-theme
44+
# sphinx
3145
filelock==3.0.12
3246
# via virtualenv
3347
identify==2.2.2
3448
# via pre-commit
35-
importlib-metadata==3.9.0
36-
# via
37-
# pep517
38-
# pre-commit
39-
# virtualenv
49+
idna==3.3
50+
# via requests
51+
imagesize==1.2.0
52+
# via sphinx
53+
jinja2==3.0.2
54+
# via sphinx
4055
kiwisolver==1.3.1
4156
# via matplotlib
57+
markupsafe==2.0.1
58+
# via jinja2
4259
matplotlib==3.4.2
4360
# via -r requirements.in
61+
mpl-sphinx-theme==0.0.6
62+
# via -r requirements.in
4463
nodeenv==1.5.0
4564
# via pre-commit
4665
numpy==1.19.5
4766
# via
4867
# cartopy
4968
# matplotlib
5069
# scipy
70+
packaging==21.2
71+
# via sphinx
5172
pdfminer.six==20201018
5273
# via pdfx
5374
pdfx==1.4.1
@@ -62,14 +83,24 @@ pre-commit==2.11.1
6283
# via -r requirements.in
6384
pycparser==2.20
6485
# via cffi
86+
pydata-sphinx-theme==0.7.1
87+
# via mpl-sphinx-theme
88+
pygments==2.10.0
89+
# via sphinx
6590
pyparsing==2.4.7
66-
# via matplotlib
91+
# via
92+
# matplotlib
93+
# packaging
6794
pyshp==2.1.3
6895
# via cartopy
6996
python-dateutil==2.8.1
7097
# via matplotlib
98+
pytz==2021.3
99+
# via babel
71100
pyyaml==5.4.1
72101
# via pre-commit
102+
requests==2.26.0
103+
# via sphinx
73104
scipy==1.5.4
74105
# via -r requirements.in
75106
shapely==1.7.1
@@ -79,20 +110,37 @@ six==1.15.0
79110
# cycler
80111
# python-dateutil
81112
# virtualenv
113+
snowballstemmer==2.1.0
114+
# via sphinx
82115
sortedcontainers==2.4.0
83116
# via pdfminer.six
117+
soupsieve==2.3
118+
# via beautifulsoup4
119+
sphinx==4.2.0
120+
# via
121+
# -r requirements.in
122+
# pydata-sphinx-theme
123+
sphinxcontrib-applehelp==1.0.2
124+
# via sphinx
125+
sphinxcontrib-devhelp==1.0.2
126+
# via sphinx
127+
sphinxcontrib-htmlhelp==2.0.0
128+
# via sphinx
129+
sphinxcontrib-jsmath==1.0.1
130+
# via sphinx
131+
sphinxcontrib-qthelp==1.0.3
132+
# via sphinx
133+
sphinxcontrib-serializinghtml==1.1.5
134+
# via sphinx
84135
toml==0.10.2
85136
# via
86137
# pep517
87138
# pre-commit
88-
typing-extensions==3.7.4.3
89-
# via importlib-metadata
139+
urllib3==1.26.7
140+
# via requests
90141
virtualenv==20.4.3
91142
# via pre-commit
92-
zipp==3.4.1
93-
# via
94-
# importlib-metadata
95-
# pep517
96143

97144
# The following packages are considered to be unsafe in a requirements file:
98145
# pip
146+
# setuptools

0 commit comments

Comments
 (0)