Skip to content

Commit d683f87

Browse files
authored
Generate API docs with Sphinx (#235)
1 parent 14f354c commit d683f87

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+1834
-923
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,8 @@ __pycache__
1111

1212
# Meld
1313
*.orig
14+
15+
# Docs
16+
entity_gym/docs/build
17+
entity_gym/docs/source/generated
18+
entity_gym/docs/source/entity_gym

.readthedocs.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# .readthedocs.yaml
2+
# Read the Docs configuration file
3+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4+
5+
# Required
6+
version: 2
7+
8+
# Set the version of Python and other tools you might need
9+
build:
10+
os: ubuntu-20.04
11+
tools:
12+
python: "3.9"
13+
# You can also specify other tool versions:
14+
# nodejs: "16"
15+
# rust: "1.55"
16+
# golang: "1.17"
17+
apt_packages:
18+
- graphviz
19+
20+
# Build documentation in the docs/ directory with Sphinx
21+
sphinx:
22+
configuration: entity_gym/docs/source/conf.py
23+
24+
python:
25+
# Install our python package before building the docs
26+
install:
27+
- requirements: entity_gym/docs/requirements.txt
28+
- method: pip
29+
path: entity_gym

CONTRIBUTING.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,25 @@ poetry run pre-commit run --all-files
7474
```bash
7575
poetry run pytest .
7676
```
77+
78+
## Building docs
79+
80+
To build the documentation for entity-gym, go to the entity_gym/docs folder and run the following command:
81+
82+
```bash
83+
poetry run make html
84+
```
85+
86+
You can use [watchexec](https://github.com/watchexec/watchexec) to automatically rebuild the documentation on changes:
87+
88+
```
89+
watchexec -w ../entity_gym -w source -i source/generated -i source/entity_gym -- poetry run make html
90+
```
91+
92+
You can view the generated docs by openaing `entity_gym/docs/build/html` in a browser.
93+
94+
Some files won't be automatically cleaned up after the build, so you can manually clean up the build directory by running:
95+
96+
```
97+
poetry run make clean && rm -rf source/generated source/entity_gym
98+
```

enn_ppo/enn_ppo/agent.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
import torch
66
from ragged_buffer import RaggedBufferBool, RaggedBufferF32, RaggedBufferI64
77

8-
import entity_gym.agent
9-
from entity_gym.environment import Action, Observation, VecActionMask
10-
from entity_gym.environment.env_list import action_index_to_actions
11-
from entity_gym.environment.environment import ActionName
12-
from entity_gym.environment.vec_env import batch_obs
8+
import entity_gym.runner
9+
from entity_gym.env import Action, Observation, VecActionMask
10+
from entity_gym.env.env_list import action_index_to_actions
11+
from entity_gym.env.environment import ActionName
12+
from entity_gym.env.vec_env import batch_obs
1313
from entity_gym.simple_trace import Tracer
1414
from rogue_net.rogue_net import RogueNet
1515

@@ -48,7 +48,7 @@ def get_auxiliary_head(
4848
...
4949

5050

51-
class RogueNetAgent(entity_gym.agent.Agent):
51+
class RogueNetAgent(entity_gym.runner.Agent):
5252
def __init__(self, agent: RogueNet):
5353
self.agent = agent
5454

enn_ppo/enn_ppo/eval.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
from enn_ppo.agent import PPOAgent
1010
from enn_ppo.config import EnvConfig, EvalConfig, RolloutConfig
1111
from enn_ppo.rollout import Rollout
12-
from entity_gym.environment import *
13-
from entity_gym.environment.add_metrics_wrapper import AddMetricsWrapper
12+
from entity_gym.env import *
13+
from entity_gym.env.add_metrics_wrapper import AddMetricsWrapper
1414
from entity_gym.serialization import SampleRecordingVecEnv
1515
from entity_gym.simple_trace import Tracer
1616

enn_ppo/enn_ppo/gae.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import torch
55

66
from enn_ppo.agent import PPOAgent
7-
from entity_gym.environment import *
7+
from entity_gym.env import *
88
from entity_gym.simple_trace import Tracer
99

1010
from .config import *

enn_ppo/enn_ppo/ppo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from ragged_buffer import RaggedBufferF32
55

66
from enn_ppo.config import PPOConfig
7-
from entity_gym.environment.environment import ActionName
7+
from entity_gym.env.environment import ActionName
88
from entity_gym.simple_trace import Tracer
99

1010

enn_ppo/enn_ppo/rollout.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
from ragged_buffer import RaggedBufferBool, RaggedBufferF32, RaggedBufferI64
88

99
from enn_ppo.agent import PPOAgent
10-
from entity_gym.environment import *
11-
from entity_gym.environment.vec_env import Metric
10+
from entity_gym.env import *
11+
from entity_gym.env.vec_env import Metric
1212
from entity_gym.ragged_dict import RaggedActionDict, RaggedBatchDict
1313
from entity_gym.serialization.sample_recorder import SampleRecordingVecEnv
1414
from entity_gym.simple_trace import Tracer

enn_ppo/enn_ppo/supervised.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from ragged_buffer import RaggedBufferBool, RaggedBufferF32, RaggedBufferI64
1414
from torch.optim import AdamW
1515

16-
from entity_gym.environment.vec_env import VecActionMask
16+
from entity_gym.env.vec_env import VecActionMask
1717
from entity_gym.ragged_dict import RaggedActionDict, RaggedBatchDict
1818
from entity_gym.serialization import Trace
1919
from entity_gym.serialization.sample_loader import Episode, MergedSamples

enn_ppo/enn_ppo/train.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
from enn_ppo.gae import returns_and_advantages
2525
from enn_ppo.ppo import ppo_loss, value_loss
2626
from enn_ppo.rollout import Rollout
27-
from entity_gym.environment import *
28-
from entity_gym.environment.add_metrics_wrapper import AddMetricsWrapper
29-
from entity_gym.environment.validator import ValidatingEnv
27+
from entity_gym.env import *
28+
from entity_gym.env.add_metrics_wrapper import AddMetricsWrapper
29+
from entity_gym.env.validator import ValidatingEnv
3030
from entity_gym.examples import ENV_REGISTRY
3131
from entity_gym.serialization import SampleRecordingVecEnv
3232
from entity_gym.simple_trace import Tracer

0 commit comments

Comments
 (0)