Suite¶
Types for grouping related environments into reusable, versioned collections.
envrax.suite.EnvSpec
dataclass
¶
Specification for a single environment — the unit of registration.
Holds everything needed to instantiate a registered environment: its
name, the class to construct, and the default config to pass. Used both
as a definition-time artifact (inside EnvSuite.specs) and as the
runtime value stored in the registry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Short name within an |
required |
env_class
|
Type[JaxEnv]
|
Environment class to instantiate. |
required |
default_config
|
EnvConfig
|
Default configuration passed to |
required |
suite
|
str
|
Suite category tag (e.g. |
required |
Source code in envrax/suite.py
| Python | |
|---|---|
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 | |
envrax.suite.EnvSuite
dataclass
¶
A named, versioned collection of environment specs from one suite.
The specs list is the single source of truth for which environments
the suite ships. The envs property derives short names from specs
so that iteration, slicing, and display work without a parallel list.
Subclasses pin prefix, category, version, required_packages
and provide their specs via default_factory. They must also
override get_name to produce canonical IDs (e.g. "mjx/cartpole-v0").
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prefix
|
str
|
Namespace prefix for environment names (e.g. |
required |
category
|
str
|
Human-readable category label (e.g. |
required |
version
|
str
|
Version suffix applied by |
required |
required_packages
|
List[str]
|
Python packages that must be importable for this suite to work. |
required |
specs
|
List[EnvSpec]
|
Environment specifications shipped by this suite. |
required |
Source code in envrax/suite.py
| Python | |
|---|---|
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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | |
envs
property
¶
Short names of all environments in this suite, derived from specs.
n_envs
property
¶
Number of environments in this suite.
get_name(name, version=None)
¶
Return the canonical ID string for a single environment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Short environment name as stored on a spec. |
required |
version
|
str
|
Override the suite's default version suffix. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
canonical |
str
|
Full environment ID (e.g. |
Source code in envrax/suite.py
| Python | |
|---|---|
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | |
all_names(version=None)
¶
Return canonical IDs for every environment in this suite.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
version
|
str
|
Override the suite's default version suffix. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
names |
List[str]
|
One canonical ID per spec. |
Source code in envrax/suite.py
| Python | |
|---|---|
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | |
__contains__(name)
¶
Return True if a short name is in this suite's specs.
Source code in envrax/suite.py
| Python | |
|---|---|
116 117 118 | |
__getitem__(key)
¶
Return a new suite containing only the selected spec(s).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
int | slice
|
Index or slice into |
required |
Returns:
| Name | Type | Description |
|---|---|---|
suite |
EnvSuite
|
Same class as |
Source code in envrax/suite.py
| Python | |
|---|---|
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | |
__iter__()
¶
Yield canonical ID strings for all environments.
Source code in envrax/suite.py
| Python | |
|---|---|
147 148 149 150 | |
__len__()
¶
Return number of environments.
Source code in envrax/suite.py
| Python | |
|---|---|
152 153 154 | |
check()
¶
Check whether each required package is importable.
Returns:
| Name | Type | Description |
|---|---|---|
status |
Dict[str, bool]
|
Mapping of package name → installed flag. |
Source code in envrax/suite.py
| Python | |
|---|---|
156 157 158 159 160 161 162 163 164 165 | |
is_available()
¶
Return True if all required packages are installed.
Returns:
| Name | Type | Description |
|---|---|---|
available |
bool
|
If required packages are installed. |
Source code in envrax/suite.py
| Python | |
|---|---|
167 168 169 170 171 172 173 174 175 176 | |
envrax.suite.EnvSet
¶
An ordered collection of EnvSuite instances.
Combines multiple suites into a single iterable that yields canonical
environment ID strings. Supports merging two EnvSet objects with +.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*suites
|
EnvSuite
|
Variable number of environment suites to combine. |
required |
Source code in envrax/suite.py
| Python | |
|---|---|
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 | |
n_envs
property
¶
Total number of environments across all suites.
suites
property
¶
List of environment suites in this set.
all_names(version=None)
¶
Return canonical IDs for every environment across all suites.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
version
|
str
|
Override the default version suffix for all suites. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
names |
List[str]
|
List of canonical IDs for every environment |
Source code in envrax/suite.py
| Python | |
|---|---|
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 | |
env_categories()
¶
Return a mapping of category name → environment count.
Returns:
| Name | Type | Description |
|---|---|---|
categories |
Dict[str, int]
|
category name → environment count mapping |
Source code in envrax/suite.py
| Python | |
|---|---|
224 225 226 227 228 229 230 231 232 233 234 235 236 | |
__iter__()
¶
Yield canonical ID strings from all suites in order.
Source code in envrax/suite.py
| Python | |
|---|---|
238 239 240 241 | |
__len__()
¶
Total number of environments.
Source code in envrax/suite.py
| Python | |
|---|---|
243 244 245 | |
__add__(other)
¶
Merge two EnvSets into a new one.
Source code in envrax/suite.py
| Python | |
|---|---|
247 248 249 | |
verify_packages()
¶
Verify that every suite has its required packages installed.
Raises:
| Name | Type | Description |
|---|---|---|
error
|
MissingPackageError
|
If any suite has missing required packages. |
Source code in envrax/suite.py
| Python | |
|---|---|
251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 | |