Skip to content

Commit d0a4bc4

Browse files
authored
Move docs to readthedocs (#797)
* update config for readthedocs * remove sphinx-multiversion config * Clean up config files * Update gitignore * update build files
1 parent 950ca44 commit d0a4bc4

File tree

8 files changed

+64
-114
lines changed

8 files changed

+64
-114
lines changed

.github/workflows/docs-publish.yml

-32
This file was deleted.

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ share/python-wheels/
2727
*.egg
2828
MANIFEST
2929
xrspatial/.version
30+
xrspatial/_version.py
3031

3132
# PyInstaller
3233
# Usually these files are written by a python script from a template

.readthedocs.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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+
# Set the OS, Python version and other tools you might need
9+
build:
10+
os: ubuntu-22.04
11+
tools:
12+
python: "3.12"
13+
14+
# Build documentation in the "docs/" directory with Sphinx
15+
sphinx:
16+
configuration: docs/source/conf.py
17+
18+
# Optional but recommended, declare the Python requirements required
19+
# to build your documentation
20+
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
21+
python:
22+
install:
23+
- method: pip
24+
path: .
25+
extra_requirements:
26+
- [docs, tests]

docs/Makefile

+12-16
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,20 @@
1-
# Makefile for Sphinx documentation
1+
# Minimal makefile for Sphinx documentation
2+
#
23

3-
# You can set these variables from the command line.
4-
SPHINXOPTS =
5-
SPHINXBUILD = python -m sphinx
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
68
SOURCEDIR = source
79
BUILDDIR = build
810

9-
.PHONY: help clean html
10-
11+
# Put it first so that "make" without argument is like "make help".
1112
help:
12-
@echo "Please use 'make <target>' where <target> is one of"
13-
@echo " clean to clear all built documentation files"
14-
@echo " html to make all standalone HTML files"
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
1514

16-
clean:
17-
-rm -rf $(BUILDDIR)/*
15+
.PHONY: help Makefile
1816

19-
html: clean
20-
( THEME=sphinx_rtd_theme sphinx-multiversion $(SOURCEDIR) $(BUILDDIR)/html )
21-
( THEME=pydata_sphinx_theme sphinx-multiversion $(SOURCEDIR) $(BUILDDIR)/html )
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+
%: Makefile
2220
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
23-
@echo
24-
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."

docs/make.bat

+17-25
Original file line numberDiff line numberDiff line change
@@ -10,34 +10,26 @@ if "%SPHINXBUILD%" == "" (
1010
set SOURCEDIR=source
1111
set BUILDDIR=build
1212

13-
if "%1" == "" goto help
14-
15-
if "%1" == "help" (
16-
:help
17-
echo.Please use `make ^<target^>` where ^<target^> is one of
18-
echo. clean to clear all built documentation files
19-
echo. html to make all standalone HTML files
20-
21-
goto end
22-
)
23-
24-
if "%1" == "clean" (
25-
rmdir %BUILDDIR% /s /q
26-
goto end
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
2724
)
2825

29-
if "%1" == "html" (
30-
set THEME=sphinx_rtd_theme
31-
sphinx-multiversion %SOURCEDIR% %BUILDDIR%\html
26+
if "%1" == "" goto help
3227

33-
set THEME=pydata_sphinx_theme
34-
sphinx-multiversion %SOURCEDIR% %BUILDDIR%\html
35-
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29+
goto end
3630

37-
if errorlevel 1 exit /b 1
38-
echo.
39-
echo.Build finished. The HTML pages are in %BUILDDIR%/html.
40-
goto end
41-
)
31+
:help
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
4233

4334
:end
35+
popd

docs/source/conf.py

+7-19
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
# -- Path setup --------------------------------------------------------------
1010

11+
from datetime import datetime
1112
import json
1213
# If extensions (or modules to document with autodoc) are in another directory,
1314
# add these directories to sys.path here. If the directory is relative to the
@@ -23,7 +24,7 @@
2324
# -- Project information -----------------------------------------------------
2425

2526
project = u'xarray_spatial'
26-
copyright = u'2020-2022, makepath'
27+
copyright = u'2020-{}, makepath'.format(datetime.now().year)
2728
author = u'makepath'
2829

2930
version = release = xrspatial.__version__
@@ -66,7 +67,7 @@
6667
#
6768
# This is also used if you do content translation via gettext catalogs.
6869
# Usually you set "language" from the command line for these cases.
69-
language = None
70+
language = 'en'
7071

7172
# List of patterns, relative to source directory, that match files and
7273
# directories to ignore when looking for source files.
@@ -82,38 +83,26 @@
8283
# The theme to use for HTML and HTML Help pages. See the documentation for
8384
# a list of builtin themes.
8485
#
85-
if os.getenv('THEME') == 'sphinx_rtd_theme':
86-
html_theme = 'sphinx_rtd_theme'
87-
else:
88-
html_theme = 'pydata_sphinx_theme'
86+
87+
html_theme = 'pydata_sphinx_theme'
8988

9089
html_logo = '_static/img/Xarray-Spatial-logo.svg'
9190

9291
html_favicon = '_static/img/favicon.ico'
9392

94-
# sphinx-multiversion config
95-
smv_branch_whitelist = 'master'
96-
if os.getenv('THEME') == 'sphinx_rtd_theme':
97-
smv_tag_whitelist = r'^v([0-9]\.[2-9]\.[0-9])'
98-
else:
99-
smv_tag_whitelist = r'^v([0-9]\.[2-9]\.[0-9])'
100-
101-
# Load releases
102-
with open("releases.json") as f:
103-
releases = json.load(f)
104-
10593
# Theme options are theme-specific and customize the look and feel of a theme
10694
# further. For a list of options available for each theme, see the
10795
# documentation.
10896
#
10997
html_theme_options = {
11098
"external_links": [],
11199
"github_url": "https://github.com/makepath/xarray-spatial",
100+
"navbar_end": ["navbar-icon-links"],
112101
}
113102

114103
html_context = {
115104
'css_files': ['_static/css/styles.css'],
116-
'releases': [(release, url) for release, url in releases.items()],
105+
"default_mode": "light",
117106
}
118107

119108
autosummary_generate = True
@@ -133,7 +122,6 @@
133122
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
134123
# 'searchbox.html']``.
135124
#
136-
# html_sidebars = {}
137125

138126

139127
# -- Options for HTMLHelp output ---------------------------------------------

docs/source/releases.json

-21
This file was deleted.

setup.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ console_scripts =
3434

3535
[options.extras_require]
3636
doc =
37+
dask[dataframe]
3738
geopandas
3839
Jinja2 >=2.11
3940
ipykernel
@@ -43,7 +44,6 @@ doc =
4344
pandoc
4445
pydata_sphinx_theme
4546
sphinx
46-
sphinx-multiversion
4747
sphinx-panels
4848
sphinx_rtd_theme
4949
examples =

0 commit comments

Comments
 (0)