mirror of
https://github.com/wassname/optuna-dashboard.git
synced 2026-09-13 12:50:51 +08:00
Merge pull request #399 from c-bata/sphinx-doc
Add Sphinx documentation
This commit is contained in:
@@ -13,3 +13,6 @@ tmp/
|
||||
|
||||
*.sqlite3
|
||||
*.db
|
||||
|
||||
docs/_build/
|
||||
docs/_generated/
|
||||
|
||||
@@ -14,7 +14,7 @@ You can install optuna-dashboard via [PyPI](https://pypi.org/project/optuna-dash
|
||||
$ pip install optuna-dashboard
|
||||
```
|
||||
|
||||
Also you can install following optional dependencies to make optuna-dashboard faster.
|
||||
Also, you can install following optional dependencies to make optuna-dashboard faster.
|
||||
|
||||
```console
|
||||
$ pip install optuna-fast-fanova gunicorn
|
||||
|
||||
@@ -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)
|
||||
Vendored
+173
@@ -0,0 +1,173 @@
|
||||
/* Parameter names and colons after them in a signature */
|
||||
em.sig-param > span:nth-child(1),
|
||||
em.sig-param > span:nth-child(2) {
|
||||
color: #555555;
|
||||
}
|
||||
|
||||
/* Type hints and default values in a signature */
|
||||
em.sig-param > span:not(:nth-child(1)):not(:nth-child(2)) {
|
||||
color: #2980b9;
|
||||
}
|
||||
|
||||
/* Internal links in a signature */
|
||||
.rst-content dl.class > dt a.reference.internal,
|
||||
.rst-content dl.method > dt a.reference.internal,
|
||||
.rst-content dl.function > dt a.reference.internal {
|
||||
color: #2980b9;
|
||||
}
|
||||
|
||||
/* External links in a signature */
|
||||
.rst-content dl.class > dt a.reference.external,
|
||||
.rst-content dl.method > dt a.reference.external,
|
||||
.rst-content dl.function > dt a.reference.external {
|
||||
color: #2980b9;
|
||||
}
|
||||
|
||||
/* Containers for a signature */
|
||||
.rst-content dl.class > dt,
|
||||
.rst-content dl.function > dt {
|
||||
background-color: #f0f0f0;
|
||||
}
|
||||
|
||||
/* Containers for methods, properties, parameters, and returns */
|
||||
.rst-content dl:not(.docutils) dl dt {
|
||||
border-left: solid 3px #6ab0de;
|
||||
}
|
||||
|
||||
/* Main content */
|
||||
.wy-nav-content {
|
||||
max-width: 1200px;
|
||||
}
|
||||
|
||||
/* Sidebar header (and topbar for mobile) */
|
||||
.wy-side-nav-search,
|
||||
.wy-nav-top {
|
||||
background: #f1f3f4;
|
||||
}
|
||||
.wy-side-nav-search div.version {
|
||||
color: #404040;
|
||||
}
|
||||
|
||||
.wy-nav-top a {
|
||||
color: #404040;
|
||||
}
|
||||
|
||||
.wy-nav-top i {
|
||||
color: #404040;
|
||||
}
|
||||
|
||||
/* Sidebar */
|
||||
.wy-nav-side {
|
||||
background: #f1f3f4;
|
||||
}
|
||||
|
||||
/* A tag */
|
||||
.wy-menu-vertical a {
|
||||
color: #707070;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #2ba9cd;
|
||||
}
|
||||
|
||||
.wy-menu-vertical a:active {
|
||||
background-color: #2ba9cd;
|
||||
cursor: pointer;
|
||||
color: #f1f3f4;
|
||||
}
|
||||
|
||||
.highlight {
|
||||
background: #f1f3f4;
|
||||
}
|
||||
|
||||
.navbar {
|
||||
background: #ffffff;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 896px) {
|
||||
.navbar {
|
||||
height: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.navbar-nav {
|
||||
background: #ffffff;
|
||||
list-style: none;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
padding: 20px;
|
||||
max-width: 1200px;
|
||||
margin-left: 300px;
|
||||
}
|
||||
|
||||
.ml-auto {
|
||||
margin-left: auto !important;
|
||||
}
|
||||
|
||||
.header_link {
|
||||
margin: 15px 2px;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
padding: 0.5rem 0.8rem 0.5rem 0.5rem;
|
||||
color: #636a73;
|
||||
}
|
||||
|
||||
.navbar-nav a:focus,
|
||||
a:hover {
|
||||
color: #2ba9cd;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.navbar-nav a:visited {
|
||||
color: #636a73;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.wy-alert.wy-alert-info .wy-alert-title,
|
||||
.rst-content .note .wy-alert-title,
|
||||
.rst-content .wy-alert-info.attention .wy-alert-title,
|
||||
.rst-content .wy-alert-info.caution .wy-alert-title,
|
||||
.rst-content .wy-alert-info.danger .wy-alert-title,
|
||||
.rst-content .wy-alert-info.error .wy-alert-title,
|
||||
.rst-content .wy-alert-info.hint .wy-alert-title,
|
||||
.rst-content .wy-alert-info.important .wy-alert-title,
|
||||
.rst-content .wy-alert-info.tip .wy-alert-title,
|
||||
.rst-content .wy-alert-info.warning .wy-alert-title,
|
||||
.rst-content .seealso .wy-alert-title,
|
||||
.rst-content .wy-alert-info.admonition-todo .wy-alert-title,
|
||||
.rst-content .wy-alert-info.admonition .wy-alert-title,
|
||||
.wy-alert.wy-alert-info .rst-content .admonition-title,
|
||||
.rst-content .wy-alert.wy-alert-info .admonition-title,
|
||||
.rst-content .note .admonition-title,
|
||||
.rst-content .wy-alert-info.attention .admonition-title,
|
||||
.rst-content .wy-alert-info.caution .admonition-title,
|
||||
.rst-content .wy-alert-info.danger .admonition-title,
|
||||
.rst-content .wy-alert-info.error .admonition-title,
|
||||
.rst-content .wy-alert-info.hint .admonition-title,
|
||||
.rst-content .wy-alert-info.important .admonition-title,
|
||||
.rst-content .wy-alert-info.tip .admonition-title,
|
||||
.rst-content .wy-alert-info.warning .admonition-title,
|
||||
.rst-content .seealso .admonition-title,
|
||||
.rst-content .wy-alert-info.admonition-todo .admonition-title,
|
||||
.rst-content .wy-alert-info.admonition .admonition-title {
|
||||
background: #2ba9cd;
|
||||
}
|
||||
|
||||
.wy-alert,
|
||||
.rst-content .note,
|
||||
.rst-content .attention,
|
||||
.rst-content .caution,
|
||||
.rst-content .danger,
|
||||
.rst-content .error,
|
||||
.rst-content .hint,
|
||||
.rst-content .important,
|
||||
.rst-content .tip,
|
||||
.rst-content .warning,
|
||||
.rst-content .seealso,
|
||||
.rst-content .admonition-todo,
|
||||
.rst-content .admonition {
|
||||
background: #f1f3f4;
|
||||
}
|
||||
Vendored
BIN
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
Vendored
BIN
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
@@ -0,0 +1,40 @@
|
||||
.. module:: optuna_dashboard
|
||||
|
||||
API Reference
|
||||
=============
|
||||
|
||||
General APIs
|
||||
------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: _generated/
|
||||
:nosignatures:
|
||||
|
||||
optuna_dashboard.run_server
|
||||
optuna_dashboard.wsgi
|
||||
optuna_dashboard.set_objective_names
|
||||
optuna_dashboard.save_note
|
||||
|
||||
Human-in-the-loop
|
||||
-----------------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: _generated/
|
||||
:nosignatures:
|
||||
|
||||
optuna_dashboard.register_objective_form_widgets
|
||||
optuna_dashboard.ObjectiveChoiceWidget
|
||||
optuna_dashboard.ObjectiveSliderWidget
|
||||
optuna_dashboard.ObjectiveTextInputWidget
|
||||
optuna_dashboard.ObjectiveUserAttrRef
|
||||
|
||||
Artifact
|
||||
--------
|
||||
|
||||
.. autosummary::
|
||||
:toctree: _generated/
|
||||
:nosignatures:
|
||||
|
||||
optuna_dashboard.artifact.upload_artifact
|
||||
optuna_dashboard.artifact.file_system.FileSystemBackend
|
||||
optuna_dashboard.artifact.boto3.Boto3Backend
|
||||
@@ -0,0 +1,47 @@
|
||||
# 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
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
# -- Project information -----------------------------------------------------
|
||||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
|
||||
|
||||
project = "Optuna Dashboard"
|
||||
copyright = "2023, Optuna Dashboard Contributors"
|
||||
author = "Optuna Dashboard Contributors."
|
||||
|
||||
# -- General configuration ---------------------------------------------------
|
||||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
|
||||
|
||||
SOURCE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__name__)))
|
||||
sys.path.insert(0, SOURCE_DIR)
|
||||
|
||||
extensions = [
|
||||
"sphinx.ext.autodoc",
|
||||
"sphinx.ext.doctest",
|
||||
"sphinx.ext.autosummary",
|
||||
]
|
||||
|
||||
templates_path = ["_templates"]
|
||||
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
|
||||
|
||||
autosummary_generate = True
|
||||
autodoc_typehints = "description"
|
||||
autodoc_default_options = {
|
||||
"members": True,
|
||||
"inherited-members": True,
|
||||
"exclude-members": "with_traceback",
|
||||
}
|
||||
|
||||
# -- Options for HTML output -------------------------------------------------
|
||||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
|
||||
|
||||
html_theme = "sphinx_rtd_theme"
|
||||
html_theme_options = {"logo_only": True, "navigation_with_keys": True}
|
||||
html_static_path = ["_static"]
|
||||
html_favicon = "_static/favicon.ico"
|
||||
html_logo = "_static/optuna-logo.png"
|
||||
html_css_files = ["css/custom.css"]
|
||||
@@ -0,0 +1,30 @@
|
||||
.. Optuna Dashboard documentation master file, created by
|
||||
sphinx-quickstart on Wed Feb 15 17:27:09 2023.
|
||||
You can adapt this file completely to your liking, but it should at least
|
||||
contain the root `toctree` directive.
|
||||
|
||||
Optuna Dashboard
|
||||
================
|
||||
|
||||
Real-time dashboard for `Optuna <https://github.com/optuna/optuna>`_.
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 3
|
||||
:caption: Contents:
|
||||
|
||||
installation
|
||||
api
|
||||
|
||||
|
||||
Links
|
||||
=====
|
||||
|
||||
* `Github <https://github.com/optuna/optuna-dashboard>`_
|
||||
* `PyPI <https://pypi.python.org/pypi/optuna-dashboard>`_
|
||||
|
||||
Indices and tables
|
||||
==================
|
||||
|
||||
* :ref:`genindex`
|
||||
* :ref:`modindex`
|
||||
* :ref:`search`
|
||||
@@ -0,0 +1,17 @@
|
||||
Installation
|
||||
============
|
||||
|
||||
Optuna Dashboard supports Python 3.7 or newer.
|
||||
|
||||
We recommend to install Optuna via pip:
|
||||
You can install optuna-dashboard via `PyPI <https://pypi.org/project/optuna-dashboard/>`_ or `Anaconda Cloud <https://anaconda.org/conda-forge/optuna-dashboard>`_.
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ pip install optuna-dashboard
|
||||
|
||||
Also, you can install following optional dependencies to make optuna-dashboard faster.
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ pip install optuna-fast-fanova gunicorn
|
||||
@@ -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
|
||||
@@ -511,9 +511,12 @@ def run_server(
|
||||
artifact_backend: Optional[ArtifactBackend] = None,
|
||||
) -> None:
|
||||
"""Start running optuna-dashboard and blocks until the server terminates.
|
||||
|
||||
This function uses wsgiref module which is not intended for the production
|
||||
use. If you want to run optuna-dashboard more secure and/or more fast,
|
||||
please use WSGI server like Gunicorn or uWSGI via `wsgi()` function.
|
||||
please use WSGI server like Gunicorn or uWSGI via :func:`wsgi` function.
|
||||
|
||||
|
||||
"""
|
||||
app = create_app(get_storage(storage), artifact_backend=artifact_backend)
|
||||
run(app, host=host, port=port)
|
||||
|
||||
@@ -6,6 +6,24 @@ from typing import TYPE_CHECKING
|
||||
|
||||
|
||||
class FileSystemBackend:
|
||||
"""An artifact backend for file systems.
|
||||
|
||||
Example:
|
||||
.. code-block:: python
|
||||
|
||||
import optuna
|
||||
from optuna_dashboard.artifact import upload_artifact
|
||||
from optuna_dashboard.artifact.file_system import FileSystemBackend
|
||||
|
||||
artifact_backend = FileSystemBackend("./artifacts")
|
||||
|
||||
def objective(trial: optuna.Trial) -> float:
|
||||
... = trial.suggest_float("x", -10, 10)
|
||||
file_path = generate_example_png(...)
|
||||
upload_artifact(artifact_backend, trial, file_path)
|
||||
return ...
|
||||
"""
|
||||
|
||||
def __init__(self, base_path: str) -> None:
|
||||
self._base_path = base_path
|
||||
|
||||
|
||||
@@ -17,3 +17,7 @@ moto[s3]
|
||||
|
||||
# visual regression tests
|
||||
pyppeteer
|
||||
|
||||
# docs
|
||||
sphinx
|
||||
sphinx_rtd_theme
|
||||
|
||||
Reference in New Issue
Block a user