-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from algorandfoundation/docs
docs: sphinx, autodoc2, doctests setup
- Loading branch information
Showing
17 changed files
with
860 additions
and
220 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
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,42 @@ | ||
name: "Sphinx: Render + publish docs" | ||
|
||
on: | ||
workflow_call: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
steps: | ||
- name: Checkout source code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install poetry | ||
run: pipx install poetry | ||
|
||
- name: Set up Python 3.12 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.12" | ||
cache: "poetry" | ||
|
||
- name: Install dependencies | ||
run: poetry install --no-interaction | ||
|
||
- name: Test doctests | ||
run: poetry run poe docs-test | ||
|
||
- name: Build docs | ||
run: poetry run poe docs-build | ||
|
||
- name: Upload to GitHub pages | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: docs/_build | ||
|
||
- name: Deploy to GitHub Pages | ||
uses: actions/deploy-pages@v4 |
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 |
---|---|---|
@@ -1,4 +1,12 @@ | ||
.idea | ||
__pycache__ | ||
# coverage output | ||
.DS_Store | ||
|
||
/docs/_build/ | ||
/docs/apidocs/ | ||
|
||
.coverage | ||
coverage.xml | ||
coverage.xml | ||
.venv* | ||
|
||
/dist |
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 |
---|---|---|
@@ -1 +1,16 @@ | ||
# Algorand Subscriber | ||
<div align="center"> | ||
<a href="/~https://github.com/algorandfoundation/algokit-subscriber-py"><img src="https://bafybeidbb3a7cgn3unoz4oouk2jme4eavqgqtnskfr4bqhbjku3s52de4a.ipfs.w3s.link/algokit-subscriber-logo.png" width=60%></a> | ||
</div> | ||
|
||
<p align="center"> | ||
<a target="_blank" href="https://algorandfoundation.github.io/algokit-subscriber-py/"><img src="https://img.shields.io/badge/docs-repository-74dfdc?logo=github&style=flat.svg" /></a> | ||
<a target="_blank" href="https://developer.algorand.org/algokit/"><img src="https://img.shields.io/badge/learn-AlgoKit-74dfdc?logo=algorand&mac=flat.svg" /></a> | ||
<a target="_blank" href="/~https://github.com/algorandfoundation/algokit-subscriber-py"><img src="https://img.shields.io/github/stars/algorandfoundation/algokit-subscriber-py?color=74dfdc&logo=star&style=flat" /></a> | ||
<a target="_blank" href="https://developer.algorand.org/algokit/"><img src="https://api.visitorbadge.io/api/visitors?path=https%3A%2F%2Fgithub.com%2Falgorandfoundation%2Falgokit-subscriber-py&countColor=%2374dfdc&style=flat" /></a> | ||
</p> | ||
|
||
--- | ||
|
||
Algorand Subscriber is a Python library for subscribing and managing events on the Algorand blockchain. | ||
|
||
## To be expanded |
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,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) |
Empty file.
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,14 @@ | ||
/* | ||
Hide the first element of attribute like items as algopy stubs are more like interfaces and as such | ||
should not indicate a specific "value" for variables | ||
*/ | ||
.py.data, | ||
.py.attribute { | ||
dd p:first-child { | ||
display: none; | ||
} | ||
} | ||
|
||
.py.class { | ||
margin-top: 3rem; | ||
} |
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,18 @@ | ||
# API Reference | ||
|
||
```{py:module} algokit_subscriber_py | ||
:no-index: | ||
``` | ||
|
||
```{autodoc2-docstring} algokit_subscriber_py | ||
:allowtitles: | ||
``` | ||
|
||
## Contents | ||
|
||
```{toctree} | ||
:titlesonly: | ||
:maxdepth: 2 | ||
apidocs/algokit_subscriber_py/algokit_subscriber_py | ||
``` |
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,89 @@ | ||
# ruff: noqa | ||
# 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 = "Algorand Python Testing" | ||
copyright = "2024, Algorand Foundation" # noqa: A001 | ||
author = "Algorand Foundation" | ||
|
||
|
||
# -- General configuration --------------------------------------------------- | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration | ||
|
||
extensions = [ | ||
"sphinx.ext.githubpages", | ||
"sphinx.ext.intersphinx", | ||
"sphinx_copybutton", | ||
"myst_parser", | ||
"autodoc2", | ||
"sphinx.ext.doctest", | ||
"sphinxmermaid", | ||
] | ||
|
||
templates_path = ["_templates"] | ||
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] | ||
|
||
nitpick_ignore = [("py:class", "optional")] | ||
intersphinx_mapping = { | ||
"python": ("https://docs.python.org/3", None), | ||
} | ||
|
||
# warning exclusions | ||
suppress_warnings = [ | ||
"myst.xref_missing", | ||
"autodoc2.dup_item", | ||
"ref.python", # Ignore Python reference warnings | ||
"ref.class", # Ignore class reference warnings | ||
"ref.obj", # Ignore object reference warnings | ||
"toc.excluded", # Ignore warnings about documents not in any toctree | ||
] | ||
|
||
# -- Options for HTML output ------------------------------------------------- | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output | ||
html_theme = "furo" | ||
html_static_path = ["_static"] | ||
html_css_files = [ | ||
"custom.css", | ||
] | ||
|
||
python_maximum_signature_line_length = 80 | ||
|
||
# -- Options for myst --- | ||
myst_enable_extensions = ["colon_fence", "fieldlist"] | ||
|
||
# -- Options for autodoc2 | ||
autodoc2_packages = [ | ||
{ | ||
"path": "../src/algokit_subscriber_py", | ||
"auto_mode": True, | ||
}, | ||
] | ||
autodoc2_render_plugin = "myst" | ||
autodoc2_hidden_objects = [ | ||
"private", | ||
] | ||
add_module_names = False | ||
autodoc2_index_template = None | ||
|
||
# -- Options for doctest -- | ||
doctest_test_doctest_blocks = "default" | ||
|
||
# -- Options for mermaid -- | ||
sphinxmermaid_mermaid_init = { | ||
"theme": "dark", | ||
} | ||
|
||
# Ignore specific warning types | ||
# TODO : remove upon refining autodoc2 (or finding alternative to sphinx) | ||
suppress_warnings = [ | ||
"myst.xref_missing", | ||
"autodoc2.dup_item", | ||
"ref.python", # Ignore Python reference warnings | ||
"ref.class", # Ignore class reference warnings | ||
"ref.obj", # Ignore object reference warnings | ||
] |
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,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 |
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
Oops, something went wrong.