-
Notifications
You must be signed in to change notification settings - Fork 124
Initial structure for documentation project #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 8 commits
c02d5f0
be25ff3
9518189
1967ce7
3ca4fac
bf24b0d
ae73375
152ffef
49aca7e
321266f
d2ce2da
9bdd190
423d608
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# .readthedocs.yaml | ||
# Read the Docs configuration file | ||
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details | ||
|
||
# Required | ||
version: 2 | ||
|
||
# Set the version of Python and other tools you might need | ||
build: | ||
os: ubuntu-22.04 | ||
tools: | ||
python: "3.10" | ||
# You can also specify other tool versions: | ||
# nodejs: "16" | ||
# rust: "1.55" | ||
# golang: "1.17" | ||
|
||
# Build documentation in the docs/ directory with Sphinx | ||
sphinx: | ||
configuration: docs/conf.py | ||
|
||
# If using Sphinx, optionally build your docs in additional formats such as PDF | ||
# formats: | ||
|
||
# Optionally declare the Python requirements required to build your docs | ||
python: | ||
install: | ||
- requirements: docs/requirements.txt | ||
- method: pip | ||
path: . |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
Example: Basic Sphinx project for Read the Docs | ||
=============================================== | ||
|
||
This example shows the an integration of 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>`_. | ||
|
||
📚 `docs/ <https://github.com/readthedocs-examples/example-sphinx-basic/blob/main/docs/>`_ | ||
A basic Sphinx project lives in ``docs/``, it was generated using Sphinx defaults | ||
benjaoming marked this conversation as resolved.
Show resolved
Hide resolved
|
||
⚙️ `.readthedocs.yaml <https://github.com/readthedocs-examples/example-sphinx-basic/blob/main/.readthedocs.yaml>`_ | ||
Read the Docs Build configuration is stored in ``.readthedocs.yaml`` (configuration-as-code) | ||
benjaoming marked this conversation as resolved.
Show resolved
Hide resolved
|
||
📍 `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>`_ | ||
Python dependencies are `pinned <https://docs.readthedocs.io/en/latest/guides/reproducible-builds.html>`_ (uses `pip-tools <https://pip-tools.readthedocs.io/en/latest/>`_) | ||
💡 `docs/api.rst <https://github.com/readthedocs-examples/example-sphinx-basic/blob/main/docs/api.rst>`_ | ||
By listing the Python module ``lumache`` in ``autosummary``, Sphinx will automatically scan this module and generate API docs. | ||
benjaoming marked this conversation as resolved.
Show resolved
Hide resolved
|
||
💡 `docs/usage.rst <https://github.com/readthedocs-examples/example-sphinx-basic/blob/main/docs/usage.rst>`_ | ||
Sphinx can automatically extract API documentation directly from Python modules, using for instance ``autofunction``. | ||
💡 `lumache.py <https://github.com/readthedocs-examples/example-sphinx-basic/blob/main/lumache.py>`_ | ||
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. | ||
🔢 Git tags versioning | ||
A basic versioning mechanism with git tags. | ||
📜 `README.rst <https://github.com/readthedocs-examples/example-sphinx-basic/blob/main/README.rst>`_ | ||
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) | ||
⁉️ Questions / comments | ||
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>`_. | ||
|
||
benjaoming marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Sphinx Example Project usage | ||
---------------------------- | ||
|
||
This project has a very normal Sphinx layout which is built by the Read the Docs platform almost the same way that you would build it locally (on your own laptop!). | ||
benjaoming marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
You can build and view this documentation project locally - you may want to activate `a local Python virtual environment firstly <https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/#creating-a-virtual-environment>`_: | ||
benjaoming marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
.. code-block:: console | ||
|
||
# Install required Python dependencies (Sphinx etc.) | ||
pip install -r docs/requirements.txt | ||
|
||
# Enter the Sphinx project | ||
cd docs/ | ||
|
||
# Run the raw sphinx-build command | ||
sphinx-build -M html . _build/ | ||
|
||
|
||
You can also build the documentation locally with ``make``: | ||
|
||
.. code-block:: console | ||
|
||
# Enter the Sphinx project | ||
cd docs/ | ||
|
||
# Build with make | ||
make html | ||
|
||
# Open with your preferred browser, pointing it to the documentation index page | ||
firefox _build/html/index.html | ||
|
||
|
||
Using the example in your own project | ||
benjaoming marked this conversation as resolved.
Show resolved
Hide resolved
|
||
------------------------------------- | ||
|
||
If you are new to Read the Docs, you may want to refer to the `Read the Docs User documentation <https://docs.readthedocs.io/>`_. | ||
|
||
If you are copying this code in order to get started with your documentation, you need to: | ||
|
||
* Create a new repository on Github, GitLab, Bitbucket or another host supported by Read the Docs | ||
* Customize all ``docs/*.rst`` files | ||
* Add your own Python project, replacing the ``pyproject.toml`` configuration and ``lumache.py`` module. | ||
* Rebuild the documenation locally to see that it works. | ||
* Register your project on Read the Docs, see `Importing Your Documentation <https://docs.readthedocs.io/en/stable/intro/import-guide.html>`_. | ||
|
||
|
||
Read the Docs tutorial | ||
---------------------- | ||
|
||
To get started with Read the Docs, you may also refer to the `Read the Docs tutorial <https://docs.readthedocs.io/en/stable/tutorial/>`_ | ||
benjaoming marked this conversation as resolved.
Show resolved
Hide resolved
|
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) | ||
benjaoming marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
API | ||
=== | ||
|
||
.. autosummary:: | ||
:toctree: generated | ||
|
||
lumache |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# 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 -------------------------------------------------------------- | ||
|
||
# If extensions (or modules to document with autodoc) are in another directory, | ||
# add these directories to sys.path here. If the directory is relative to the | ||
# documentation root, use os.path.abspath to make it absolute, like shown here. | ||
# | ||
# import os | ||
# import sys | ||
# sys.path.insert(0, os.path.abspath('.')) | ||
|
||
|
||
# -- Project information ----------------------------------------------------- | ||
|
||
project = "Basic Sphinx Example Project" | ||
copyright = "2022, Read the Docs core team" | ||
author = "Read the Docs core team" | ||
|
||
|
||
# -- General configuration --------------------------------------------------- | ||
# -- General configuration | ||
|
||
extensions = [ | ||
"sphinx.ext.duration", | ||
"sphinx.ext.doctest", | ||
"sphinx.ext.autodoc", | ||
"sphinx.ext.autosummary", | ||
"sphinx.ext.intersphinx", | ||
] | ||
|
||
intersphinx_mapping = { | ||
"rtd": ("https://docs.readthedocs.io/en/stable/", None), | ||
"python": ("https://docs.python.org/3/", None), | ||
"sphinx": ("https://www.sphinx-doc.org/en/master/", None), | ||
} | ||
intersphinx_disabled_domains = ["std"] | ||
|
||
templates_path = ["_templates"] | ||
|
||
# -- Options for EPUB output | ||
epub_show_urls = "footnote" | ||
|
||
# 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"] | ||
|
||
# -- Options for HTML output ------------------------------------------------- | ||
|
||
# The theme to use for HTML and HTML Help pages. See the documentation for | ||
# a list of builtin themes. | ||
# | ||
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"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
.. include:: ../README.rst | ||
|
||
Welcome to Lumache's documentation! | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This feels like a really odd transition without context on the index page. Should this be on another subpage that we link to from the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I kind of agree... it's an attempt to have an example project while at the same time showing how we would document a fictive software project. So this content would normally be in the index.rst page? |
||
=================================== | ||
|
||
**Lumache** (/lu'make/) is a Python library for cooks and food lovers | ||
that creates recipes mixing random ingredients. | ||
It pulls data from the `Open Food Facts database <https://world.openfoodfacts.org/>`_ | ||
and offers a *simple* and *intuitive* API. | ||
|
||
Check out the :doc:`usage` section for further information, including | ||
how to :ref:`installation` the project. | ||
|
||
.. note:: | ||
|
||
This project is under active development. | ||
|
||
Contents | ||
-------- | ||
|
||
.. toctree:: | ||
|
||
usage | ||
api |
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 | ||
|
||
%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.https://www.sphinx-doc.org/ | ||
exit /b 1 | ||
) | ||
|
||
if "%1" == "" goto help | ||
|
||
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% | ||
goto end | ||
|
||
:help | ||
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% | ||
|
||
:end | ||
popd |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Sphinx>=5,<6 | ||
sphinx_rtd_theme |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# | ||
# This file is autogenerated by pip-compile with python 3.10 | ||
# To update, run: | ||
# | ||
# pip-compile docs/requirements.in | ||
# | ||
alabaster==0.7.12 | ||
# via sphinx | ||
babel==2.10.3 | ||
# via sphinx | ||
certifi==2022.6.15 | ||
# via requests | ||
charset-normalizer==2.1.0 | ||
# via requests | ||
docutils==0.17.1 | ||
# via | ||
# sphinx | ||
# sphinx-rtd-theme | ||
idna==3.3 | ||
# via requests | ||
imagesize==1.4.1 | ||
# via sphinx | ||
jinja2==3.1.2 | ||
# via sphinx | ||
markupsafe==2.1.1 | ||
# via jinja2 | ||
packaging==21.3 | ||
# via sphinx | ||
pygments==2.12.0 | ||
# via sphinx | ||
pyparsing==3.0.9 | ||
# via packaging | ||
pytz==2022.1 | ||
# via babel | ||
requests==2.28.1 | ||
# via sphinx | ||
snowballstemmer==2.2.0 | ||
# via sphinx | ||
sphinx==5.0.2 | ||
# via | ||
# -r docs/requirements.in | ||
# sphinx-rtd-theme | ||
sphinx-rtd-theme==1.0.0 | ||
# via -r docs/requirements.in | ||
sphinxcontrib-applehelp==1.0.2 | ||
# via sphinx | ||
sphinxcontrib-devhelp==1.0.2 | ||
# via sphinx | ||
sphinxcontrib-htmlhelp==2.0.0 | ||
# via sphinx | ||
sphinxcontrib-jsmath==1.0.1 | ||
# via sphinx | ||
sphinxcontrib-qthelp==1.0.3 | ||
# via sphinx | ||
sphinxcontrib-serializinghtml==1.1.5 | ||
# via sphinx | ||
urllib3==1.26.9 | ||
# via requests |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
Usage | ||
===== | ||
|
||
.. _installation: | ||
|
||
Installation | ||
------------ | ||
|
||
To use Lumache, first install it using pip: | ||
|
||
.. code-block:: console | ||
(.venv) $ pip install lumache | ||
Creating recipes | ||
---------------- | ||
|
||
To retrieve a list of random ingredients, | ||
you can use the ``lumache.get_random_ingredients()`` function: | ||
|
||
.. autofunction:: lumache.get_random_ingredients | ||
|
||
The ``kind`` parameter should be either ``"meat"``, ``"fish"``, | ||
or ``"veggies"``. Otherwise, :py:func:`lumache.get_random_ingredients` | ||
will raise an exception. | ||
|
||
.. autoexception:: lumache.InvalidKindError | ||
|
||
For example: | ||
|
||
>>> import lumache | ||
>>> lumache.get_random_ingredients() | ||
['shells', 'gorgonzola', 'parsley'] | ||
|
Uh oh!
There was an error while loading. Please reload this page.