Skip to content
This repository was archived by the owner on Nov 22, 2024. It is now read-only.

Commit 4fe03ee

Browse files
committed
readthedocs initial setup - long overdue
1 parent 77fee2e commit 4fe03ee

7 files changed

Lines changed: 126 additions & 1 deletion

File tree

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ coverage.xml
4848
*.log
4949

5050
# Sphinx documentation
51-
docs/_build/
51+
docs/*.rst
52+
docs/_build/*
5253

5354
# PyBuilder
5455
target/

.readthedocs.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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+
# Optionally declare the Python requirements required to build your docs
9+
python:
10+
install:
11+
- requirements: docs/requirements.txt
12+
- requirements: requirements.txt
13+
14+
# Set the version of Python and other tools you might need
15+
build:
16+
os: ubuntu-22.04
17+
tools:
18+
python: "3"
19+
20+
# Build documentation in the docs/ directory with Sphinx
21+
sphinx:
22+
configuration: docs/conf.py

Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,13 @@ sign:
102102
ls -l tarball/$$v.tar.gz tarball/$$v.zip ; \
103103
ls -l tarball/$$v.tar.gz.asc tarball/$$v.zip.asc ;
104104

105+
docs: all
106+
sphinx-apidoc -Mfe -o docs . setup.py
107+
sphinx-build -j auto -b html docs docs/_build/html
108+
109+
clean-docs: all
110+
rm -rf docs/*.rst docs/_build/
111+
105112
lint:
106113
$(PYLINT) CloudFlare cli4
107114

docs/Makefile

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

docs/conf.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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+
import re
10+
with open('../CloudFlare/__init__.py', 'r') as f:
11+
_version_re = re.compile(r"__version__\s=\s'(.*)'")
12+
version = _version_re.search(f.read()).group(1)
13+
14+
project = 'python-cloudflare'
15+
copyright = 'Cloudflare (c) 2016 thru 2024'
16+
author = 'Martin J Levy'
17+
release = str(version)
18+
19+
# -- General configuration ---------------------------------------------------
20+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
21+
22+
extensions = [
23+
'myst_parser',
24+
'sphinx.ext.autodoc',
25+
'sphinx_rtd_theme',
26+
]
27+
28+
html_theme = "sphinx_rtd_theme"
29+
30+
templates_path = ['_templates']
31+
exclude_patterns = [
32+
'CloudFlare/__init__.py',
33+
'CloudFlare/tests/__init__.py',
34+
'_build',
35+
'Thumbs.db',
36+
'.DS_Store'
37+
]
38+
39+
autoclass_content = 'both'
40+
41+
# -- Options for HTML output -------------------------------------------------
42+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
43+
44+
html_theme = 'alabaster'
45+
html_static_path = ['_static']
46+
47+
import os
48+
import sys
49+
sys.path.insert(0, os.path.abspath('..'))

docs/index.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
.. python-cloudflare documentation master file, created by
2+
sphinx-quickstart on Fri Mar 1 09:53:57 2024.
3+
You can adapt this file completely to your liking, but it should at least
4+
contain the root `toctree` directive.
5+
6+
Welcome to python-cloudflare's documentation!
7+
=============================================
8+
9+
.. toctree::
10+
:maxdepth: 2
11+
:caption: Contents:
12+
13+
.. include:: modules.rst
14+
15+
Indices and tables
16+
==================
17+
18+
* :ref:`genindex`
19+
* :ref:`modindex`
20+
* :ref:`search`

docs/requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
sphinx>=4.0.0
2+
myst_parser>=1.0.0
3+
sphinx_rtd_theme>=1.2.0

0 commit comments

Comments
 (0)