Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quarto Doc #706

Merged
merged 93 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
ea6ae2b
Add requirements for quartodoc
has2k1 Aug 8, 2023
32f0e73
docs: generate an html table when documenting
machow Jun 1, 2023
666ca86
docs: format usage, better handling of env var
machow Jun 1, 2023
7311bb6
Add quartodoc
has2k1 Aug 8, 2023
70c1cb7
DOC: Get quartodoc to build
has2k1 Aug 8, 2023
f1017b7
DOC: Build on GHA
has2k1 Aug 8, 2023
66960ec
Fix make targets and .gitignore
has2k1 Aug 8, 2023
bcd8903
Update qaurto references
has2k1 Aug 8, 2023
1e7bd83
Doc: Remove geom & stat signature
has2k1 Aug 8, 2023
b9d4a66
DOC: Remove debug string from doctools.py
has2k1 Aug 8, 2023
f7d2a0d
Make alias function return object
has2k1 Aug 9, 2023
acea1e0
Fix interlinks with sources
has2k1 Aug 9, 2023
badd66f
DOC: Change links in mapping.* to markdown
has2k1 Aug 9, 2023
5f1aeb5
DOC: Change plotnine links from rst to markdown
has2k1 Aug 9, 2023
c8be882
DOC: Use plain path in See Also
has2k1 Aug 9, 2023
fa14ac8
DOC: Add version to documentation
has2k1 Aug 9, 2023
3d3b48a
DOC: RST to Markdown
has2k1 Aug 10, 2023
4af3d6f
DOC: Fix markup in docstrings
has2k1 Aug 11, 2023
512c7d3
DOC: Use definition lists for docstring parameters
has2k1 Aug 16, 2023
5a86c72
Refactor interlinks filter
has2k1 Aug 23, 2023
e5c798d
Cache the interlinks inventory as a binary
has2k1 Oct 30, 2023
13f648c
Use numpdoc renderer
has2k1 Nov 2, 2023
95a753a
Upgrade build requirements documentation.yml
has2k1 Nov 2, 2023
7bfbb96
Fix unmatched type references
has2k1 Nov 3, 2023
af4d3de
Generate a grid table for the geom aesthetics
has2k1 Nov 3, 2023
e8a960c
DOC: Remove duplicate type info from docstrings
has2k1 Nov 6, 2023
f4fe8ea
DOC: Automatically discover gallery notebooks
has2k1 Nov 8, 2023
e9b29d3
DOC: Automatically generate tutorial page items
has2k1 Nov 8, 2023
1ce9112
ENH: Do not overwrite environment file
has2k1 Nov 9, 2023
15a1beb
DOC: Cleanup gallery css
has2k1 Nov 9, 2023
58cff39
Do not renderer broken interlinks as code
has2k1 Nov 9, 2023
4eaeb68
Render ~annotations without the qualname parts
has2k1 Nov 9, 2023
f970da4
DOC: Correct case for DataFrame class
has2k1 Nov 9, 2023
2e81c3c
TYP: Fix typechecking
has2k1 Nov 9, 2023
28ad755
TYP: Remove TYPE_CHECKING condition in typing.py
has2k1 Nov 9, 2023
9b55b25
MAINT: Cleanup quartodoc Makefile
has2k1 Nov 9, 2023
b59e5dd
DOC: Render Aesthetics Descriptions terms as code
has2k1 Nov 9, 2023
a476ba9
DOC: Style up the docstring parameters
has2k1 Nov 9, 2023
aede970
DOC: Style the docstring signature as a block
has2k1 Nov 9, 2023
596e996
DOC: Cleanup annotations in docstrings
has2k1 Nov 13, 2023
10a3f3e
DOC: Use fenced code blocks for the Usage
has2k1 Nov 13, 2023
ced00ae
DOC: Fix complaints about interlinks when building
has2k1 Nov 13, 2023
dbc68af
DOC: Touchup config file
has2k1 Nov 13, 2023
7c11070
Implement alias as a mixin-class
has2k1 Nov 15, 2023
614378d
QOL: Render docs on port 42000
has2k1 Nov 15, 2023
bf30a96
DOC: Add type info to the generated doc string
has2k1 Nov 15, 2023
f7a2565
DOC: Omit parameter self for class signature
has2k1 Nov 16, 2023
d8ecb3c
DOC: Fix griffe.expressions breaking changes
has2k1 Nov 16, 2023
77e3b25
DOC: Do not wrap the doc-symbol in the sidebar
has2k1 Nov 16, 2023
69279e6
DOC: Add doc-labels to the renderer
has2k1 Nov 16, 2023
b353c7a
DOC: Add **kwargs to signature for geoms & stats
has2k1 Nov 18, 2023
102c28c
Generate well formatted signatures
has2k1 Nov 18, 2023
6a01790
DOC: Use the dynamic signature for geoms & stats
has2k1 Nov 18, 2023
4b3f4ba
Wrap rendered docstring into doc-contents class
has2k1 Nov 20, 2023
427d4f7
DOC: Fix including the example notebooks
has2k1 Nov 20, 2023
6dd68f9
Do not render annotations in func/meth signatures
has2k1 Nov 20, 2023
849c3c9
Refine doc spacing and indentation
has2k1 Nov 21, 2023
2a68b0d
Render default string params with double quotes
has2k1 Nov 21, 2023
e40d955
DOC: Fix .out.ipynb messing up gallery rendering
has2k1 Nov 21, 2023
dae8c2e
DOC: Convert changelog to markdown
has2k1 Nov 22, 2023
4f28579
DOC: Delete sphinx docs
has2k1 Nov 22, 2023
9fd79f6
Rename qdoc to doc
has2k1 Nov 22, 2023
b0d876f
DOC: Add image from previous doc
has2k1 Nov 22, 2023
392d07c
MAINT: Ignore quarto extensions
has2k1 Nov 22, 2023
72a1d2c
LINT: Convert string.formats to f-strings
has2k1 Nov 23, 2023
6b9f87d
fixup! Implement alias as a mixin-class
has2k1 Nov 23, 2023
9899e3f
Fixed blanking of legend_background
has2k1 Nov 23, 2023
1136a73
CI: Change doc testing to quartodoc
has2k1 Nov 24, 2023
969542a
fixup! Rename qdoc to doc
has2k1 Nov 24, 2023
675c124
Wrap see-also in a doc-definition-items class
has2k1 Nov 24, 2023
195352e
DOC: Use fewer * selectors
has2k1 Nov 24, 2023
3caa605
Add doc-summary* classes to the renderer
has2k1 Nov 24, 2023
717930c
DOC: Cleanup css
has2k1 Nov 24, 2023
f269c2d
DOC: Fixup index page
has2k1 Nov 24, 2023
03ff956
Create a separate signature method for attributes
has2k1 Nov 27, 2023
1830f13
DOC: For attributes change "#:" to triple quotes
has2k1 Nov 27, 2023
6193db7
Render attribute declarations like function params
has2k1 Nov 27, 2023
611d0a7
DOC: Touchup data declarations
has2k1 Nov 27, 2023
316ef2e
DOC: Title case reference section names
has2k1 Nov 27, 2023
d2ce170
Implement docs for typing information
has2k1 Dec 1, 2023
dea4c90
Use a function to create the doc-labels
has2k1 Dec 5, 2023
939fcbe
Add documentation of typing protocols
has2k1 Dec 5, 2023
2011708
Refactor the typealias documentation
has2k1 Dec 6, 2023
b23647b
DOC: Document typing Protocol methods
has2k1 Dec 6, 2023
12469ef
DOC: Combine styling for definitions that are code
has2k1 Dec 6, 2023
5862571
Escape rendered names that are not in code
has2k1 Dec 6, 2023
f7b7d13
DOC: Temporarily set fast: true for the interlinks
has2k1 Dec 6, 2023
24fa353
CI: Use quartodoc@more-extendable-quartodoc branch
has2k1 Dec 6, 2023
63c1d31
Fix generate_gallery
has2k1 Dec 6, 2023
13c9dcf
CI: Use dev version of mizani
has2k1 Dec 6, 2023
2a9256f
CI: Use quarto add --no-prompt
has2k1 Dec 6, 2023
882fc71
Use normal font-weight for doc definition terms
has2k1 Dec 11, 2023
c013d50
Use renderer._pages_written with builder param
has2k1 Dec 11, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Documentation

on:
workflow_dispatch:
push:
branches: ["main", "dev", "doc", "qdoc", "dev-*"]
pull_request:
release:
types: [published]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
python-version: [3.11]

steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install Quarto
uses: quarto-dev/quarto-actions/setup@v2
with:
version: "1.4.521"

- name: Install Package
run: |
pip install git+https://github.com/has2k1/mizani.git@main
python -m pip install ".[doc]"
pip install -r requirements/doc.txt
quarto add --no-prompt has2k1/issuey

- name: Environment Information
shell: bash
run: |
ls -la
ls -la doc
pip list

- name: Build docs
run: |
make doc

- name: Deploy to Github Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: doc/_site
17 changes: 10 additions & 7 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

strategy:
matrix:
python-version: [3.9, 3.11]
python-version: [3.9, 3.12]

steps:
- name: Checkout Code
Expand Down Expand Up @@ -144,21 +144,24 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install Quarto
uses: quarto-dev/quarto-actions/setup@v2
with:
version: "1.4.521"

- name: Install Packages
shell: bash
run: |
sudo apt-get install pandoc
pip install git+https://github.com/has2k1/mizani.git@main
pip install ".[test,doc]"
pip install -r requirements/examples.txt
pip install -r requirements/doc.txt
quarto add --no-prompt has2k1/issuey

- name: Environment Information
shell: bash
run: pip list

- name: Build Documentation
shell: bash
- name: Build documentation
run: |
pushd doc
SPHINXOPTS=-W
make html && popd
make doc
18 changes: 18 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ tests/result_images/
notes.txt
examples/.ipynb_checkpoints

# plotnine developing
.ipynb_checkpoints/
*.ipynb

# Translations
*.mo
*.pot
Expand All @@ -85,3 +89,17 @@ benchmarks

# version file generated by setuptools-scm
plotnine/_version.py


# Documentation
doc/plotnine_examples/
doc/reference/
doc/_site/
doc/_inv/
doc/_extensions/
doc/.quarto/
doc/gallery/thumbnails
doc/objects.json
doc/objects.txt
doc/.luarc.json
doc/_environment
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,10 @@ coverage:
$(BROWSER) htmlcov/index.html

doc:
$(MAKE) -C doc clean
$(MAKE) -C doc html
$(BROWSER) doc/_build/html/index.html
$(MAKE) -C doc doc

doc-preview:
$(MAKE) -C doc preview

release: clean
bash ./tools/release.sh
Expand Down
1 change: 1 addition & 0 deletions doc/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/.quarto/
65 changes: 9 additions & 56 deletions doc/Makefile
Original file line number Diff line number Diff line change
@@ -1,60 +1,13 @@
# Makefile for Sphinx documentation
#
interlinks:
quartodoc interlinks

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SPHINXPROJ = plotnine
SOURCEDIR = .
PAPER =
BUILDDIR = _build
build:
quartodoc build

# For make theme
BOOTSWATCHTHEME = united
brand-primary = \#9E2F68
headings-font-weight = bold
font-family-sans-serif = '"system-ui", "Segoe UI", "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"'
render: build
quarto render

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
@echo " theme to create a custom sphinx boostrap theme"
@echo " logo to generate logo images"
@echo " readme_images to generate images used in README.rst"
doc: interlinks render

.PHONY: help Makefile theme logo readme_images

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

theme:
../tools/build_theme.sh --theme $(BOOTSWATCHTHEME) \
--brand-primary '$(brand-primary)' \
--headings-font-weight $(headings-font-weight) \
--font-family-sans-serif '$(font-family-sans-serif)'

logo:
cd images; \
python logo.py; \
convert -trim -density 300 -alpha remove -background '#FFFFFF' \
-gravity center -scale 528x528 -extent 540x540 \
-border 6 -bordercolor '#441A3F'\
logo.pdf logo-540.png; \
convert -trim -density 300 -alpha remove -background '#FFFFFF' \
-gravity center -scale 176x176 -extent 180x180 \
-border 2 -bordercolor '#441A3F'\
logo.pdf logo-180.png; \
convert -trim -density 300 -alpha remove -background '#FFFFFF' \
-gravity center -scale 32x32 \
-border 2 -bordercolor '#441A3F'\
logo-small.pdf logo-32.png; \
convert -trim -density 300 -alpha remove -background '#FFFFFF' \
-gravity center -scale 32x32 \
-border 2 -bordercolor '#441A3F'\
logo-small.pdf favicon.ico;

readme_images:
cd images; \
python readme_images.py
preview:
quarto preview --port 42000 --no-browser
7 changes: 7 additions & 0 deletions doc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# plotnine-docs-demo

This repo migrates the plotnine docs from sphinx to quarto (using quartodoc).

* [site preview](https://main--plotnine-docs-demo.netlify.app)
* [original site on readthedocs](https://plotnine.readthedocs.io/en/stable/)
* [has2k1/plotnine repo](https://github.com/has2k1/plotnine)
73 changes: 73 additions & 0 deletions doc/_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import hashlib
import re
import shutil
from importlib.metadata import version as get_version
from importlib.resources import files as _files
from pathlib import Path

DOC_DIR = Path(__file__).parent

# The environment file holds the version
ENV_TPL = """\
VERSION={version}
"""


def generate_environment_file():
"""
Generate _enviroment file in the quartodoc project directory
"""
version = get_version("plotnine")
filepath = DOC_DIR / "_environment"

# The scm-version scheme adds .date suffix to the version
# if the repo is dirty. For better look while developing,
# we remove it.
dirty_pattern = re.compile(r"\.d\d{8}$")
if dirty_pattern.search(version):
version = dirty_pattern.sub("", version)

# FIXME: We return because modifying the _environment file
# breaks "quarto render"
if filepath.exists():
return

contents = ENV_TPL.format(version=version)
filepath.write_text(contents)


def copy_examples_and_tutorials():
"""
Copy the examples & tutorials in plotnine_examples
"""

# NOTE: To avoid confusing the watcher used by "quarto preview",
# we copy only if the original files are different.
def same_contents(f1, f2):
h1 = hashlib.md5(f1.read_bytes()).hexdigest()
h2 = hashlib.md5(f2.read_bytes()).hexdigest()
return h1 == h2

def copy(src_dir, dest_dir):
dest_dir.mkdir(parents=True, exist_ok=True)
src_files = src_dir.glob("*.ipynb")
cur_dest_files = dest_dir.glob("*.ipynb")
new_dest_files = []
for src in src_files:
dest = dest_dir / src.name
new_dest_files.append(dest)
if dest.exists() and same_contents(src, dest):
continue
shutil.copyfile(src, dest)

# Remove any deleted files
for dest in set(cur_dest_files).difference(new_dest_files):
dest.unlink()

copy(_files("plotnine_examples.examples"), DOC_DIR / "examples")
copy(_files("plotnine_examples.tutorials"), DOC_DIR / "tutorials")


if __name__ == "__main__":
generate_environment_file()
copy_examples_and_tutorials()
3 changes: 3 additions & 0 deletions doc/_extensions/machow/interlinks/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.html
*.pdf
*_files/
7 changes: 7 additions & 0 deletions doc/_extensions/machow/interlinks/_extension.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
title: Interlinks
author: Michael Chow
version: 1.0.0
quarto-required: ">=1.2.0"
contributes:
filters:
- interlinks.lua
Loading
Loading