From 4c03b7ef31a8873c4fa3768949e95bb36e952d2f Mon Sep 17 00:00:00 2001 From: Michael Huang Date: Mon, 5 Oct 2020 21:12:53 -0500 Subject: [PATCH] Set up docs (#47) * Add sphinx * Add doc src * Update Mafile & LICENSE * Bump down solana * Docs under construction * Add docs workflow * Install sphinxemoji in workflow * Only build docs on push * Doc dependencies * Remove make docs * force_orphan --- .github/workflows/docs.yml | 39 ++++++++++++++ LICENSE | 2 +- Makefile | 7 +-- Pipfile | 2 + Pipfile.lock | 101 ++++++++++++++++++++++++++++++++++++- docs/conf.py | 52 +++++++++++++++++++ docs/index.rst | 27 ++++++++++ docs/instructions.rst | 11 ++++ docs/market.rst | 25 +++++++++ 9 files changed, 258 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/docs.yml create mode 100644 docs/conf.py create mode 100644 docs/index.rst create mode 100644 docs/instructions.rst create mode 100644 docs/market.rst diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..5b6b158 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,39 @@ +# This is a basic workflow to help you get started with Actions + +name: Docs + +# Controls when the action will run. Triggers the workflow on push or pull request +# events but only for the master branch +on: + push: + branches: [alpha] + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + - uses: dschep/install-pipenv-action@v1 + + - name: Doc dependencies + run: pipenv lock -r > requirements.txt + + - name: Sphinx Build + uses: ammaraskar/sphinx-action@0.4 + with: + pre-build-command: pip install sphinxemoji + docs-folder: . + + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./_build/html + force_orphan: true diff --git a/LICENSE b/LICENSE index abf3e8b..7269a28 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2020 Py-Serum +Copyright (c) 2020 serum-community Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Makefile b/Makefile index 948a1ac..f4ce457 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,7 @@ int-tests: # from the environment for the first two. SPHINXOPTS ?= SPHINXBUILD ?= sphinx-build -SOURCEDIR = docsrc +SOURCEDIR = docs BUILDDIR = _build # Put it first so that "make" without argument is like "make help". @@ -50,8 +50,3 @@ help: # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). %: Makefile @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) - -.PHONY: docs -docs: - @make html - @cp -a _build/html/ docs diff --git a/Pipfile b/Pipfile index 99560ea..20fbae6 100644 --- a/Pipfile +++ b/Pipfile @@ -23,6 +23,8 @@ rope = "*" pytest-cov = "*" twine = "*" setuptools = "*" +sphinx = "*" +sphinxemoji = "*" [packages] solana = "*" diff --git a/Pipfile.lock b/Pipfile.lock index c7fb20f..10eb653 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "b16e0702ee2af4c8a299cc56792c430548deeec4711d9c1e3007a0fc3c87e892" + "sha256": "ef00b754ff26d79c65ce356dc6226020e295fecc43aff89859e5d6d9ef1f25de" }, "pipfile-spec": 6, "requires": { @@ -168,6 +168,13 @@ } }, "develop": { + "alabaster": { + "hashes": [ + "sha256:446438bdcca0e05bd45ea2de1668c1d9b032e1a9154c2c259092d77031ddd359", + "sha256:a661d72d58e6ea8a57f7a86e37d86716863ee5e92788398526d58b26a4e4dc02" + ], + "version": "==0.7.12" + }, "appdirs": { "hashes": [ "sha256:7d5d0167b2b1ba821647616af46a749d1c653740dd0d2415100fe26e27afdf41", @@ -228,6 +235,14 @@ "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", "version": "==20.2.0" }, + "babel": { + "hashes": [ + "sha256:1aac2ae2d0d8ea368fa90906567f5c08463d98ade155c0c4bfedd6a0f7160e38", + "sha256:d670ea0b10f8b723672d3a6abeb87b565b244da220d76b4dba1b66269ec152d4" + ], + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", + "version": "==2.8.0" + }, "backcall": { "hashes": [ "sha256:5cbdbf27be5e7cfadb448baf0aa95508f91f2bbc6c6437cd9cd06e2a4c215e1e", @@ -408,6 +423,14 @@ "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", "version": "==2.10" }, + "imagesize": { + "hashes": [ + "sha256:6965f19a6a2039c7d48bca7dba2473069ff854c36ae6f19d2cde309d998228a1", + "sha256:b1f6b5a4eab1f73479a50fb79fcf729514a900c341d8503d62a62dbc4127a2b1" + ], + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", + "version": "==1.2.0" + }, "importlib-metadata": { "hashes": [ "sha256:77a540690e24b0305878c37ffd421785a6f7e53c8b5720d211b211de8d0e95da", @@ -863,6 +886,13 @@ "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2'", "version": "==2.8.1" }, + "pytz": { + "hashes": [ + "sha256:a494d53b6d39c3c6e44c3bec237336e14305e4f29bbf800b599253057fbb79ed", + "sha256:c35965d010ce31b23eeb663ed3cc8c906275d6be1a34393a1d73a41febf4a048" + ], + "version": "==2020.1" + }, "pyzmq": { "hashes": [ "sha256:00dca814469436455399660247d74045172955459c0bd49b54a540ce4d652185", @@ -908,12 +938,17 @@ "hashes": [ "sha256:088afc8c63e7bd187a3c70a94b9e50ab3f17e1d3f52a32750b5b77dbe99ef5ef", "sha256:1fe0a41437bbd06063aa184c34804efa886bcc128222e9916310c92cd54c3b4c", + "sha256:3d20024a70b97b4f9546696cbf2fd30bae5f42229fbddf8661261b1eaff0deb7", "sha256:41bb65f54bba392643557e617316d0d899ed5b4946dccee1cb6696152b29844b", "sha256:4318d56bccfe7d43e5addb272406ade7a2274da4b70eb15922a071c58ab0108c", "sha256:4707f3695b34335afdfb09be3802c87fa0bc27030471dbc082f815f23688bc63", + "sha256:49f23ebd5ac073765ecbcf046edc10d63dcab2f4ae2bce160982cb30df0c0302", "sha256:5533a959a1748a5c042a6da71fe9267a908e21eded7a4f373efd23a2cbdb0ecc", + "sha256:5d892a4f1c999834eaa3c32bc9e8b976c5825116cde553928c4c8e7e48ebda67", "sha256:5f18875ac23d9aa2f060838e8b79093e8bb2313dbaaa9f54c6d8e52a5df097be", "sha256:60b0e9e6dc45683e569ec37c55ac20c582973841927a85f2d8a7d20ee80216ab", + "sha256:816064fc915796ea1f26966163f6845de5af78923dfcecf6551e095f00983650", + "sha256:84cada8effefe9a9f53f9b0d2ba9b7b6f5edf8d2155f9fdbe34616e06ececf81", "sha256:84e9407db1b2eb368b7ecc283121b5e592c9aaedbe8c78b1a2f1102eb2e21d19", "sha256:8d69cef61fa50c8133382e61fd97439de1ae623fe943578e477e76a9d9471637", "sha256:9a02d0ae31d35e1ec12a4ea4d4cca990800f66a917d0fb997b20fbc13f5321fc", @@ -921,6 +956,7 @@ "sha256:a6f32aea4260dfe0e55dc9733ea162ea38f0ea86aa7d0f77b15beac5bf7b369d", "sha256:ae91972f8ac958039920ef6e8769277c084971a142ce2b660691793ae44aae6b", "sha256:c570f6fa14b9c4c8a4924aaad354652366577b4f98213cf76305067144f7b100", + "sha256:c9443124c67b1515e4fe0bb0aa18df640965e1030f468a2a5dc2589b26d130ad", "sha256:d23a18037313714fb3bb5a94434d3151ee4300bae631894b1ac08111abeaa4a3", "sha256:eaf548d117b6737df379fdd53bdde4f08870e66d7ea653e230477f071f861121", "sha256:ebbe29186a3d9b0c591e71b7393f1ae08c83cb2d8e517d2a822b8f7ec99dfd8b", @@ -981,6 +1017,69 @@ ], "version": "==2.0.0" }, + "sphinx": { + "hashes": [ + "sha256:321d6d9b16fa381a5306e5a0b76cd48ffbc588e6340059a729c6fdd66087e0e8", + "sha256:ce6fd7ff5b215af39e2fcd44d4a321f6694b4530b6f2b2109b64d120773faea0" + ], + "index": "pypi", + "version": "==3.2.1" + }, + "sphinxcontrib-applehelp": { + "hashes": [ + "sha256:806111e5e962be97c29ec4c1e7fe277bfd19e9652fb1a4392105b43e01af885a", + "sha256:a072735ec80e7675e3f432fcae8610ecf509c5f1869d17e2eecff44389cdbc58" + ], + "markers": "python_version >= '3.5'", + "version": "==1.0.2" + }, + "sphinxcontrib-devhelp": { + "hashes": [ + "sha256:8165223f9a335cc1af7ffe1ed31d2871f325254c0423bc0c4c7cd1c1e4734a2e", + "sha256:ff7f1afa7b9642e7060379360a67e9c41e8f3121f2ce9164266f61b9f4b338e4" + ], + "markers": "python_version >= '3.5'", + "version": "==1.0.2" + }, + "sphinxcontrib-htmlhelp": { + "hashes": [ + "sha256:3c0bc24a2c41e340ac37c85ced6dafc879ab485c095b1d65d2461ac2f7cca86f", + "sha256:e8f5bb7e31b2dbb25b9cc435c8ab7a79787ebf7f906155729338f3156d93659b" + ], + "markers": "python_version >= '3.5'", + "version": "==1.0.3" + }, + "sphinxcontrib-jsmath": { + "hashes": [ + "sha256:2ec2eaebfb78f3f2078e73666b1415417a116cc848b72e5172e596c871103178", + "sha256:a9925e4a4587247ed2191a22df5f6970656cb8ca2bd6284309578f2153e0c4b8" + ], + "markers": "python_version >= '3.5'", + "version": "==1.0.1" + }, + "sphinxcontrib-qthelp": { + "hashes": [ + "sha256:4c33767ee058b70dba89a6fc5c1892c0d57a54be67ddd3e7875a18d14cba5a72", + "sha256:bd9fc24bcb748a8d51fd4ecaade681350aa63009a347a8c14e637895444dfab6" + ], + "markers": "python_version >= '3.5'", + "version": "==1.0.3" + }, + "sphinxcontrib-serializinghtml": { + "hashes": [ + "sha256:eaa0eccc86e982a9b939b2b82d12cc5d013385ba5eadcc7e4fed23f4405f77bc", + "sha256:f242a81d423f59617a8e5cf16f5d4d74e28ee9a66f9e5b637a18082991db5a9a" + ], + "markers": "python_version >= '3.5'", + "version": "==1.1.4" + }, + "sphinxemoji": { + "hashes": [ + "sha256:2a86a423391e0070d6535e44c6453484cd0e92f06fc41164de97eb430955b6a5" + ], + "index": "pypi", + "version": "==0.1.7" + }, "terminado": { "hashes": [ "sha256:3da72a155b807b01c9e8a5babd214e052a0a45a975751da3521a1c3381ce6d76", diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 0000000..bbc5f1b --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,52 @@ +# Configuration file for the Sphinx documentation builder. +# +# This file only contains a selection of the most common options. For a full +# list see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Path setup -------------------------------------------------------------- + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +import os +import sys + +sys.path.insert(0, os.path.abspath("..")) + + +# -- Project information ----------------------------------------------------- + +project = "pyserum" +copyright = "2020, serum-community" +author = "Michael Huang, Leonard Ge" + + +# -- General configuration --------------------------------------------------- + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + "sphinx.ext.autodoc", + "sphinx.ext.intersphinx", + "sphinx.ext.viewcode", + "sphinx.ext.coverage", + "sphinx.ext.doctest", + "sphinxemoji.sphinxemoji", +] + + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This pattern also affects html_static_path and html_extra_path. +exclude_patterns = [] + + +# -- Options for HTML output ------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = "alabaster" diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 0000000..2f16b95 --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,27 @@ +.. pyserum documentation master file, created by + sphinx-quickstart on Sun Oct 4 18:54:35 2020. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to pyserum's documentation! +=================================== + +|:construction:| |:construction:| |:construction:| |:construction:| |:construction:| **Under Construction!** |:construction:| |:construction:| |:construction:| |:construction:| |:construction:| + + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + + market + instructions + +|:construction:| |:construction:| |:construction:| |:construction:| |:construction:| **Under Construction!** |:construction:| |:construction:| |:construction:| |:construction:| |:construction:| + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` diff --git a/docs/instructions.rst b/docs/instructions.rst new file mode 100644 index 0000000..4607476 --- /dev/null +++ b/docs/instructions.rst @@ -0,0 +1,11 @@ +DEX Instructions +================ + +.. automodule:: pyserum.instructions + :members: + +Enums +===== + +.. automodule:: pyserum.enums + :members: diff --git a/docs/market.rst b/docs/market.rst new file mode 100644 index 0000000..fad62d3 --- /dev/null +++ b/docs/market.rst @@ -0,0 +1,25 @@ +Serum Market +============ + +.. automodule:: pyserum.market + + .. autoclass:: pyserum.market.Market + :members: + +Market State +------------ + +.. automodule:: pyserum.market.state + + .. autoclass:: pyserum.market.state.MarketState + :members: + +Orderbook +--------- +.. automodule:: pyserum.market.orderbook + :members: + +Types +----- +.. automodule:: pyserum.market.types + :members: