Add sphinx build script

This commit is contained in:
Olivia Appleton 2022-10-22 02:23:45 -04:00
parent 0348e4e4e1
commit 9f6e85218c
GPG Key ID: AF65A9CA0FF7FD69
10 changed files with 174 additions and 4 deletions

View File

@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.7.0.1
current_version = 0.7.0.2
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)\.(?P<build>\d+)
serialize = {major}.{minor}.{patch}.{build}

View File

@ -126,6 +126,7 @@ build: dependencies clean LICENSE
# Clean up after a build
clean:
@rm -rf build dist logs .benchmarks .pytest_cache src/*.egg-info test-reporter-latest-linux-amd64 .coverage .requirements.txt coverage.xml
@cd docs && $(MAKE) clean $(MFLAGS)
@mkdir logs
.PHONY: publish
@ -153,6 +154,17 @@ upload_coverage: .coverage
@if [ ! -f ./test-reporter-latest-linux-amd64 ]; then wget https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64; chmod +x ./test-reporter-latest-linux-amd64; fi
@./test-reporter-latest-linux-amd64 after-build -t coverage.py -r eb0fb76d1b07b8f58d16c2ccd2ef6f9d2483faa25650522e6313f6564a6d0351
.PHONY: exe
# Make a PyInstaller exe (status: not yet supported)
exe:
$(PYTHON) -m pip install -r requirements.txt --user
$(PYTHON) -OO -m PyInstaller -F -n "research_bundle" $(ENTRY) --add-data src/defaults:src/defaults
.PHONY: html
# Make html docs (status: beta)
html:
cd docs && $(MAKE) html $(MFLAGS)
.PHONY: help
# Show this help.
help:

27
docs/Makefile Normal file
View File

@ -0,0 +1,27 @@
# 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
PY ?= python3
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
.PHONY: clean
clean:
@rm -rf build source/_autosummary
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@mkdir -p "$(SOURCEDIR)/_static"
@$(PY) -m pip install -r requirements.txt
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

3
docs/requirements.txt Normal file
View File

@ -0,0 +1,3 @@
sphinx
-r ../requirements.txt
sphinx_rtd_theme

View File

@ -0,0 +1,5 @@
{{ fullname }}
{{ underline }}
.. automodule:: {{ fullname }}
:members:

76
docs/source/conf.py Normal file
View File

@ -0,0 +1,76 @@
# 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.
from __future__ import annotations
from pathlib import Path
from sys import modules
from sys import path as sys_path
sys_path.insert(0, str(Path(__file__).parent.parent.parent))
from src import VERSION # noqa: E402
modules['ManifoldMarketManager'] = modules['src']
# -- Project information -----------------------------------------------------
project = 'ManifoldMarketManager'
copyright = '2022, Olivia Appleton'
author = 'Olivia Appleton'
# The full version, including alpha/beta/rc tags
release = VERSION
# -- 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.autosummary',
'sphinx.ext.autodoc',
'sphinx.ext.coverage',
'sphinx.ext.mathjax',
'sphinx.ext.todo',
'sphinx.ext.viewcode',
]
autosummary_generate = True
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# 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 = ['_build', '_templates']
# -- 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 = 'sphinx_rtd_theme'
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# -- Extension configuration -------------------------------------------------
# -- Options for todo extension ----------------------------------------------
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = True

37
docs/source/index.rst Normal file
View File

@ -0,0 +1,37 @@
Welcome to ManifoldMarketManager's documentation!
=================================================
.. toctree::
.. autosummary::
:toctree: _autosummary
ManifoldMarketManager
ManifoldMarketManager.market
ManifoldMarketManager.consts
ManifoldMarketManager.util
ManifoldMarketManager.caching
ManifoldMarketManager.application
ManifoldMarketManager.account
ManifoldMarketManager.rule
ManifoldMarketManager.rule.abstract
ManifoldMarketManager.rule.generic
ManifoldMarketManager.rule.github
ManifoldMarketManager.rule.manifold
ManifoldMarketManager.rule.manifold.other
ManifoldMarketManager.rule.manifold.this
ManifoldMarketManager.rule.manifold.user
ManifoldMarketManager.test
ManifoldMarketManager.test.test_application
ManifoldMarketManager.test.test_market
ManifoldMarketManager.test.test_rule
ManifoldMarketManager.test.test_util
ManifoldMarketManager.test.rule
ManifoldMarketManager.test.rule.test_generic
ManifoldMarketManager.test.rule.test_github
ManifoldMarketManager.test.rule.manifold
ManifoldMarketManager.test.rule.manifold.test_other
ManifoldMarketManager.test.rule.manifold.test_this
ManifoldMarketManager.test.rule.manifold.test_user
ManifoldMarketManager.test.examples
ManifoldMarketManager.test.examples.test_amplified_odds

7
docs/source/modules.rst Normal file
View File

@ -0,0 +1,7 @@
src
===
.. toctree::
:maxdepth: 4
src

View File

@ -2,7 +2,7 @@
name = ManifoldMarketManager
author = Olivia Appleton
author_email = Liv@OliviaAppleton.com
version = 0.7.0.1
version = 0.7.0.2
description = Tools and market management for manifold.markets
long_description = file: README.md
long_description_content_type = text/markdown

View File

@ -156,7 +156,7 @@ register_converter("Rule", loads)
register_adapter(market.Market, dumps)
register_converter("Market", loads)
VERSION = "0.7.0.1"
VERSION = "0.7.0.2"
__version_info__ = tuple(int(x) for x in VERSION.split('.'))
__all__ = [
"__version_info__", "VERSION", "DoResolveRule", "ResolutionValueRule", "Rule", "Market", "get_client", "rule",
@ -185,5 +185,8 @@ if getenv("DEBUG"): # pragma: no cover
sys.excepthook = info
# dynamically load optional plugins where able to
exempt = {'__init__', '__main__', '__pycache__', 'application', 'test', 'PyManifold', 'py.typed', *__all__}
exempt = {
'__init__', '__main__', '__pycache__', 'application', 'test', 'PyManifold', 'py.typed', 'http_cache.sqlite',
*__all__
}
dynamic_import(__file__, __name__, __all__, exempt)