Skip to content

Commit dbc830a

Browse files
authored
Merge pull request #28 from OpenRL-Lab/dev
- add make doc
2 parents e9c310b + 91ffca8 commit dbc830a

File tree

14 files changed

+561
-27
lines changed

14 files changed

+561
-27
lines changed

.readthedocs.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ sphinx:
2727
# Optional but recommended, declare the Python requirements required
2828
# to build your documentation
2929
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
30-
# python:
31-
# install:
32-
# - requirements: docs/requirements.txt
30+
python:
31+
install:
32+
- requirements: docs/requirements.txt

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,9 @@ pypi-test-upload:
2929
twine upload dist/* -r testpypi
3030

3131
pypi-upload:
32-
twine upload dist/*
32+
twine upload dist/*
33+
34+
doc:
35+
$(call check_install, sphinx)
36+
$(call check_install, sphinx_rtd_theme)
37+
cd docs && make html && cd _build/html && python3 -m http.server

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ We provide plugins in [Plugin Store](https://openrl.net/plugin-store/). Users ca
2424
- Check OpenPlugin's version with: `op --version`
2525
- Check system information: `op --system_info`
2626
- Install a plugin: `op install <plugin_name>`. You can also install local plugins with `op install ./`.
27+
- You can also install a plugin from a zip file: `op install <zip_file_path>`.
2728
- Uninstall a plugin: `op uninstall <plugin_name>`
2829
- Start a plugin: `op run <plugin_name>`. You can use `-p` to specify the port of the plugin. By default, the port is 5003. You can also run a local plugin with `op run ./`.
2930
- List installed plugins: `op list`
@@ -35,6 +36,7 @@ We provide plugins in [Plugin Store](https://openrl.net/plugin-store/). Users ca
3536
- Or You can install QRcode_plugin from local:
3637
- Go to the directory of QRcode_plugin: `cd plugins/QRcode_plugin`
3738
- Install QRcode_plugin: `op install ./`
39+
- Or you can install QRcode_plugin from a zip file: `op install QRcode_plugin.zip`
3840
- Start QRcode_plugin: `op run QRcode_plugin -p server_port`
3941
- Or you can start QRcode_plugin from local:
4042
- Go to the directory of QRcode_plugin: `cd plugins/QRcode_plugin`

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = .
9+
BUILDDIR = _build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/_static/css/style.css

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
body {
2+
font-family: "Lato","proxima-nova","Helvetica Neue",Arial,sans-serif;
3+
}
4+
5+
/* Default header fonts are ugly */
6+
h1, h2, .rst-content .toctree-wrapper p.caption, h3, h4, h5, h6, legend, p.caption {
7+
font-family: "Lato","proxima-nova","Helvetica Neue",Arial,sans-serif;
8+
}
9+
10+
/* Use white for docs background */
11+
.wy-side-nav-search {
12+
background-color: #fff;
13+
}
14+
15+
.wy-nav-content {
16+
max-width: 1200px !important;
17+
}
18+
19+
.wy-nav-content-wrap, .wy-menu li.current > a {
20+
background-color: #fff;
21+
}
22+
23+
.wy-side-nav-search>a img.logo {
24+
width: 80%;
25+
margin-top: 10px;
26+
}
27+
28+
@media screen and (min-width: 1400px) {
29+
.wy-nav-content-wrap {
30+
background-color: #fff;
31+
}
32+
33+
.wy-nav-content {
34+
background-color: #fff;
35+
}
36+
}
37+
38+
/* Fixes for mobile */
39+
.wy-nav-top {
40+
background-color: #fff;
41+
/*background-image: url('../images/tianshou-logo.png');*/
42+
background-repeat: no-repeat;
43+
background-position: center;
44+
padding: 0;
45+
margin: 0.4045em 0.809em;
46+
color: #333;
47+
}
48+
49+
.wy-nav-top > a {
50+
display: none;
51+
}
52+
53+
@media screen and (max-width: 768px) {
54+
.wy-side-nav-search>a img.logo {
55+
height: 60px;
56+
}
57+
}
58+
59+
/* This is needed to ensure that logo above search scales properly */
60+
.wy-side-nav-search a {
61+
display: block;
62+
}
63+
64+
/* This ensures that multiple constructors will remain in separate lines. */
65+
.rst-content dl:not(.docutils) dt {
66+
display: table;
67+
}
68+
69+
/* Use our red for literals (it's very similar to the original color) */
70+
.rst-content tt.literal, .rst-content tt.literal, .rst-content code.literal {
71+
color: #4692BC;
72+
}
73+
74+
.rst-content tt.xref, a .rst-content tt, .rst-content tt.xref,
75+
.rst-content code.xref, a .rst-content tt, a .rst-content code {
76+
color: #404040;
77+
}
78+
79+
/* Change link colors (except for the menu) */
80+
81+
a {
82+
color: #4692BC;
83+
}
84+
85+
a:hover {
86+
color: #4692BC;
87+
}
88+
89+
90+
a:visited {
91+
color: #4692BC;
92+
}
93+
94+
.wy-menu a {
95+
color: #b3b3b3;
96+
}
97+
98+
.wy-menu a:hover {
99+
color: #b3b3b3;
100+
}
101+
102+
/* Default footer text is quite big */
103+
footer {
104+
font-size: 80%;
105+
}
106+
107+
footer .rst-footer-buttons {
108+
font-size: 125%; /* revert footer settings - 1/80% = 125% */
109+
}
110+
111+
footer p {
112+
font-size: 100%;
113+
}
114+
115+
.ethical-rtd {
116+
display: none;
117+
}
118+
119+
.ethical-fixedfooter {
120+
display: none;
121+
}
122+
123+
.ethical-content {
124+
display: none;
125+
}
126+
127+
/* For hidden headers that appear in TOC tree */
128+
/* see http://stackoverflow.com/a/32363545/3343043 */
129+
.rst-content .hidden-section {
130+
display: none;
131+
}
132+
133+
nav .hidden-section {
134+
display: inherit;
135+
}
136+
137+
.wy-side-nav-search>div.version {
138+
color: #000;
139+
}
142 KB
Loading

docs/_static/js/benchmark.js

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
var mujoco_envs = [
2+
"Ant-v3",
3+
"HalfCheetah-v3",
4+
"Hopper-v3",
5+
"Humanoid-v3",
6+
"InvertedDoublePendulum-v2",
7+
"InvertedPendulum-v2",
8+
"Reacher-v2",
9+
"Swimmer-v3",
10+
"Walker2d-v3",
11+
];
12+
13+
var atari_envs = [
14+
"PongNoFrameskip-v4",
15+
"BreakoutNoFrameskip-v4",
16+
"EnduroNoFrameskip-v4",
17+
"QbertNoFrameskip-v4",
18+
"MsPacmanNoFrameskip-v4",
19+
"SeaquestNoFrameskip-v4",
20+
"SpaceInvadersNoFrameskip-v4",
21+
];
22+
23+
function showMujocoEnv(elem) {
24+
var selectEnv = elem.value || mujoco_envs[0];
25+
var dataSource = {
26+
$schema: "https://vega.github.io/schema/vega-lite/v5.json",
27+
data: {
28+
// url: "/_static/js/mujoco/benchmark/" + selectEnv + "/result.json"
29+
url: "/en/master/_static/js/mujoco/benchmark/" + selectEnv + "/result.json"
30+
},
31+
mark: "line",
32+
height: 400,
33+
width: 800,
34+
params: [{name: "Range", value: 1000000, bind: {input: "range", min: 10000, max: 10000000}}],
35+
transform: [
36+
{calculate: "datum.rew - datum.rew_std", as: "rew_std0"},
37+
{calculate: "datum.rew + datum.rew_std", as: "rew_std1"},
38+
{calculate: "datum.rew + ' ± ' + datum.rew_std", as: "tooltip_str"},
39+
{filter: "datum.env_step <= Range"},
40+
],
41+
encoding: {
42+
color: {"field": "Agent", "type": "nominal"},
43+
x: {field: "env_step", type: "quantitative", title: "Env step"},
44+
},
45+
layer: [{
46+
"encoding": {
47+
"opacity": {"value": 0.3},
48+
"y": {
49+
"title": "Return",
50+
"field": "rew_std0",
51+
"type": "quantitative",
52+
},
53+
"y2": {"field": "rew_std1"},
54+
tooltip: [
55+
{field: "env_step", type: "quantitative", title: "Env step"},
56+
{field: "Agent", type: "nominal"},
57+
{field: "tooltip_str", type: "nominal", title: "Return"},
58+
]
59+
},
60+
"mark": "area"
61+
}, {
62+
"encoding": {
63+
"y": {
64+
"field": "rew",
65+
"type": "quantitative"
66+
}
67+
},
68+
"mark": "line"
69+
}]
70+
};
71+
vegaEmbed("#vis-mujoco", dataSource);
72+
}
73+
74+
function showAtariEnv(elem) {
75+
var selectEnv = elem.value || atari_envs[0];
76+
var dataSource = {
77+
$schema: "https://vega.github.io/schema/vega-lite/v5.json",
78+
data: {
79+
// url: "/_static/js/atari/benchmark/" + selectEnv + "/result.json"
80+
url: "/en/master/_static/js/atari/benchmark/" + selectEnv + "/result.json"
81+
},
82+
mark: "line",
83+
height: 400,
84+
width: 800,
85+
params: [{name: "Range", value: 10000000, bind: {input: "range", min: 10000, max: 10000000}}],
86+
transform: [
87+
{calculate: "datum.rew - datum.rew_std", as: "rew_std0"},
88+
{calculate: "datum.rew + datum.rew_std", as: "rew_std1"},
89+
{calculate: "datum.rew + ' ± ' + datum.rew_std", as: "tooltip_str"},
90+
{filter: "datum.env_step <= Range"},
91+
],
92+
encoding: {
93+
color: {"field": "Agent", "type": "nominal"},
94+
x: {field: "env_step", type: "quantitative", title: "Env step"},
95+
},
96+
layer: [{
97+
"encoding": {
98+
"opacity": {"value": 0.3},
99+
"y": {
100+
"title": "Return",
101+
"field": "rew_std0",
102+
"type": "quantitative",
103+
},
104+
"y2": {"field": "rew_std1"},
105+
tooltip: [
106+
{field: "env_step", type: "quantitative", title: "Env step"},
107+
{field: "Agent", type: "nominal"},
108+
{field: "tooltip_str", type: "nominal", title: "Return"},
109+
]
110+
},
111+
"mark": "area"
112+
}, {
113+
"encoding": {
114+
"y": {
115+
"field": "rew",
116+
"type": "quantitative"
117+
}
118+
},
119+
"mark": "line"
120+
}]
121+
};
122+
vegaEmbed("#vis-atari", dataSource);
123+
}
124+
125+
$(document).ready(function() {
126+
var envMujocoSelect = $("#env-mujoco");
127+
if (envMujocoSelect.length) {
128+
$.each(mujoco_envs, function(idx, env) {envMujocoSelect.append($("<option></option>").val(env).html(env));})
129+
showMujocoEnv(envMujocoSelect);
130+
}
131+
var envAtariSelect = $("#env-atari");
132+
if (envAtariSelect.length) {
133+
$.each(atari_envs, function(idx, env) {envAtariSelect.append($("<option></option>").val(env).html(env));})
134+
showAtariEnv(envAtariSelect);
135+
}
136+
});

0 commit comments

Comments
 (0)