Skip to content

Commit 00773b1

Browse files
committed
Implement docs (PRAW copy)
1 parent b119f5f commit 00773b1

8 files changed

+156
-0
lines changed

docs/Makefile

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = .
9+
BUILDDIR = _build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
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+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/_static/theme_override.css

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/* Table text wrapping CSS fix from
2+
https://rackerlabs.github.io/docs-rackspace/tools/rtd-tables.html */
3+
4+
/* override table width restrictions */
5+
@media screen and (min-width: 767px) {
6+
7+
.wy-table-responsive table td {
8+
/* !important prevents the common CSS stylesheets from overriding
9+
this as on RTD they are loaded after this stylesheet */
10+
white-space: normal !important;
11+
}
12+
13+
.wy-table-responsive {
14+
overflow: visible !important;
15+
}
16+
}
17+
18+
table.center-table-items, table.center-table-items th { text-align: center; }

docs/conf.py

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import os
2+
import sys
3+
4+
# Do not touch these. They allow the use of the local PRAWdittions.
5+
sys.path.insert(0, ".")
6+
sys.path.insert(1, "..")
7+
8+
from prawdditions import __version__
9+
10+
11+
copyright = "2020, PokestarFan"
12+
exclude_patterns = ["_build"]
13+
extensions = ["sphinx.ext.autodoc", "sphinx.ext.intersphinx"]
14+
html_static_path = ["_static"]
15+
html_theme = "sphinx_rtd_theme"
16+
html_theme_options = {"collapse_navigation": True}
17+
htmlhelp_basename = "PRAWdittions"
18+
intersphinx_mapping = {"python": ("https://docs.python.org/3.8", None)}
19+
master_doc = "index"
20+
nitpicky = True
21+
project = "PRAWdittions"
22+
pygments_style = "sphinx"
23+
release = __version__
24+
source_suffix = ".rst"
25+
suppress_warnings = ["image.nonlocal_uri"]
26+
version = ".".join(__version__.split(".", 2)[:2])
27+
28+
29+
# Use RTD theme locally
30+
if not os.environ.get("READTHEDOCS"):
31+
import sphinx_rtd_theme
32+
33+
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
34+
35+
36+
def skip(app, what, name, obj, skip, options):
37+
if name in {
38+
"__call__",
39+
"__contains__",
40+
"__getitem__",
41+
"__init__",
42+
"__iter__",
43+
"__len__",
44+
}:
45+
return False
46+
return skip
47+
48+
49+
def setup(app):
50+
app.connect("autodoc-skip-member", skip)
51+
app.add_stylesheet("theme_override.css")

docs/docutils.conf

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[parsers]
2+
smart_quotes: true

docs/generate_local_docs.bat

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
RMDIR /s /q _build
2+
make html

docs/index.rst

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
2+
3+
PRAWdittions
4+
============
5+
6+
PRAWdittions is a high-end library wrapper for PRAW that provides several
7+
functions that are missing from the main package. The only dependency is PRAW.
8+
9+
.. toctree::
10+
:maxdepth: 2
11+
:caption: Contents:
12+
13+
14+
15+
References
16+
==========
17+
18+
* :ref:`genindex`
19+
* :ref:`search`

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=.
11+
set BUILDDIR=_build
12+
13+
if "%1" == "" goto help
14+
15+
%SPHINXBUILD% >NUL 2>NUL
16+
if errorlevel 9009 (
17+
echo.
18+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
19+
echo.installed, then set the SPHINXBUILD environment variable to point
20+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
21+
echo.may add the Sphinx directory to PATH.
22+
echo.
23+
echo.If you don't have Sphinx installed, grab it from
24+
echo.http://sphinx-doc.org/
25+
exit /b 1
26+
)
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

pre_push.py

+9
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
import argparse
55
import sys
66
from os import path
7+
from shutil import rmtree
78
from subprocess import CalledProcessError, check_call
9+
from tempfile import mkdtemp
810

911
current_directory = path.abspath(path.join(__file__, ".."))
1012

@@ -40,6 +42,13 @@ def run_static():
4042
success &= do_process(["black", "."])
4143
success &= do_process(["flake8", "--exclude=.eggs,build,docs"])
4244
success &= do_process(["pydocstyle", "prawdditions"])
45+
tmp_dir = mkdtemp()
46+
try:
47+
success &= do_process(
48+
["sphinx-build", "-W", "--keep-going", "docs", tmp_dir]
49+
)
50+
finally:
51+
rmtree(tmp_dir)
4352
return success
4453

4554

0 commit comments

Comments
 (0)