Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge docs into competition #7

Merged
merged 20 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: documentation

on: [push, pull_request, workflow_dispatch]

permissions:
contents: write

jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- name: Install dependencies
run: |
pip install sphinx sphinx_rtd_theme myst_parser
- name: Install Synthetix
run: |
pip install -e ./src
- name: Sphinx build
run: |
cd docs && make html
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/v3-competition' }}
with:
publish_branch: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/build/html
force_orphan: true
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
24 changes: 24 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
project = 'Synthetix'
copyright = '2023, Synthetix DAO'
author = 'Synthetix DAO'

extensions = [
"myst_parser",
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx_rtd_theme",
]
autosummary_generate = True

templates_path = ['_templates']

exclude_patterns = [
'*/constants.py', # TODO: Figure out why this doesn't work
'.DS_Store',
'deployments/*'
]

source_suffix = [".rst", ".md"]

html_theme = 'sphinx_rtd_theme'
html_static_path = ['_static']
9 changes: 9 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Synthetix Documentation
=======================

.. toctree::
:maxdepth: 2
:caption: Reference

modules/synthetix
modules/utils
7 changes: 7 additions & 0 deletions docs/source/modules/multicall.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Multicall
===========================

.. automodule:: synthetix.utils.multicall
:members:
:undoc-members:
:show-inheritance:
13 changes: 13 additions & 0 deletions docs/source/modules/synthetix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Synthetix
===========================

.. autoclass:: synthetix.Synthetix
:members:
:private-members:

.. autoclass:: synthetix.perps.Perps
:members:
:private-members:

.. autoclass:: synthetix.pyth.Pyth
:members:
7 changes: 7 additions & 0 deletions docs/source/modules/utils.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Utils
===========================

.. automodule:: synthetix.utils
:members:
:undoc-members:
:show-inheritance:
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ autopep8
pre-commit
python-dotenv
pytest
sphinx
sphinx-rtd-theme
myst-parser
Loading