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

0 commit comments

Comments
 (0)