Skip to content

Commit 24ed229

Browse files
committed
initial documentation copied from example-sphinx-basic.readthedocs.io
1 parent e2e019d commit 24ed229

13 files changed

+503
-10
lines changed

.gitignore

+137-10
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,146 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# auto-generated Sphinx api docs
10+
/docs/generated
11+
12+
# Distribution / packaging
13+
.Python
14+
build/
15+
develop-eggs/
16+
dist/
17+
downloads/
18+
eggs/
19+
.eggs/
20+
lib/
21+
lib64/
22+
parts/
23+
sdist/
24+
var/
25+
wheels/
26+
pip-wheel-metadata/
27+
share/python-wheels/
28+
*.egg-info/
29+
.installed.cfg
30+
*.egg
31+
MANIFEST
32+
33+
# PyInstaller
34+
# Usually these files are written by a python script from a template
35+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
36+
*.manifest
37+
*.spec
38+
39+
# Installer logs
40+
pip-log.txt
41+
pip-delete-this-directory.txt
42+
43+
# Unit test / coverage reports
44+
htmlcov/
45+
.tox/
46+
.nox/
47+
.coverage
48+
.coverage.*
49+
.cache
50+
nosetests.xml
51+
coverage.xml
52+
*.cover
53+
*.py,cover
54+
.hypothesis/
55+
.pytest_cache/
56+
57+
# Translations
58+
*.mo
59+
*.pot
60+
61+
# Django stuff:
62+
*.log
63+
local_settings.py
64+
db.sqlite3
65+
db.sqlite3-journal
66+
67+
# Flask stuff:
68+
instance/
69+
.webassets-cache
70+
71+
# Scrapy stuff:
72+
.scrapy
73+
74+
# Sphinx documentation
75+
docs/_build/
76+
77+
# PyBuilder
78+
target/
79+
80+
# Jupyter Notebook
181
.ipynb_checkpoints
2-
outputs
3-
wip_notebooks
4-
notes
5-
build
6-
__pycache__
7-
vid_old
8-
src/accessvis/data
9-
src/accessvis.egg-info
1082

83+
# IPython
84+
profile_default/
85+
ipython_config.py
86+
87+
# pyenv
88+
.python-version
89+
90+
# pipenv
91+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
93+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
94+
# install all needed dependencies.
95+
#Pipfile.lock
96+
97+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
98+
__pypackages__/
99+
100+
# Celery stuff
101+
celerybeat-schedule
102+
celerybeat.pid
103+
104+
# SageMath parsed files
105+
*.sage.py
106+
107+
# Environments
108+
.env
109+
.venv
110+
env/
11111
venv/
12112
ENV/
13-
.venv/
14-
.env
113+
env.bak/
114+
venv.bak/
115+
116+
117+
# Spyder project settings
118+
.spyderproject
119+
.spyproject
120+
121+
# pycharm
15122
.idea
16123

124+
# Rope project settings
125+
.ropeproject
126+
127+
# mkdocs documentation
128+
/site
129+
130+
# mypy
131+
.mypy_cache/
132+
.dmypy.json
133+
dmypy.json
134+
135+
# Pyre type checker
136+
.pyre/
137+
138+
# access-vis specific
139+
outputs
140+
wip_notebooks
141+
notes
142+
vid_old
143+
src/accessvis/data
17144
*.png
18145
*.jpg
19146
*.jpeg

.readthedocs.yaml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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 version of Python and other tools you might need
9+
build:
10+
os: ubuntu-22.04
11+
tools:
12+
python: "3.10"
13+
# You can also specify other tool versions:
14+
# nodejs: "16"
15+
# rust: "1.55"
16+
# golang: "1.17"
17+
18+
# Build documentation in the docs/ directory with Sphinx
19+
sphinx:
20+
configuration: docs/conf.py
21+
22+
# If using Sphinx, optionally build your docs in additional formats such as PDF
23+
# formats:
24+
# - pdf
25+
26+
# Optionally declare the Python requirements required to build your docs
27+
python:
28+
install:
29+
- requirements: docs/requirements.txt
30+
- method: pip
31+
path: .

README.rst

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
Example: Basic Sphinx project for Read the Docs
2+
===============================================
3+
4+
.. image:: https://readthedocs.org/projects/example-sphinx-basic/badge/?version=latest
5+
:target: https://example-sphinx-basic.readthedocs.io/en/latest/?badge=latest
6+
:alt: Documentation Status
7+
8+
.. This README.rst should work on Github and is also included in the Sphinx documentation project in docs/ - therefore, README.rst uses absolute links for most things so it renders properly on GitHub
9+
10+
This example shows a basic Sphinx project with Read the Docs. You're encouraged to view it to get inspiration and copy & paste from the files in the source code. If you are using Read the Docs for the first time, have a look at the official `Read the Docs Tutorial <https://docs.readthedocs.io/en/stable/tutorial/index.html>`__.
11+
12+
📚 `docs/ <https://github.com/readthedocs-examples/example-sphinx-basic/blob/main/docs/>`_
13+
A basic Sphinx project lives in ``docs/``. All the ``*.rst`` make up sections in the documentation.
14+
⚙️ `.readthedocs.yaml <https://github.com/readthedocs-examples/example-sphinx-basic/blob/main/.readthedocs.yaml>`_
15+
Read the Docs Build configuration is stored in ``.readthedocs.yaml``.
16+
⚙️ `docs/conf.py <https://github.com/readthedocs-examples/example-sphinx-basic/blob/main/docs/conf.py>`_
17+
Both the configuration and the folder layout follow Sphinx default conventions. You can change the `Sphinx configuration values <https://www.sphinx-doc.org/en/master/usage/configuration.html>`_ in this file
18+
📍 `docs/requirements.txt <https://github.com/readthedocs-examples/example-sphinx-basic/blob/main/docs/requirements.txt>`_ and `docs/requirements.in <https://github.com/readthedocs-examples/example-sphinx-basic/blob/main/docs/requirements.in>`_
19+
Python dependencies are `pinned <https://docs.readthedocs.io/en/latest/guides/reproducible-builds.html>`_ (uses `pip-tools <https://pip-tools.readthedocs.io/en/latest/>`_). Make sure to add your Python dependencies to ``requirements.txt`` or if you choose `pip-tools <https://pip-tools.readthedocs.io/en/latest/>`_, edit ``docs/requirements.in`` and remember to run ``pip-compile docs/requirements.in``.
20+
💡 `docs/api.rst <https://github.com/readthedocs-examples/example-sphinx-basic/blob/main/docs/api.rst>`_
21+
By adding our example Python module ``lumache`` in the reStructuredText directive ``:autosummary:``, Sphinx will automatically scan this module and generate API docs.
22+
💡 `docs/usage.rst <https://github.com/readthedocs-examples/example-sphinx-basic/blob/main/docs/usage.rst>`_
23+
Sphinx can automatically extract API documentation directly from Python modules, using for instance the ``:autofunction:`` directive.
24+
💡 `lumache.py <https://github.com/readthedocs-examples/example-sphinx-basic/blob/main/lumache.py>`_
25+
API docs are generated for this example Python module - they use *docstrings* directly in the documentation, notice how this shows up in the rendered documentation.
26+
🔢 Git tags versioning
27+
We use a basic versioning mechanism by adding a git tag for every release of the example project. All releases and their version numbers are visible on `example-sphinx-basic.readthedocs.io <https://example-sphinx-basic.readthedocs.io/en/latest/>`__.
28+
📜 `README.rst <https://github.com/readthedocs-examples/example-sphinx-basic/blob/main/README.rst>`_
29+
Contents of this ``README.rst`` are visible on Github and included on `the documentation index page <https://example-sphinx-basic.readthedocs.io/en/latest/>`_ (Don't Repeat Yourself).
30+
⁉️ Questions / comments
31+
If you have questions related to this example, feel free to can ask them as a Github issue `here <https://github.com/readthedocs-examples/example-sphinx-basic/issues>`_.
32+
33+
34+
Example Project usage
35+
---------------------
36+
37+
This project has a standard Sphinx layout which is built by Read the Docs almost the same way that you would build it locally (on your own laptop!).
38+
39+
You can build and view this documentation project locally - we recommend that you activate `a local Python virtual environment first <https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/#creating-a-virtual-environment>`_:
40+
41+
.. code-block:: console
42+
43+
# Install required Python dependencies (Sphinx etc.)
44+
pip install -r docs/requirements.txt
45+
46+
# Enter the Sphinx project
47+
cd docs/
48+
49+
# Run the raw sphinx-build command
50+
sphinx-build -M html . _build/
51+
52+
53+
You can also build the documentation locally with ``make``:
54+
55+
.. code-block:: console
56+
57+
# Enter the Sphinx project
58+
cd docs/
59+
60+
# Build with make
61+
make html
62+
63+
# Open with your preferred browser, pointing it to the documentation index page
64+
firefox _build/html/index.html
65+
66+
67+
Using the example in your own project
68+
-------------------------------------
69+
70+
If you are new to Read the Docs, you may want to refer to the `Read the Docs User documentation <https://docs.readthedocs.io/>`_.
71+
72+
If you are copying this code in order to get started with your documentation, you need to:
73+
74+
#. place your ``docs/`` folder alongside your Python project. If you are starting a new project, you can adapt the `pyproject.toml` example configuration.
75+
#. use your existing project repository or create a new repository on Github, GitLab, Bitbucket or another host supported by Read the Docs
76+
#. copy ``.readthedocs.yaml`` and the ``docs/`` folder into your project.
77+
#. customize all the files, replacing example contents.
78+
#. add your own Python project, replacing the ``pyproject.toml`` configuration and ``lumache.py`` module.
79+
#. rebuild the documenation locally to see that it works.
80+
#. *finally*, register your project on Read the Docs, see `Importing Your Documentation <https://docs.readthedocs.io/en/stable/intro/import-guide.html>`_.
81+
82+
83+
Read the Docs tutorial
84+
----------------------
85+
86+
To get started with Read the Docs, you may also refer to the `Read the Docs tutorial <https://docs.readthedocs.io/en/stable/tutorial/>`__.
87+
It provides a full walk-through of building an example project similar to the one in this repository.

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/api.rst

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
API
2+
===
3+
4+
.. autosummary::
5+
:toctree: generated
6+
7+
earth
8+
utils
9+
10+
11+
12+

docs/conf.py

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
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+
18+
# -- Project information -----------------------------------------------------
19+
20+
project = "Basic Sphinx Example Project"
21+
copyright = "2022, Read the Docs core team"
22+
author = "Read the Docs core team"
23+
24+
25+
# -- General configuration ---------------------------------------------------
26+
# -- General configuration
27+
28+
extensions = [
29+
"sphinx.ext.duration",
30+
"sphinx.ext.doctest",
31+
"sphinx.ext.autodoc",
32+
"sphinx.ext.autosummary",
33+
"sphinx.ext.intersphinx",
34+
]
35+
36+
intersphinx_mapping = {
37+
"rtd": ("https://docs.readthedocs.io/en/stable/", None),
38+
"python": ("https://docs.python.org/3/", None),
39+
"sphinx": ("https://www.sphinx-doc.org/en/master/", None),
40+
}
41+
intersphinx_disabled_domains = ["std"]
42+
43+
templates_path = ["_templates"]
44+
45+
# -- Options for EPUB output
46+
epub_show_urls = "footnote"
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+
# -- Options for HTML output -------------------------------------------------
54+
55+
# The theme to use for HTML and HTML Help pages. See the documentation for
56+
# a list of builtin themes.
57+
#
58+
html_theme = "sphinx_rtd_theme"
59+
60+
# Add any paths that contain custom static files (such as style sheets) here,
61+
# relative to this directory. They are copied after the builtin static files,
62+
# so a file named "default.css" will overwrite the builtin "default.css".
63+
html_static_path = ["static"]

0 commit comments

Comments
 (0)