Skip to content

Commit

Permalink
feat(docs): initial sphinx docs build (#9)
Browse files Browse the repository at this point in the history
The `Makefile` and `make.bat` are autogenerated via `sphinx-quickstart`;
generally we'll want to use `just docs` instead. I left them in in case
they're load-bearing for readthedocs (which we'll want to enable when we
make this repo public.)
  • Loading branch information
chrisdickinson authored Oct 11, 2023
1 parent 7622af5 commit 860d275
Show file tree
Hide file tree
Showing 14 changed files with 959 additions and 286 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: docs
path: docs
path: docs/_build

build:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ jobs:

- run: poetry install

- run: |
poetry run mypy --install-types -m extism --non-interactive
- name: Run Python lint
run: |
just lint
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
html
__pycache__
poetry-installer-error-*.log
docs/
docs/_build
.DS_Store
20 changes: 20 additions & 0 deletions 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 = source
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)
35 changes: 35 additions & 0 deletions 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=source
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
8 changes: 8 additions & 0 deletions docs/source/api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
API
===

.. currentmodule:: extism

.. automodule:: extism
:members:
:member-order: bysource
38 changes: 38 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# 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 = 'Extism'
copyright = '2023, The Extism Maintainers'
author = 'The Extism Maintainers'
release = '0.1'

# -- General configuration

extensions = [
'sphinx.ext.duration',
'sphinx.ext.doctest',
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.intersphinx',
'sphinx_autodoc_typehints',
]

intersphinx_mapping = {
'python': ('https://docs.python.org/3/', None),
'sphinx': ('https://www.sphinx-doc.org/en/master/', None),
}
intersphinx_disabled_domains = ['std']

templates_path = ['_templates']

# -- Options for HTML output

html_theme = 'sphinx_rtd_theme'

# -- Options for EPUB output
epub_show_urls = 'footnote'
15 changes: 15 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.. Extism documentation master file, created by
sphinx-quickstart on Fri Oct 6 12:42:59 2023.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to Extism's documentation!
==================================

Contents
--------

.. toctree::

usage
api
13 changes: 13 additions & 0 deletions docs/source/usage.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Usage
=====

.. _installation:

Installation
------------

To use extism, first install it using pip:

.. code-block:: console
(.venv) $ pip install extism
20 changes: 20 additions & 0 deletions extism/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,31 @@
"""
The extism python SDK, used for embedding guest Wasm programs into python
hosts.
"""

from .extism import (
Error,
Plugin,
set_log_file,
extism_version,
host_fn,
Function,
Memory,
ValType,
Val,
CurrentPlugin,
)

__all__ = [
"Plugin",
"Error",
"CurrentPlugin",
"set_log_file",
"extism_version",
"Memory",
"host_fn",
"CurrentPlugin",
"Function",
"ValType",
"Val",
]
Loading

0 comments on commit 860d275

Please sign in to comment.