Skip to content

Commit ace6a42

Browse files
authored
Initial sphinx documentation (#1)
* Add documentation * Update README.md * Fix .gitignore for docs * Fixes for Windows
1 parent c89856c commit ace6a42

File tree

8 files changed

+221
-1
lines changed

8 files changed

+221
-1
lines changed

CONTRIBUTING.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Contributing
2+
3+
## Documentation
4+
5+
### Conda environment for documentation
6+
7+
Install miniconda first.
8+
9+
```bash
10+
conda env create -f environment.yml
11+
conda activate docs
12+
```
13+
14+
### Generating documentation
15+
16+
Install Sphinx and plugins:
17+
```bash
18+
pip install sphinx autodoc recommonmark sphinx-rtd-theme
19+
```
20+
21+
Generate HTML:
22+
```bash
23+
cd docs
24+
make html
25+
```
26+
27+
Run HTTP server:
28+
```bash
29+
cd docs/_build/html
30+
python -m http.server 8000
31+
```
32+
33+
Don't forget to change the version in `docs/conf.py` before generating.
34+
```python
35+
release = "<VERSION>"
36+
```
37+
38+
Generated documentation will be in `docs/_build/html`.
39+
40+
### Uploading to GitHub Pages
41+
42+
Documentation for GitHub Pages is placed in following branch
43+
[`gh-pages`](https://github.com/IntelPython/numba-dppy/tree/gh-pages).
44+
45+
Folders:
46+
- `dev` folder contains current documentation for default branch.
47+
- `0.12.0` folder and other similar folders contain documentation for releases.
48+
- `latest` folder is a link to the latest release folder.
49+
50+
Copy generated documentation into corresponding folder and create pull request
51+
to `gh-pages` branch.

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
# DPPY
1+
# DPPY
2+
3+
## Contributing
4+
5+
For contributing to this repository see [CONTRIBUTING.md](CONTRIBUTING.md).

docs/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_build

docs/Makefile

Lines changed: 20 additions & 0 deletions
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/conf.py

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# This file only contains a selection of the most common options. For a full
4+
# list see the documentation:
5+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
6+
7+
# -- Path setup --------------------------------------------------------------
8+
9+
# If extensions (or modules to document with autodoc) are in another directory,
10+
# add these directories to sys.path here. If the directory is relative to the
11+
# documentation root, use os.path.abspath to make it absolute, like shown here.
12+
#
13+
# import os
14+
# import sys
15+
# sys.path.insert(0, os.path.abspath('.'))
16+
17+
import sphinx_rtd_theme
18+
19+
# -- Project information -----------------------------------------------------
20+
21+
project = "DPPY"
22+
copyright = "2021, Intel"
23+
author = "Intel"
24+
25+
# The full version, including alpha/beta/rc tags
26+
release = "0.0.1"
27+
28+
29+
# -- General configuration ---------------------------------------------------
30+
31+
# Add any Sphinx extension module names here, as strings. They can be
32+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
33+
# ones.
34+
extensions = [
35+
"recommonmark",
36+
"sphinx_rtd_theme",
37+
"sphinx.ext.autodoc",
38+
"sphinx.ext.todo",
39+
]
40+
41+
todo_include_todos = True
42+
43+
source_parsers = {".md": "recommonmark.parser.CommonMarkParser"}
44+
45+
# Add any paths that contain templates here, relative to this directory.
46+
templates_path = ["_templates"]
47+
48+
# List of patterns, relative to source directory, that match files and
49+
# directories to ignore when looking for source files.
50+
# This pattern also affects html_static_path and html_extra_path.
51+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
52+
53+
54+
# -- Options for HTML output -------------------------------------------------
55+
56+
# The theme to use for HTML and HTML Help pages. See the documentation for
57+
# a list of builtin themes.
58+
#
59+
html_theme = "sphinx_rtd_theme"
60+
61+
# Add any paths that contain custom static files (such as style sheets) here,
62+
# relative to this directory. They are copied after the builtin static files,
63+
# so a file named "default.css" will overwrite the builtin "default.css".
64+
# html_static_path = ["_static"]

docs/index.rst

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
.. documentation master file, created by
2+
sphinx-quickstart.
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 DPPY documentation!
7+
======================================
8+
9+
...
10+
11+
About
12+
=====
13+
14+
...
15+
16+
License
17+
=======
18+
19+
...
20+
21+
Indices and tables
22+
==================
23+
24+
.. only:: builder_html
25+
26+
* :ref:`genindex`
27+
* :ref:`modindex`
28+
* :ref:`search`
29+
30+
.. only:: not builder_html
31+
32+
* :ref:`modindex`
33+
34+
.. |reg| unicode:: U+000AE .. REGISTERED SIGN

docs/make.bat

Lines changed: 35 additions & 0 deletions
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

environment.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: docs
2+
channels:
3+
- defaults
4+
dependencies:
5+
- python=3.9
6+
- pip
7+
- pip:
8+
- sphinx
9+
- autodoc
10+
- recommonmark
11+
- sphinx-rtd-theme

0 commit comments

Comments
 (0)