diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index ec8fee2f..abbc41ec 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -18,13 +18,14 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip + pip install -e 'projects/fal[docs]' pip install -e 'projects/fal_client[docs]' - name: Build documentation - run: make -C projects/fal_client/docs html + run: make docs - 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 + publish_dir: docs/_build/html diff --git a/.gitignore b/.gitignore index bcd772a4..47852215 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,5 @@ dmypy.json /coverage.xml /.coverage tmp/ + +/docs/ diff --git a/projects/fal/.gitignore b/projects/fal/.gitignore index 433ca091..7f2effec 100644 --- a/projects/fal/.gitignore +++ b/projects/fal/.gitignore @@ -1 +1,2 @@ /src/fal/_fal_version.py +/docs/* diff --git a/projects/fal/Makefile b/projects/fal/Makefile new file mode 100644 index 00000000..500dbea3 --- /dev/null +++ b/projects/fal/Makefile @@ -0,0 +1,24 @@ +MAKEFILE_DIR := $(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST))))) + +SPHINXOPTS = --fresh-env +SPHINXBUILD = sphinx-build +SPHINXAPIDOC = sphinx-apidoc +SOURCEDIR = $(MAKEFILE_DIR)/docs +BUILDDIR = $(MAKEFILE_DIR)/docs/_build +PROJECTDIR = $(MAKEFILE_DIR)/src/fal + +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile clean apidoc html docs + +clean: + rm -rf $(BUILDDIR)/* + +apidoc: + $(SPHINXAPIDOC) -f -o "$(SOURCEDIR)" "$(PROJECTDIR)" + +html: + @$(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +docs: apidoc html diff --git a/projects/fal/docs/conf.py b/projects/fal/docs/conf.py new file mode 100644 index 00000000..d03fc1a3 --- /dev/null +++ b/projects/fal/docs/conf.py @@ -0,0 +1,31 @@ +# 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_sdk' +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'] diff --git a/projects/fal/docs/index.rst b/projects/fal/docs/index.rst new file mode 100644 index 00000000..b4960718 --- /dev/null +++ b/projects/fal/docs/index.rst @@ -0,0 +1,18 @@ +.. fal_sdk documentation master file, created by + sphinx-quickstart on Wed Oct 2 05:09:49 2024. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +fal_sdk documentation +===================== + +Add your content using ``reStructuredText`` syntax. See the +`reStructuredText `_ +documentation for details. + + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + + modules diff --git a/projects/fal/pyproject.toml b/projects/fal/pyproject.toml index e997d9bd..2ba9b897 100644 --- a/projects/fal/pyproject.toml +++ b/projects/fal/pyproject.toml @@ -60,6 +60,11 @@ dependencies = [ ] [project.optional-dependencies] +docs = [ + "sphinx", + "sphinx-rtd-theme", + "sphinx-autodoc-typehints", +] test = [ "pytest<8", "pytest-asyncio", @@ -68,7 +73,7 @@ test = [ "boto3", ] dev = [ - "fal[test]", + "fal[docs,test]", "openapi-python-client>=0.14.1,<1", ] diff --git a/projects/fal_client/.gitignore b/projects/fal_client/.gitignore index 2ae76a60..ac3ba00e 100644 --- a/projects/fal_client/.gitignore +++ b/projects/fal_client/.gitignore @@ -1 +1 @@ -/docs/_build +/docs/* diff --git a/projects/fal_client/Makefile b/projects/fal_client/Makefile new file mode 100644 index 00000000..7d0214e7 --- /dev/null +++ b/projects/fal_client/Makefile @@ -0,0 +1,24 @@ +MAKEFILE_DIR := $(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST))))) + +SPHINXOPTS = --fresh-env +SPHINXBUILD = sphinx-build +SPHINXAPIDOC = sphinx-apidoc +SOURCEDIR = $(MAKEFILE_DIR)/docs +BUILDDIR = $(MAKEFILE_DIR)/docs/_build +PROJECTDIR = $(MAKEFILE_DIR)/src/fal_client + +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile clean apidoc html docs + +clean: + rm -rf $(BUILDDIR)/* + +apidoc: + $(SPHINXAPIDOC) -f -o "$(SOURCEDIR)" "$(PROJECTDIR)" + +html: + @$(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +docs: apidoc html diff --git a/projects/fal_client/docs/Makefile b/projects/fal_client/docs/Makefile deleted file mode 100644 index d4bb2cbb..00000000 --- a/projects/fal_client/docs/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -# 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) diff --git a/projects/fal_client/docs/fal_client.rst b/projects/fal_client/docs/fal_client.rst deleted file mode 100644 index eac60e2c..00000000 --- a/projects/fal_client/docs/fal_client.rst +++ /dev/null @@ -1,29 +0,0 @@ -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: diff --git a/projects/fal_client/docs/make.bat b/projects/fal_client/docs/make.bat deleted file mode 100644 index 32bb2452..00000000 --- a/projects/fal_client/docs/make.bat +++ /dev/null @@ -1,35 +0,0 @@ -@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 diff --git a/projects/fal_client/docs/modules.rst b/projects/fal_client/docs/modules.rst deleted file mode 100644 index e2eeaad5..00000000 --- a/projects/fal_client/docs/modules.rst +++ /dev/null @@ -1,7 +0,0 @@ -fal_client -========== - -.. toctree:: - :maxdepth: 4 - - fal_client diff --git a/projects/fal_client/pyproject.toml b/projects/fal_client/pyproject.toml index 6b2f1075..8d89b9da 100644 --- a/projects/fal_client/pyproject.toml +++ b/projects/fal_client/pyproject.toml @@ -22,6 +22,7 @@ dependencies = [ [project.optional-dependencies] docs = [ "sphinx", + "sphinx-rtd-theme", "sphinx-autodoc-typehints", ] test = [