Skip to content

Commit d2099e0

Browse files
authored
Validate env Hub deployment (#655)
* fix: validate env hub deployment * docs: improve docs structure
1 parent 17cf2fc commit d2099e0

46 files changed

Lines changed: 43617 additions & 454 deletions

File tree

Some content is hidden

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

docs/source/concepts.md

Lines changed: 0 additions & 112 deletions
This file was deleted.

docs/source/conf.py

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -97,23 +97,18 @@
9797
"text": "OpenEnv",
9898
},
9999
"icon_links": [
100-
{
101-
"name": "X",
102-
"url": "https://x.com/PyTorch",
103-
"icon": "fa-brands fa-x-twitter",
104-
},
105100
{
106101
"name": "GitHub",
107102
"url": "https://github.com/meta-pytorch/OpenEnv",
108103
"icon": "fa-brands fa-github",
109104
},
110-
{
111-
"name": "Discourse",
112-
"url": "https://dev-discuss.pytorch.org/",
113-
"icon": "fa-brands fa-discourse",
114-
},
115105
],
116-
"use_edit_page_button": True,
106+
"use_edit_page_button": False,
107+
"secondary_sidebar_items": ["page-toc"],
108+
"article_header_end": [],
109+
"article_footer_items": [],
110+
"show_lf_footer": False,
111+
"show_pytorch_org_link": False,
117112
"switcher": {
118113
"json_url": "_static/versions.json",
119114
"version_match": switcher_version,
@@ -137,7 +132,7 @@
137132

138133
html_context = {
139134
"theme_variables": theme_variables,
140-
"display_github": True,
135+
"display_github": False,
141136
"github_url": "https://github.com",
142137
"github_user": "meta-pytorch",
143138
"github_repo": "OpenEnv",

docs/source/contributing.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
orphan: true
3+
---
4+
15
# Contributing to OpenEnv
26

37
We welcome contributions from the community! OpenEnv is an open-source project and we're excited to have you join us.
@@ -66,14 +70,13 @@ ruff check .
6670
- Add type hints
6771
- Write tests for new functionality
6872

69-
## Community
73+
## Coordination
7074

71-
- [Discord](https://discord.gg/YsTYBh6PD9) - Chat with the community
72-
- [GitHub Discussions](https://github.com/meta-pytorch/OpenEnv/discussions) - Ask questions
75+
Use the [OpenEnv repository](https://github.com/meta-pytorch/OpenEnv) to file
76+
issues, discuss substantial changes, and submit pull requests.
7377

7478
## License
7579

7680
By contributing, you agree that your contributions will be licensed under the same license as the project.
7781

7882
Thank you for contributing! 🙏
79-

docs/source/getting-started.md

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
# Getting Started
2+
3+
Install OpenEnv, load an environment, and run your first step.
4+
5+
## Install OpenEnv
6+
7+
```bash
8+
pip install openenv-core
9+
```
10+
11+
```{note}
12+
This installs the `openenv` CLI and the `openenv.core` runtime. Environment
13+
projects can depend on `openenv-core[core]` when they only need the server and
14+
client libraries.
15+
```
16+
17+
## Try an Environment
18+
19+
Use `AutoEnv` and `AutoAction` when you want OpenEnv to find the matching client
20+
and action classes for an installed or discoverable environment.
21+
22+
```python
23+
from openenv import AutoAction, AutoEnv
24+
25+
env = AutoEnv.from_env("echo")
26+
EchoAction = AutoAction.from_env("echo")
27+
28+
with env.sync() as client:
29+
result = client.reset()
30+
print(result.observation.echoed_message) # "Echo environment ready!"
31+
32+
result = client.step(EchoAction(message="Hello, OpenEnv!"))
33+
print(result.observation.echoed_message) # "Hello, OpenEnv!"
34+
```
35+
36+
`AutoEnv.from_env()` accepts the common name forms:
37+
38+
```python
39+
AutoEnv.from_env("echo")
40+
AutoEnv.from_env("echo-env")
41+
AutoEnv.from_env("echo_env")
42+
```
43+
44+
## Connect to a Running Environment
45+
46+
OpenEnv clients are async by default. Use the async client for production code,
47+
parallel environment runs, and integrations with async frameworks.
48+
49+
```python
50+
import asyncio
51+
52+
from echo_env import EchoAction, EchoEnv
53+
54+
55+
async def main():
56+
async with EchoEnv(base_url="https://openenv-echo-env.hf.space") as client:
57+
result = await client.reset()
58+
print(result.observation.echoed_message)
59+
60+
result = await client.step(EchoAction(message="Hello, World!"))
61+
print(result.reward)
62+
63+
64+
asyncio.run(main())
65+
```
66+
67+
For scripts and notebooks, use `.sync()`:
68+
69+
```python
70+
from echo_env import EchoAction, EchoEnv
71+
72+
with EchoEnv(base_url="https://openenv-echo-env.hf.space").sync() as client:
73+
result = client.reset()
74+
result = client.step(EchoAction(message="Hello, World!"))
75+
print(result.observation.echoed_message)
76+
```
77+
78+
## Use Containers or Local Servers
79+
80+
You can run an environment from a Docker image:
81+
82+
```python
83+
import asyncio
84+
85+
from echo_env import EchoEnv
86+
87+
88+
async def main():
89+
client = await EchoEnv.from_docker_image(
90+
"registry.hf.space/openenv-echo-env:latest"
91+
)
92+
async with client:
93+
result = await client.reset()
94+
print(result.observation)
95+
96+
97+
asyncio.run(main())
98+
```
99+
100+
Or connect to a local server:
101+
102+
```bash
103+
cd path/to/echo-env
104+
uv venv
105+
source .venv/bin/activate
106+
uv pip install -e .
107+
uv run server --host 0.0.0.0 --port 8000
108+
```
109+
110+
```python
111+
from echo_env import EchoEnv
112+
113+
with EchoEnv(base_url="http://localhost:8000").sync() as client:
114+
result = client.reset()
115+
```
116+
117+
## Next Steps
118+
119+
- [Concepts](guides/concepts.md)
120+
- [Explore environments](environments.md)
121+
- [Build your first environment](guides/first-environment.md)

0 commit comments

Comments
 (0)