Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Commit 5a57ab4

Browse files
committed
Docs: Added the base RTD files
1 parent 9a61d9d commit 5a57ab4

File tree

11 files changed

+177
-0
lines changed

11 files changed

+177
-0
lines changed

.github/workflows/preview-docs.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Preview Documentation
2+
on:
3+
pull_request_target:
4+
types:
5+
- opened
6+
7+
permissions:
8+
pull-requests: write
9+
10+
jobs:
11+
documentation-links:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: readthedocs/actions/preview@v1
15+
with:
16+
project-slug: "flask-utils"

.readthedocs.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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/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+
- requirements: docs/requirements.txt

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
[![Documentation Status](https://readthedocs.org/projects/flask-utils/badge/?version=latest)](https://flask-utils.readthedocs.io/en/latest/?badge=latest)
2+
13
# Flask-Utils
24

35
A collection of useful Flask utilities I use every day in my Flask projects.

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 = source
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/requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
sphinx==7.1.2
2+
sphinx-rtd-theme==1.3.0rc1

docs/source/api.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
API
2+
===
3+
4+
.. autosummary::
5+
:toctree: generated
6+
7+
flask_utils

docs/source/conf.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
# -- Project information
3+
import os
4+
import sys
5+
6+
sys.path.insert(0, os.path.abspath("../.."))
7+
8+
from flask_utils import __version__ # noqa: E402
9+
10+
11+
project = "Flask-Utils"
12+
copyright = "2024, Jules Lasne"
13+
14+
15+
release = __version__
16+
version = __version__
17+
18+
# -- General configuration
19+
20+
extensions = [
21+
"sphinx.ext.duration",
22+
"sphinx.ext.doctest",
23+
"sphinx.ext.autodoc",
24+
"sphinx.ext.autosummary",
25+
"sphinx.ext.intersphinx",
26+
]
27+
28+
intersphinx_mapping = {
29+
"python": ("https://docs.python.org/3/", None),
30+
"sphinx": ("https://www.sphinx-doc.org/en/master/", None),
31+
}
32+
intersphinx_disabled_domains = ["std"]
33+
34+
templates_path = ["_templates"]
35+
36+
# -- Options for HTML output
37+
38+
html_theme = "sphinx_rtd_theme"
39+
40+
# -- Options for EPUB output
41+
epub_show_urls = "footnote"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
flask\_utils
2+
============
3+
4+
.. automodule:: flask_utils

docs/source/index.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Welcome to Lumache's documentation!
2+
===================================
3+
4+
**Lumache** (/lu'make/) is a Python library for cooks and food lovers
5+
that creates recipes mixing random ingredients.
6+
It pulls data from the `Open Food Facts database <https://world.openfoodfacts.org/>`_
7+
and offers a *simple* and *intuitive* API.
8+
9+
Check out the :doc:`usage` section for further information, including
10+
how to :ref:`installation` the project.
11+
12+
.. note::
13+
14+
This project is under active development.
15+
16+
Contents
17+
--------
18+
19+
.. toctree::
20+
21+
usage
22+
api

docs/source/usage.rst

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
Usage
2+
=====
3+
4+
.. _installation:
5+
6+
Installation
7+
------------
8+
9+
To use Lumache, first install it using pip:
10+
11+
.. code-block:: console
12+
13+
(.venv) $ pip install lumache
14+
15+
Creating recipes
16+
----------------
17+
18+
To retrieve a list of random ingredients,
19+
you can use the ``lumache.get_random_ingredients()`` function:
20+
21+
.. autofunction:: flask_utils.register_error_handlers
22+
23+
The ``kind`` parameter should be either ``"meat"``, ``"fish"``,
24+
or ``"veggies"``. Otherwise, :py:func:`lumache.get_random_ingredients`
25+
will raise an exception.
26+
27+
.. autoexception:: flask_utils.NotFoundError
28+
29+
For example:
30+
31+
>>> import lumache
32+
>>> lumache.get_random_ingredients()
33+
['shells', 'gorgonzola', 'parsley']

0 commit comments

Comments
 (0)