File size: 2,035 Bytes
c8e832f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# 03. Building Environments

Source:
- https://meta-pytorch.org/OpenEnv/auto_getting_started/plot_03_building_environments.html



## Main idea



This page describes the standard OpenEnv project structure and how to build a custom environment from scratch.



## Standard project layout



The docs show a layout like:



```text

my_game/
β”œβ”€β”€ __init__.py
β”œβ”€β”€ models.py
β”œβ”€β”€ client.py
β”œβ”€β”€ openenv.yaml
β”œβ”€β”€ README.md
└── server/
    β”œβ”€β”€ __init__.py

    β”œβ”€β”€ environment.py

    β”œβ”€β”€ app.py

    β”œβ”€β”€ Dockerfile

    └── requirements.txt

```


## Responsibilities by file

### `models.py`

Defines typed:

- actions
- observations
- state-related payloads

This is the contract layer.

### `client.py`

Defines the client used by agents and evaluation scripts.

This should:

- convert actions into payloads
- parse observations from responses
- expose a clean local Python API

### `server/environment.py`

Defines the actual environment logic:

- reset behavior
- step behavior
- state tracking

This is the heart of the environment.

### `server/app.py`

Exposes the environment through FastAPI/OpenEnv.

This is the transport layer, not the logic layer.

### `server/Dockerfile`

Defines how the environment runs reproducibly in a container.

### `openenv.yaml`

Defines the environment manifest and deployment metadata.

## Key lesson

The docs separate:

- contracts
- logic
- transport
- packaging

That separation is what makes environments maintainable and deployable.

## What this means for `python_env`



Your repo already follows this pattern reasonably well:



- `models.py`

- `client.py`

- `server/code_review_environment.py`

- `server/app.py`

- `server/Dockerfile`

- `openenv.yaml`



The main thing to protect is that no single file should try to do everything.



For hackathon quality, this page matters because judges will look for clean structure, not just working behavior.