Skip to content

Commit 67a81a7

Browse files
author
Fabien Coelho
committed
API documentation test
1 parent d466115 commit 67a81a7

File tree

8 files changed

+131
-8
lines changed

8 files changed

+131
-8
lines changed

.github/workflows/docs.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: FlaskTest documentation publication on GitHub
2+
3+
on: push
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout
10+
uses: actions/checkout@v3
11+
- name: Set up Python
12+
uses: actions/setup-python@v4
13+
- name: Install dependencies
14+
run: make venv.update
15+
- name: Check documentation syntax
16+
run: make check.docs
17+
- name: Generate documentation
18+
run: make docs
19+
- name: Upload to GitHub Pages
20+
# FIXME what is the difference with deploy below?
21+
uses: actions/upload-pages-artifact@v2
22+
deploy:
23+
needs: build
24+
permissions:
25+
pages: write
26+
id-token: write
27+
runs-on: ubuntu-latest
28+
steps:
29+
- name: Deploy to GitHub Pages
30+
id: deployment
31+
uses: actions/deploy-pages@v2

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -158,3 +158,6 @@ cython_debug/
158158
# and can be added to the global gitignore or merged into this file. For a more nuclear
159159
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
160160
#.idea/
161+
162+
# doc
163+
_site

Makefile

+19-5
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ check.coverage: venv
3939
check.docs:
4040
source venv/bin/activate
4141
pymarkdown -d MD013 scan *.md
42-
# sphinx-lint docs/
42+
sphinx-lint docs/
4343

4444
check: venv
4545
source venv/bin/activate
@@ -51,20 +51,34 @@ check: venv
5151
$(MAKE) check.pytest && \
5252
$(MAKE) check.coverage
5353

54-
.PHONY: clean clean.venv
54+
.PHONY: docs
55+
docs: venv
56+
source venv/bin/activate
57+
$(MAKE) -C docs html
58+
find docs/_build -type d -print0 | xargs -0 chmod a+rx
59+
find docs/_build -type f -print0 | xargs -0 chmod a+r
60+
ln -s docs/_build/html _site
61+
62+
.PHONY: clean
5563
clean:
56-
$(RM) -r __pycache__ */__pycache__ dist build .mypy_cache .pytest_cache .ruff_cache
64+
$(RM) -r __pycache__ */__pycache__ dist build .mypy_cache .pytest_cache .ruff_cache _site
5765
$(RM) $(F.pdf)
5866
$(MAKE) -C tests clean
67+
$(MAKE) -C docs clean
5968

69+
.PHONY: clean.venv
6070
clean.venv: clean
6171
$(RM) -r venv *.egg-info
6272

73+
.PHONY: venv.update
74+
venv.update:
75+
$(PIP) install -U pip
76+
$(PIP) install -e .[dev,doc]
77+
6378
# for local testing
6479
venv:
6580
$(PYTHON) -m venv venv
66-
$(PIP) install -U pip
67-
$(PIP) install -e .[dev,doc]
81+
$(MAKE) venv.update
6882

6983
$(MODULE).egg-info: venv
7084
$(PIP) install -e .

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,9 @@ please report any [issues](https://github.com/zx80/flask-tester/issues).
190190

191191
## Versions
192192

193-
### ? on ?
193+
### 1.3 on ?
194194

195+
Generate API documentation.
195196
Cleaner code.
196197

197198
### 1.2 on 2024-03-15

docs/Makefile

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

docs/conf.py

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#
2+
# Configuration file for the Sphinx documentation builder.
3+
#
4+
# For the full list of built-in configuration values, see the documentation:
5+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
6+
7+
# -- Project information -----------------------------------------------------
8+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
9+
10+
project = "FlaskTester"
11+
copyright = "2024, Calvin"
12+
author = "Calvin"
13+
14+
from importlib.metadata import version as pkg_version
15+
release = pkg_version("FlaskTester")
16+
17+
# -- General configuration ---------------------------------------------------
18+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
19+
20+
source_suffix = [".md", ".rst"]
21+
22+
extensions = ["myst_parser", "autoapi.extension"]
23+
24+
autoapi_dirs = [".."]
25+
autoapi_ignore = ["*/venv/*", "*/tests/*"]
26+
autoapi_options = ["members", "show-inheritance", "show-module-summary", "special-members", "imported-members"]
27+
28+
templates_path = ["_templates"]
29+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
30+
31+
# -- Options for HTML output -------------------------------------------------
32+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
33+
34+
html_theme = "sphinx_rtd_theme" # ReadTheDocs Theme
35+
html_static_path = ["_static"]

docs/index.rst

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
.. include:: ../README.md
2+
:parser: myst_parser.sphinx_
3+
4+
.. toctree::
5+
:maxdepth: 3
6+
:caption: Contents
7+
8+
API <autoapi>
9+
10+
Indices and tables
11+
==================
12+
13+
* :ref:`genindex`
14+
* :ref:`modindex`
15+
* :ref:`search`

pyproject.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "FlaskTester"
7-
version = "1.2"
7+
version = "1.3"
88
authors = [ { name = "Fabien Coelho", email = "[email protected]" } ]
99
description = "Pytest fixtures for Flask internal and external authenticated tests"
1010
readme = "README.md"
@@ -35,7 +35,7 @@ package = "https://pypi.org/project/FlaskTester/"
3535
# various dev tools
3636
dev = ["mypy", "pyright", "ruff", "coverage", "pymarkdownlnt!=0.9.5", "build", "twine", "wheel", "types-flask", "types-requests", "FlaskSimpleAuth", "passlib"]
3737
# documentation generation
38-
doc = ["sphinx", "sphinx_rtd_theme", "sphinx-autoapi", "sphinx-lint"]
38+
doc = ["sphinx", "sphinx_rtd_theme", "sphinx-autoapi", "sphinx-lint", "myst_parser"]
3939

4040
[tool.setuptools]
4141
py-modules = [ "FlaskTester" ]

0 commit comments

Comments
 (0)