Skip to content

Commit

Permalink
Include sphinx packages in CI deps
Browse files Browse the repository at this point in the history
  • Loading branch information
swrichards committed Dec 19, 2024
1 parent 2b43f3b commit d5d0f83
Show file tree
Hide file tree
Showing 9 changed files with 211 additions and 17 deletions.
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# 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)
17 changes: 17 additions & 0 deletions docs/check_sphinx.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import subprocess


def test_linkcheck(tmpdir):
doctrees = tmpdir.join("doctrees")
htmldir = tmpdir.join("html")
subprocess.check_call(
["sphinx-build", "-W", "-blinkcheck", "-d", str(doctrees), ".", str(htmldir)],
)


def test_build_docs(tmpdir):
doctrees = tmpdir.join("doctrees")
htmldir = tmpdir.join("html")
subprocess.check_call(
["sphinx-build", "-W", "-bhtml", "-d", str(doctrees), ".", str(htmldir)],
)
90 changes: 90 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Path setup --------------------------------------------------------------
import os
import sys

sys.path.insert(0, os.path.abspath("../src"))

import objects # noqa isort:skip

# from objects.setup import setup_env # noqa isort:skip

# TODO: This needs to be enabled when we want to use autodoc to grab
# documentation from classes and functions. However, enabling django.setup()
# causes RTD to fail because GDAL is not present in the RTD environment.
# See: https://github.com/readthedocs/readthedocs-docker-images/issues/114#issuecomment-570566599
#
# setup_env()
# django.setup()

# -- Project information -----------------------------------------------------

project = "Objects and Objecttypes API"
copyright = "2020, Maykin Media"
author = objects.__author__

# The full version, including alpha/beta/rc tags
release = objects.__version__


# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
"sphinx.ext.todo",
"sphinx_tabs.tabs",
"recommonmark",
# "sphinx_markdown_tables",
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = "en"

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

source_suffix = [".rst", ".md"]

# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_logo = "logo.png"
html_theme = "sphinx_rtd_theme"

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["_static"]
html_css_files = [
"theme_overrides.css", # override wide tables with word wrap
]

todo_include_todos = True

linkcheck_timeout = 10
linkcheck_ignore = [
r"https?://.*\.gemeente.nl",
r"http://localhost:\d+/",
r"https://.*sentry.*",
"https://github.com/maykinmedia/objects-api-performance",
"https://objects.municipality.nl/admin/",
"https://sparxsystems.com/products/ea/trial/request.html", # this raises 403 for crawlers probably?
]
2 changes: 2 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Documentation
=============
35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=.
set BUILDDIR=_build

if "%1" == "" goto help

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
10 changes: 3 additions & 7 deletions requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.11
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile --no-emit-index-url requirements/base.in
Expand Down Expand Up @@ -195,9 +195,7 @@ drf-nested-routers==0.94.1
# -r requirements/base.in
# commonground-api-common
drf-spectacular[sidecar]==0.27.2
# via
# drf-spectacular
# open-api-framework
# via open-api-framework
drf-spectacular-sidecar==2024.7.1
# via drf-spectacular
drf-yasg==1.21.7
Expand Down Expand Up @@ -277,9 +275,7 @@ pydantic==2.9.2
pydantic-core==2.23.4
# via pydantic
pydantic-settings[yaml]==2.6.1
# via
# django-setup-configuration
# pydantic-settings
# via django-setup-configuration
pyjwt==2.7.0
# via
# commonground-api-common
Expand Down
4 changes: 4 additions & 0 deletions requirements/ci.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
codecov
coverage

# Documentation
sphinx
sphinx_rtd_theme
44 changes: 39 additions & 5 deletions requirements/ci.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#
# This file is autogenerated by pip-compile with Python 3.11
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile --no-emit-index-url --output-file=requirements/ci.txt requirements/base.txt requirements/ci.in requirements/test-tools.in
#
alabaster==1.0.0
# via sphinx
amqp==5.1.1
# via
# -r requirements/base.txt
Expand Down Expand Up @@ -33,6 +35,8 @@ attrs==23.1.0
# -r requirements/base.txt
# glom
# jsonschema
babel==2.16.0
# via sphinx
beautifulsoup4==4.12.2
# via webtest
billiard==4.2.0
Expand Down Expand Up @@ -262,7 +266,6 @@ django-solo==2.0.0
django-two-factor-auth[phonenumberslite,webauthn]==1.16.0
# via
# -r requirements/base.txt
# django-two-factor-auth
# maykin-2fa
django-webtest==1.9.10
# via -r requirements/test-tools.in
Expand Down Expand Up @@ -290,14 +293,17 @@ djangorestframework-inclusions==1.2.0
# via
# -r requirements/base.txt
# open-api-framework
docutils==0.21.2
# via
# sphinx
# sphinx-rtd-theme
drf-nested-routers==0.94.1
# via
# -r requirements/base.txt
# commonground-api-common
drf-spectacular[sidecar]==0.27.2
# via
# -r requirements/base.txt
# drf-spectacular
# open-api-framework
drf-spectacular-sidecar==2024.7.1
# via
Expand Down Expand Up @@ -348,6 +354,8 @@ idna==3.7
# -r requirements/base.txt
# requests
# yarl
imagesize==1.4.1
# via sphinx
inflection==0.5.1
# via
# -r requirements/base.txt
Expand All @@ -371,6 +379,7 @@ jinja2==3.1.4
# via
# -r requirements/base.txt
# coreschema
# sphinx
josepy==1.13.0
# via
# -r requirements/base.txt
Expand Down Expand Up @@ -402,7 +411,6 @@ mozilla-django-oidc==4.0.0
mozilla-django-oidc-db[django-setup-configuration]==0.21.1
# via
# -r requirements/base.txt
# mozilla-django-oidc-db
# open-api-framework
multidict==6.0.5
# via yarl
Expand All @@ -427,6 +435,7 @@ packaging==23.1
# -r requirements/base.txt
# black
# drf-yasg
# sphinx
pathspec==0.12.1
# via black
phonenumberslite==8.13.30
Expand Down Expand Up @@ -466,9 +475,10 @@ pydantic-settings[yaml]==2.6.1
# via
# -r requirements/base.txt
# django-setup-configuration
# pydantic-settings
pyflakes==3.2.0
# via flake8
pygments==2.18.0
# via sphinx
pyjwt==2.7.0
# via
# -r requirements/base.txt
Expand Down Expand Up @@ -534,6 +544,7 @@ requests==2.32.3
# open-api-framework
# requests-mock
# sharing-configs
# sphinx
# zgw-consumers
requests-mock==1.12.1
# via
Expand All @@ -556,8 +567,31 @@ six==1.16.0
# orderedmultidict
# python-dateutil
# qrcode
snowballstemmer==2.2.0
# via sphinx
soupsieve==2.4.1
# via beautifulsoup4
sphinx==8.1.3
# via
# -r requirements/ci.in
# sphinx-rtd-theme
# sphinxcontrib-jquery
sphinx-rtd-theme==3.0.2
# via -r requirements/ci.in
sphinxcontrib-applehelp==2.0.0
# via sphinx
sphinxcontrib-devhelp==2.0.0
# via sphinx
sphinxcontrib-htmlhelp==2.1.0
# via sphinx
sphinxcontrib-jquery==4.1
# via sphinx-rtd-theme
sphinxcontrib-jsmath==1.0.1
# via sphinx
sphinxcontrib-qthelp==2.0.0
# via sphinx
sphinxcontrib-serializinghtml==2.0.0
# via sphinx
sqlparse==0.5.0
# via
# -r requirements/base.txt
Expand Down
6 changes: 1 addition & 5 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.11
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile --no-emit-index-url --output-file=requirements/dev.txt requirements/base.txt requirements/dev.in requirements/test-tools.in
Expand Down Expand Up @@ -273,7 +273,6 @@ django-solo==2.0.0
django-two-factor-auth[phonenumberslite,webauthn]==1.16.0
# via
# -r requirements/base.txt
# django-two-factor-auth
# maykin-2fa
django-webtest==1.9.10
# via -r requirements/test-tools.in
Expand Down Expand Up @@ -312,7 +311,6 @@ drf-nested-routers==0.94.1
drf-spectacular[sidecar]==0.27.2
# via
# -r requirements/base.txt
# drf-spectacular
# open-api-framework
drf-spectacular-sidecar==2024.7.1
# via
Expand Down Expand Up @@ -420,7 +418,6 @@ mozilla-django-oidc==4.0.0
mozilla-django-oidc-db[django-setup-configuration]==0.21.1
# via
# -r requirements/base.txt
# mozilla-django-oidc-db
# open-api-framework
multidict==6.0.5
# via yarl
Expand Down Expand Up @@ -488,7 +485,6 @@ pydantic-settings[yaml]==2.6.1
# via
# -r requirements/base.txt
# django-setup-configuration
# pydantic-settings
pyflakes==3.0.1
# via flake8
pygments==2.15.1
Expand Down

0 comments on commit d5d0f83

Please sign in to comment.