-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for sphinx docs and set up simple GHA (#100)
* add sphinx docs and github actions for them * linting * add pydantic models * add pydantic models * linting issues * Accept suggested change Co-authored-by: robotrapta <[email protected]> * address pr feedback * clean up * fix linting * make method static to make pylint happy * python version * final touches * test if python 3.7 and 3.8 are still supported * update sphinx-rtd-theme package * increment version requirement for autodoc-pydantic * verified tests pass with python >3.7.0 --------- Co-authored-by: robotrapta <[email protected]>
- Loading branch information
1 parent
e9d8f7f
commit c0e66d3
Showing
10 changed files
with
1,080 additions
and
376 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Build API Reference docs using sphinx | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
env: | ||
POETRY_VERSION: "1.6.1" | ||
PYTHON_VERSION: "3.10" | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: get code | ||
uses: actions/checkout@v3 | ||
- name: install python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
- name: install poetry | ||
uses: snok/install-poetry@v1 | ||
with: | ||
version: ${{ env.POETRY_VERSION }} | ||
|
||
- name: Install dependencies | ||
run: make install-sphinx-deps | ||
|
||
- name: Build API documentation | ||
run: | | ||
make apidocs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# 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 | ||
|
||
|
||
import sys | ||
import os | ||
import toml | ||
|
||
sys.path.insert(0, os.path.abspath("../src")) | ||
sys.path.insert(1, os.path.abspath("../generated")) | ||
|
||
|
||
def get_version_name() -> str: | ||
pyproject_path = "../pyproject.toml" | ||
with open(pyproject_path, "r") as f: | ||
pyproject_deps = toml.load(f) | ||
|
||
version = pyproject_deps["tool"]["poetry"]["version"] | ||
return version | ||
|
||
|
||
project = "Groundlight Python SDK" | ||
copyright = "2023, Groundlight AI <[email protected]>" | ||
author = "Groundlight AI <[email protected]>" | ||
version = get_version_name() | ||
release = version | ||
|
||
# -- General configuration --------------------------------------------------- | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration | ||
|
||
# sphinx.ext.autodoc is a Sphinx extension that automatically documents Python modules. | ||
# We are using the `reStructuredText` format for docstrings instead of google style. | ||
extensions = ["sphinx.ext.autodoc", "sphinxcontrib.autodoc_pydantic"] | ||
|
||
templates_path = ["_templates"] | ||
exclude_patterns = [] | ||
|
||
|
||
# -- Options for HTML output ------------------------------------------------- | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output | ||
|
||
html_theme = "sphinx_rtd_theme" | ||
html_static_path = ["_static"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
|
||
Welcome to Groundlight Python SDK's documentation! | ||
================================================== | ||
|
||
For a detailed view of the source code, visit the `Groundlight SDK GitHub Repository <https://github.com/groundlight/python-sdk>`_. | ||
|
||
|
||
.. automodule:: groundlight.client | ||
:members: | ||
:special-members: __init__ | ||
:exclude-members: ApiTokenError | ||
|
||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
:caption: Contents: | ||
|
||
models | ||
|
||
|
||
|
||
Indices and tables | ||
================== | ||
|
||
* :ref:`genindex` | ||
* :ref:`modindex` | ||
* :ref:`search` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
|
||
API Response Objects | ||
===================== | ||
|
||
.. autopydantic_model:: model.Detector | ||
:model-show-json: True | ||
|
||
.. autopydantic_model:: model.ImageQuery | ||
:model-show-json: True | ||
|
||
.. autopydantic_model:: model.PaginatedDetectorList | ||
:model-show-json: True | ||
|
||
.. autopydantic_model:: model.PaginatedImageQueryList | ||
:model-show-json: True |
Oops, something went wrong.