Skip to content

Commit

Permalink
feat(fal_client): generate docs (#319)
Browse files Browse the repository at this point in the history
feat(fal_client: generate docs
  • Loading branch information
efiop authored Oct 2, 2024
1 parent 4d4a500 commit fc52010
Show file tree
Hide file tree
Showing 9 changed files with 171 additions and 1 deletion.
30 changes: 30 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Deploy docs to GitHub Pages

on:
push:
branches: [main]

jobs:
pages:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.11'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e 'projects/fal_client[docs]'
- name: Build documentation
run: make -C projects/fal_client/docs html

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: projects/fal_client/docs/_build/html
1 change: 1 addition & 0 deletions projects/fal_client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/docs/_build
20 changes: 20 additions & 0 deletions projects/fal_client/docs/Makefile
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)
26 changes: 26 additions & 0 deletions projects/fal_client/docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = "fal_client"
copyright = "2024, FAL Team"
author = "FAL Team"

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = ["sphinx.ext.autodoc", "sphinx.ext.napoleon", "sphinx_autodoc_typehints"]

templates_path = ["_templates"]
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]


# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = "alabaster"
html_static_path = ["_static"]
29 changes: 29 additions & 0 deletions projects/fal_client/docs/fal_client.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
fal\_client package
===================

Submodules
----------

fal\_client.auth module
-----------------------

.. automodule:: fal_client.auth
:members:
:undoc-members:
:show-inheritance:

fal\_client.client module
-------------------------

.. automodule:: fal_client.client
:members:
:undoc-members:
:show-inheritance:

Module contents
---------------

.. automodule:: fal_client
:members:
:undoc-members:
:show-inheritance:
18 changes: 18 additions & 0 deletions projects/fal_client/docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.. fal_client documentation master file, created by
sphinx-quickstart on Wed Oct 2 04:10:59 2024.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
fal_client documentation
========================

Add your content using ``reStructuredText`` syntax. See the
`reStructuredText <https://www.sphinx-doc.org/en/master/usage/restructuredtext/index.html>`_
documentation for details.


.. toctree::
:maxdepth: 2
:caption: Contents:

modules
35 changes: 35 additions & 0 deletions projects/fal_client/docs/make.bat
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
7 changes: 7 additions & 0 deletions projects/fal_client/docs/modules.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
fal_client
==========

.. toctree::
:maxdepth: 4

fal_client
6 changes: 5 additions & 1 deletion projects/fal_client/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,17 @@ dependencies = [
]

[project.optional-dependencies]
docs = [
"sphinx",
"sphinx-autodoc-typehints",
]
test = [
"pytest",
"pytest-asyncio",
"pillow",
]
dev = [
"fal_client[test]",
"fal_client[docs,test]",
]

[project.urls]
Expand Down

0 comments on commit fc52010

Please sign in to comment.