Skip to content

Commit 624c3d4

Browse files
committed
Add documentation configs
1 parent d4cc243 commit 624c3d4

11 files changed

+192
-1
lines changed

.github/workflows/docs.yml

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Docs
2+
on: push
3+
env:
4+
PRIMARY_PYTHON_VERSION: '3.13'
5+
jobs:
6+
docs:
7+
runs-on: ubuntu-latest
8+
timeout-minutes: 25
9+
steps:
10+
- name: Setup Python
11+
uses: actions/setup-python@v5
12+
with:
13+
python-version: ${{ env.PRIMARY_PYTHON_VERSION }}
14+
- name: Print Python version
15+
run: python -V
16+
- name: Install LaTeX
17+
run: |
18+
sudo apt-get update
19+
sudo apt-get install -y cm-super dvipng latexmk optipng texlive-latex-extra texlive-xetex fonts-freefont-otf xindy
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
- name: Load pip cache
23+
uses: actions/cache@v4
24+
with:
25+
path: .pip
26+
key: pip-${{ runner.os }}-${{ hashFiles('requirements.txt') }}
27+
restore-keys: |
28+
pip-${{ runner.os }}-
29+
pip-
30+
- name: Install requirements
31+
run: |
32+
pip --cache-dir=.pip install --upgrade pip wheel
33+
pip --cache-dir=.pip install -r requirements.txt -r requirements-dev.txt -r docs/requirements.txt
34+
- name: Generate documentation
35+
run: |
36+
cd docs
37+
make all
38+
- name: Upload results
39+
uses: actions/upload-artifact@v4
40+
with:
41+
name: Documentation
42+
path: |
43+
docs/_build
44+
if-no-files-found: error

.github/workflows/main.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: CI
22
on: push
33
env:
4-
PRIMARY_PYTHON_VERSION: '3.12'
4+
PRIMARY_PYTHON_VERSION: '3.13'
55
jobs:
66
test:
77
runs-on: ubuntu-latest

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
*~
22
\#*\#
33
__pycache__
4+
_build
45
*.egg-info
56
*.pyc
67
*.sqlite3

.readthedocs.yaml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# .readthedocs.yaml
2+
# Read the Docs configuration file
3+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4+
5+
# Required
6+
version: 2
7+
8+
build:
9+
os: ubuntu-lts-latest
10+
tools:
11+
python: "3.13"
12+
13+
# Build documentation in the docs/ directory with Sphinx
14+
sphinx:
15+
configuration: docs/conf.py
16+
# fail_on_warning: true
17+
18+
# Optionally build your docs in additional formats such as PDF
19+
formats: all
20+
21+
# Optionally set the version of Python and requirements required to build your docs
22+
python:
23+
install:
24+
- requirements: requirements.txt
25+
- requirements: docs/requirements.txt

docs/Makefile

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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+
# The -j auto parameter has been added in the hope that it would enable parallelization.
7+
SPHINXOPTS ?= -j auto
8+
SPHINXBUILD ?= sphinx-build
9+
SOURCEDIR = .
10+
BUILDDIR = _build
11+
12+
# Put it first so that "make" without argument is like "make help".
13+
help:
14+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
15+
16+
.PHONY: help Makefile
17+
18+
all:
19+
# Cleaning helps in detecting changes to the Python files.
20+
$(MAKE) clean
21+
$(MAKE) linkcheck
22+
$(MAKE) html
23+
$(MAKE) latexpdf
24+
$(MAKE) epub
25+
26+
clean:
27+
rm -rf $(BUILDDIR)/*
28+
rm -rf auto_examples/
29+
rm -rf gen_modules/
30+
rm -rf */gen_modules/
31+
rm -rf */*/gen_modules/
32+
33+
# Catch-all target: route all unknown targets to Sphinx using the new
34+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
35+
%: Makefile
36+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/conf.py

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# For the full list of built-in configuration values, see the documentation:
4+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
5+
6+
# -- Project information -----------------------------------------------------
7+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
8+
9+
project = 'PTPlot'
10+
copyright = '2025, David Weir'
11+
author = 'David Weir'
12+
release = '1.1.0'
13+
14+
# -- General configuration ---------------------------------------------------
15+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
16+
17+
extensions = []
18+
19+
templates_path = ['_templates']
20+
exclude_patterns = []
21+
22+
23+
24+
# -- Options for HTML output -------------------------------------------------
25+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
26+
27+
html_theme = 'alabaster'
28+
html_static_path = ['_static']

docs/index.rst

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
.. PTPlot documentation master file, created by
2+
sphinx-quickstart on Wed Jan 29 19:23:31 2025.
3+
You can adapt this file completely to your liking, but it should at least
4+
contain the root `toctree` directive.
5+
6+
PTPlot documentation
7+
====================
8+
9+
Add your content using ``reStructuredText`` syntax. See the
10+
`reStructuredText <https://www.sphinx-doc.org/en/master/usage/restructuredtext/index.html>`_
11+
documentation for details.
12+
13+
14+
.. toctree::
15+
:maxdepth: 2
16+
:caption: Contents:
17+

docs/make.bat

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=source
11+
set BUILDDIR=build
12+
13+
%SPHINXBUILD% >NUL 2>NUL
14+
if errorlevel 9009 (
15+
echo.
16+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
17+
echo.installed, then set the SPHINXBUILD environment variable to point
18+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
19+
echo.may add the Sphinx directory to PATH.
20+
echo.
21+
echo.If you don't have Sphinx installed, grab it from
22+
echo.https://www.sphinx-doc.org/
23+
exit /b 1
24+
)
25+
26+
if "%1" == "" goto help
27+
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29+
goto end
30+
31+
:help
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33+
34+
:end
35+
popd
File renamed without changes.
File renamed without changes.

docs/requirements.txt

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
memory-profiler >= 0.61.0
2+
sphinx == 8.1.3
3+
sphinx-gallery == 0.18.0
4+
sphinx-math-dollar == 1.2.1
5+
sphinx-rtd-theme == 3.0.2

0 commit comments

Comments
 (0)