mujorax 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. mujorax-0.1.0/.github/CODEOWNERS +1 -0
  2. mujorax-0.1.0/.github/workflows/docs.yml +41 -0
  3. mujorax-0.1.0/.github/workflows/publish.yml +45 -0
  4. mujorax-0.1.0/.gitignore +219 -0
  5. mujorax-0.1.0/.python-version +1 -0
  6. mujorax-0.1.0/LICENSE +21 -0
  7. mujorax-0.1.0/PKG-INFO +149 -0
  8. mujorax-0.1.0/README.md +121 -0
  9. mujorax-0.1.0/docs/CNAME +1 -0
  10. mujorax-0.1.0/docs/_extensions/docstring_polish.py +70 -0
  11. mujorax-0.1.0/docs/_templates/python/material/docstring/raises.html.jinja +114 -0
  12. mujorax-0.1.0/docs/api/environments/acrobot.md +5 -0
  13. mujorax-0.1.0/docs/api/environments/ball_in_cup.md +3 -0
  14. mujorax-0.1.0/docs/api/environments/base.md +9 -0
  15. mujorax-0.1.0/docs/api/environments/cartpole.md +9 -0
  16. mujorax-0.1.0/docs/api/environments/cheetah.md +3 -0
  17. mujorax-0.1.0/docs/api/environments/finger.md +7 -0
  18. mujorax-0.1.0/docs/api/environments/fish.md +3 -0
  19. mujorax-0.1.0/docs/api/environments/hopper.md +5 -0
  20. mujorax-0.1.0/docs/api/environments/humanoid.md +7 -0
  21. mujorax-0.1.0/docs/api/environments/pendulum.md +3 -0
  22. mujorax-0.1.0/docs/api/environments/point_mass.md +3 -0
  23. mujorax-0.1.0/docs/api/environments/reacher.md +5 -0
  24. mujorax-0.1.0/docs/api/environments/swimmer.md +3 -0
  25. mujorax-0.1.0/docs/api/environments/walker.md +7 -0
  26. mujorax-0.1.0/docs/api/index.md +32 -0
  27. mujorax-0.1.0/docs/api/registry.md +5 -0
  28. mujorax-0.1.0/docs/assets/css/icons.css +43 -0
  29. mujorax-0.1.0/docs/assets/imgs/envs/acrobot_swingup.gif +0 -0
  30. mujorax-0.1.0/docs/assets/imgs/envs/acrobot_swingup_sparse.gif +0 -0
  31. mujorax-0.1.0/docs/assets/imgs/envs/ball_in_cup.gif +0 -0
  32. mujorax-0.1.0/docs/assets/imgs/envs/cartpole_balance.gif +0 -0
  33. mujorax-0.1.0/docs/assets/imgs/envs/cartpole_balance_sparse.gif +0 -0
  34. mujorax-0.1.0/docs/assets/imgs/envs/cartpole_swingup.gif +0 -0
  35. mujorax-0.1.0/docs/assets/imgs/envs/cartpole_swingup_sparse.gif +0 -0
  36. mujorax-0.1.0/docs/assets/imgs/envs/cheetah_run.gif +0 -0
  37. mujorax-0.1.0/docs/assets/imgs/envs/finger_spin.gif +0 -0
  38. mujorax-0.1.0/docs/assets/imgs/envs/finger_turn_easy.gif +0 -0
  39. mujorax-0.1.0/docs/assets/imgs/envs/finger_turn_hard.gif +0 -0
  40. mujorax-0.1.0/docs/assets/imgs/envs/fish_swim.gif +0 -0
  41. mujorax-0.1.0/docs/assets/imgs/envs/hopper_hop.gif +0 -0
  42. mujorax-0.1.0/docs/assets/imgs/envs/hopper_stand.gif +0 -0
  43. mujorax-0.1.0/docs/assets/imgs/envs/humanoid_run.gif +0 -0
  44. mujorax-0.1.0/docs/assets/imgs/envs/humanoid_stand.gif +0 -0
  45. mujorax-0.1.0/docs/assets/imgs/envs/humanoid_walk.gif +0 -0
  46. mujorax-0.1.0/docs/assets/imgs/envs/pendulum_swingup.gif +0 -0
  47. mujorax-0.1.0/docs/assets/imgs/envs/point_mass.gif +0 -0
  48. mujorax-0.1.0/docs/assets/imgs/envs/reacher_easy.gif +0 -0
  49. mujorax-0.1.0/docs/assets/imgs/envs/reacher_hard.gif +0 -0
  50. mujorax-0.1.0/docs/assets/imgs/envs/swimmer_swimmer6.gif +0 -0
  51. mujorax-0.1.0/docs/assets/imgs/envs/walker_run.gif +0 -0
  52. mujorax-0.1.0/docs/assets/imgs/envs/walker_stand.gif +0 -0
  53. mujorax-0.1.0/docs/assets/imgs/envs/walker_walk.gif +0 -0
  54. mujorax-0.1.0/docs/assets/imgs/favicon.png +0 -0
  55. mujorax-0.1.0/docs/assets/imgs/main.png +0 -0
  56. mujorax-0.1.0/docs/environments/acrobot.md +118 -0
  57. mujorax-0.1.0/docs/environments/ball_in_cup.md +57 -0
  58. mujorax-0.1.0/docs/environments/cartpole.md +229 -0
  59. mujorax-0.1.0/docs/environments/cheetah.md +64 -0
  60. mujorax-0.1.0/docs/environments/finger.md +165 -0
  61. mujorax-0.1.0/docs/environments/fish.md +63 -0
  62. mujorax-0.1.0/docs/environments/hopper.md +119 -0
  63. mujorax-0.1.0/docs/environments/humanoid.md +218 -0
  64. mujorax-0.1.0/docs/environments/index.md +149 -0
  65. mujorax-0.1.0/docs/environments/pendulum.md +56 -0
  66. mujorax-0.1.0/docs/environments/point_mass.md +61 -0
  67. mujorax-0.1.0/docs/environments/reacher.md +113 -0
  68. mujorax-0.1.0/docs/environments/swimmer.md +64 -0
  69. mujorax-0.1.0/docs/environments/walker.md +193 -0
  70. mujorax-0.1.0/docs/index.md +73 -0
  71. mujorax-0.1.0/docs/license.md +27 -0
  72. mujorax-0.1.0/docs/starting/index.md +161 -0
  73. mujorax-0.1.0/docs/tutorials/essentials/configuration.md +131 -0
  74. mujorax-0.1.0/docs/tutorials/essentials/rendering.md +165 -0
  75. mujorax-0.1.0/docs/tutorials/essentials/using-environments.md +200 -0
  76. mujorax-0.1.0/docs/tutorials/index.md +35 -0
  77. mujorax-0.1.0/mkdocs.yml +134 -0
  78. mujorax-0.1.0/mujorax/__init__.py +67 -0
  79. mujorax-0.1.0/mujorax/envs/__init__.py +62 -0
  80. mujorax-0.1.0/mujorax/envs/_base.py +350 -0
  81. mujorax-0.1.0/mujorax/envs/acrobot.py +33 -0
  82. mujorax-0.1.0/mujorax/envs/ball_in_cup.py +17 -0
  83. mujorax-0.1.0/mujorax/envs/cartpole.py +65 -0
  84. mujorax-0.1.0/mujorax/envs/cheetah.py +16 -0
  85. mujorax-0.1.0/mujorax/envs/finger.py +48 -0
  86. mujorax-0.1.0/mujorax/envs/fish.py +17 -0
  87. mujorax-0.1.0/mujorax/envs/hopper.py +33 -0
  88. mujorax-0.1.0/mujorax/envs/humanoid.py +49 -0
  89. mujorax-0.1.0/mujorax/envs/pendulum.py +17 -0
  90. mujorax-0.1.0/mujorax/envs/point_mass.py +17 -0
  91. mujorax-0.1.0/mujorax/envs/reacher.py +33 -0
  92. mujorax-0.1.0/mujorax/envs/swimmer.py +17 -0
  93. mujorax-0.1.0/mujorax/envs/walker.py +49 -0
  94. mujorax-0.1.0/mujorax/suite.py +192 -0
  95. mujorax-0.1.0/pyproject.toml +74 -0
  96. mujorax-0.1.0/tests/__init__.py +0 -0
  97. mujorax-0.1.0/tests/conftest.py +17 -0
  98. mujorax-0.1.0/tests/test_base.py +10 -0
  99. mujorax-0.1.0/tests/test_multi.py +123 -0
  100. mujorax-0.1.0/tests/test_smoke.py +114 -0
  101. mujorax-0.1.0/uv.lock +2106 -0
@@ -0,0 +1 @@
1
+ * @achronus
@@ -0,0 +1,41 @@
1
+ name: Mkdocs Build
2
+
3
+ on:
4
+ workflow_dispatch:
5
+
6
+ permissions:
7
+ contents: write
8
+
9
+ jobs:
10
+ deploy:
11
+ name: Deploy MkDocs to GitHub Pages
12
+ runs-on: ubuntu-latest
13
+
14
+ steps:
15
+ - uses: actions/checkout@v6
16
+
17
+ - name: Configure Git Credentials
18
+ run: |
19
+ git config user.name github-actions[bot]
20
+ git config user.email 41898282+github-actions[bot]@users.noreply.github.com
21
+
22
+ - name: Install uv
23
+ uses: astral-sh/setup-uv@v8.1.0
24
+ with:
25
+ python-version: "3.13"
26
+ enable-cache: true
27
+
28
+ - run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
29
+
30
+ - uses: actions/cache@v5
31
+ with:
32
+ key: mkdocs-material-${{ env.cache_id }}
33
+ path: .cache
34
+ restore-keys: |
35
+ mkdocs-material-
36
+
37
+ - name: Install dependencies
38
+ run: uv sync --group docs
39
+
40
+ - name: Deploy MkDocs
41
+ run: uv run mkdocs gh-deploy --force
@@ -0,0 +1,45 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ tag:
7
+ description: "Release tag to publish (e.g. v0.1.0)"
8
+ required: true
9
+ type: string
10
+
11
+ permissions:
12
+ contents: read
13
+
14
+ jobs:
15
+ publish:
16
+ name: Publish to PyPI
17
+ runs-on: ubuntu-latest
18
+
19
+ steps:
20
+ - uses: actions/checkout@v6
21
+ with:
22
+ ref: ${{ inputs.tag }}
23
+
24
+ - name: Install uv
25
+ uses: astral-sh/setup-uv@v8.1.0
26
+ with:
27
+ python-version: "3.13"
28
+ enable-cache: true
29
+
30
+ - name: Build package
31
+ run: uv build
32
+
33
+ - name: Verify artifacts
34
+ run: |
35
+ if [ -z "$(ls dist/*.whl 2>/dev/null)" ]; then
36
+ echo "ERROR: No wheel found in dist/"
37
+ exit 1
38
+ fi
39
+ echo "Built artifacts:"
40
+ ls -la dist/
41
+
42
+ - name: Publish to PyPI
43
+ run: uv publish
44
+ env:
45
+ UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
@@ -0,0 +1,219 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ .jax_cache/
47
+ nosetests.xml
48
+ coverage.xml
49
+ *.cover
50
+ *.py.cover
51
+ .hypothesis/
52
+ .pytest_cache/
53
+ cover/
54
+
55
+ # Translations
56
+ *.mo
57
+ *.pot
58
+
59
+ # Django stuff:
60
+ *.log
61
+ local_settings.py
62
+ db.sqlite3
63
+ db.sqlite3-journal
64
+
65
+ # Flask stuff:
66
+ instance/
67
+ .webassets-cache
68
+
69
+ # Scrapy stuff:
70
+ .scrapy
71
+
72
+ # Sphinx documentation
73
+ docs/_build/
74
+
75
+ # PyBuilder
76
+ .pybuilder/
77
+ target/
78
+
79
+ # Jupyter Notebook
80
+ .ipynb_checkpoints
81
+
82
+ # IPython
83
+ profile_default/
84
+ ipython_config.py
85
+
86
+ # pyenv
87
+ # For a library or package, you might want to ignore these files since the code is
88
+ # intended to run in multiple environments; otherwise, check them in:
89
+ # .python-version
90
+
91
+ # pipenv
92
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
93
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
94
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
95
+ # install all needed dependencies.
96
+ # Pipfile.lock
97
+
98
+ # UV
99
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
100
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
101
+ # commonly ignored for libraries.
102
+ # uv.lock
103
+
104
+ # poetry
105
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
106
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
107
+ # commonly ignored for libraries.
108
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
109
+ # poetry.lock
110
+ # poetry.toml
111
+
112
+ # pdm
113
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
114
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
115
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
116
+ # pdm.lock
117
+ # pdm.toml
118
+ .pdm-python
119
+ .pdm-build/
120
+
121
+ # pixi
122
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
123
+ # pixi.lock
124
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
125
+ # in the .venv directory. It is recommended not to include this directory in version control.
126
+ .pixi
127
+
128
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
129
+ __pypackages__/
130
+
131
+ # Celery stuff
132
+ celerybeat-schedule
133
+ celerybeat.pid
134
+
135
+ # Redis
136
+ *.rdb
137
+ *.aof
138
+ *.pid
139
+
140
+ # RabbitMQ
141
+ mnesia/
142
+ rabbitmq/
143
+ rabbitmq-data/
144
+
145
+ # ActiveMQ
146
+ activemq-data/
147
+
148
+ # SageMath parsed files
149
+ *.sage.py
150
+
151
+ # Environments
152
+ .env
153
+ .envrc
154
+ .venv
155
+ env/
156
+ venv/
157
+ ENV/
158
+ env.bak/
159
+ venv.bak/
160
+
161
+ # Spyder project settings
162
+ .spyderproject
163
+ .spyproject
164
+
165
+ # Rope project settings
166
+ .ropeproject
167
+
168
+ # mkdocs documentation
169
+ /site
170
+
171
+ # mypy
172
+ .mypy_cache/
173
+ .dmypy.json
174
+ dmypy.json
175
+
176
+ # Pyre type checker
177
+ .pyre/
178
+
179
+ # pytype static type analyzer
180
+ .pytype/
181
+
182
+ # Cython debug symbols
183
+ cython_debug/
184
+
185
+ # PyCharm
186
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
187
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
188
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
189
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
190
+ # .idea/
191
+
192
+ # Abstra
193
+ # Abstra is an AI-powered process automation framework.
194
+ # Ignore directories containing user credentials, local state, and settings.
195
+ # Learn more at https://abstra.io/docs
196
+ .abstra/
197
+
198
+ # Visual Studio Code
199
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
200
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
201
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
202
+ # you could uncomment the following to ignore the entire vscode folder
203
+ # .vscode/
204
+ # Temporary file for partial code execution
205
+ tempCodeRunnerFile.py
206
+
207
+ # Ruff stuff:
208
+ .ruff_cache/
209
+
210
+ # PyPI configuration file
211
+ .pypirc
212
+
213
+ # Marimo
214
+ marimo/_static/
215
+ marimo/_lsp/
216
+ __marimo__/
217
+
218
+ # Streamlit
219
+ .streamlit/secrets.toml
@@ -0,0 +1 @@
1
+ 3.13.9
mujorax-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Achronus
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
mujorax-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,149 @@
1
+ Metadata-Version: 2.4
2
+ Name: mujorax
3
+ Version: 0.1.0
4
+ Summary: A JAX-native MuJoCo environment suite for Envrax.
5
+ Project-URL: Homepage, https://github.com/Achronus/mujorax
6
+ Project-URL: Documentation, https://mujorax.achronus.dev/
7
+ Project-URL: Repository, https://github.com/Achronus/mujorax
8
+ Author-email: Ryan Partridge <codemonkey37@proton.me>
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Natural Language :: English
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
20
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
21
+ Classifier: Topic :: Software Development
22
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Classifier: Typing :: Typed
24
+ Requires-Python: <4.0,>=3.13
25
+ Requires-Dist: envrax==0.1.5
26
+ Requires-Dist: playground>=0.2.0
27
+ Description-Content-Type: text/markdown
28
+
29
+ ![Logo](https://raw.githubusercontent.com/Achronus/mujorax/main/docs/assets/imgs/main.png)
30
+
31
+ ![Python Version](https://img.shields.io/pypi/pyversions/mujorax)
32
+ ![License](https://img.shields.io/github/license/Achronus/mujorax)
33
+
34
+ Mujorax is a lightweight open-source JAX-native MuJoCo environment suite for single-agent Reinforcement Learning (RL), built on top of [Envrax](https://github.com/Achronus/envrax). It wraps [MuJoCo Playground](https://github.com/google-deepmind/mujoco_playground) environments with Envrax's `JaxEnv` so you can use them with `envrax.make`, `envrax.make_vec`, and the rest of Envrax's tooling.
35
+
36
+ It comes with __25 environments from the DM Control Suite__. All environment logic follows a *stateless functional design* that builds on top of the [MJX](https://github.com/google-deepmind/mujoco), [JAX](https://github.com/jax-ml/jax), and [Chex](https://github.com/google-deepmind/chex) packages to benefit from JAX accelerator efficiency.
37
+
38
+ ## Why Mujorax?
39
+
40
+ [Envrax](https://github.com/Achronus/envrax) provides a JAX-native [Gymnasium-style](https://gymnasium.farama.org/) API standard for RL environments, but it doesn't ship with any environments of its own. One of the biggest spaces in RL is robotics, and the gold-standard physics engine for this is [MuJoCo](https://github.com/google-deepmind/mujoco). This makes it the perfect fit for one of the first Envrax environment suites!
41
+
42
+ [MuJoCo Playground](https://github.com/google-deepmind/mujoco_playground) is Google DeepMind's open-source library of MuJoCo environments, built on top of [MJX](https://github.com/google-deepmind/mujoco) (MuJoCo's JAX port that preserves the simulator's full physics fidelity). It already solves the hard parts: research-validated reward and termination logic for DM Control, locomotion, and manipulation environments. The only catch is that its environments expose a Brax-style `MjxEnv` API, which doesn't quite fit Envrax's API standard.
43
+
44
+ Rather than reinventing the wheel, Mujorax acts as a thin, type-safe wrapper around the MuJoCo Playground environments to maximise their benefits while maintaining Envrax's API standard, making it completely plug-and-play with Envrax's toolkit.
45
+
46
+ ## Requirements
47
+
48
+ - Python 3.13+
49
+ - JAX 0.9+ (CPU, CUDA, or TPU backend)
50
+
51
+ ## Installation
52
+
53
+ ```bash
54
+ pip install mujorax
55
+ ```
56
+
57
+ Or with [uv](https://docs.astral.sh/uv/):
58
+
59
+ ```bash
60
+ uv add mujorax
61
+ ```
62
+
63
+ ## Quick Start
64
+
65
+ ```python
66
+ import jax
67
+ import mujorax # registers the suite at import
68
+ import envrax
69
+
70
+ env = envrax.make("mjx/cartpole_balance-v0")
71
+ obs, state = env.reset(jax.random.PRNGKey(0))
72
+
73
+ action = env.action_space.sample(jax.random.PRNGKey(1))
74
+ obs, state, reward, done, info = env.step(state, action)
75
+ ```
76
+
77
+ Vectorised rollouts work the same way:
78
+
79
+ ```python
80
+ env = envrax.make_vec("mjx/cartpole_balance-v0", n_envs=128)
81
+ obs, state = env.reset(jax.random.PRNGKey(0)) # obs.shape == (128, 5)
82
+ ```
83
+
84
+ You can also use `make_multi` to utilise several heterogeneous environments at once:
85
+
86
+ ```python
87
+ env = envrax.make_multi([
88
+ "mjx/cartpole_balance-v0",
89
+ "mjx/cheetah_run-v0",
90
+ ])
91
+ obs_list, state_list = env.reset(jax.random.PRNGKey(0)) # one entry per env
92
+ ```
93
+
94
+ Or, the `make_multi_vec` method for vectorised parallel copies of each environment:
95
+
96
+ ```python
97
+ env = envrax.make_multi_vec(
98
+ ["mjx/cartpole_balance-v0", "mjx/cheetah_run-v0"],
99
+ n_envs=64,
100
+ )
101
+ obs_list, state_list = env.reset(jax.random.PRNGKey(0))
102
+ # each entries obs.shape == (64, *single_obs.shape)
103
+ ```
104
+
105
+ Mujorax auto-detects whether a CUDA backend is available; on CPU-only systems it transparently falls back to MJX's pure-JAX physics implementation.
106
+
107
+ You can override this choice through this `MjxPlaygroundConfig(config_overrides={"impl": ...})` if needed.
108
+
109
+ ## Environments
110
+
111
+ All environments share canonical IDs in the form `mjx/<name>-v0`. Here's the full list of supported environments:
112
+
113
+ | Canonical ID | Description |
114
+ | --- | --- |
115
+ | `mjx/acrobot_swingup-v0` | Two-link underactuated pendulum; dense reward for swinging the tip to target |
116
+ | `mjx/acrobot_swingup_sparse-v0` | Same as `acrobot_swingup` with a sparse (binary) reward |
117
+ | `mjx/ball_in_cup-v0` | Planar ball-and-cup catching task; sparse reward when caught |
118
+ | `mjx/cartpole_balance-v0` | Cart starts near upright; dense reward for keeping the pole upright |
119
+ | `mjx/cartpole_balance_sparse-v0` | Same as `cartpole_balance` with a sparse reward |
120
+ | `mjx/cartpole_swingup-v0` | Cart starts hanging; dense reward for swinging up and balancing |
121
+ | `mjx/cartpole_swingup_sparse-v0` | Same as `cartpole_swingup` with a sparse reward |
122
+ | `mjx/cheetah_run-v0` | Planar bipedal cheetah; dense reward proportional to forward speed |
123
+ | `mjx/finger_spin-v0` | Two-DoF finger spinning a free body; dense reward for angular velocity |
124
+ | `mjx/finger_turn_easy-v0` | Two-DoF finger rotating a body to a target with large tolerance |
125
+ | `mjx/finger_turn_hard-v0` | Same as `finger_turn_easy` with a tighter tolerance |
126
+ | `mjx/fish_swim-v0` | 3D free-swimming fish; dense reward for swimming to a randomised target |
127
+ | `mjx/hopper_hop-v0` | One-legged planar hopper; dense reward for forward speed |
128
+ | `mjx/hopper_stand-v0` | One-legged hopper; dense reward for standing upright |
129
+ | `mjx/humanoid_run-v0` | 21-DoF humanoid; dense reward for matching a running speed |
130
+ | `mjx/humanoid_stand-v0` | 21-DoF humanoid; dense reward for standing upright |
131
+ | `mjx/humanoid_walk-v0` | 21-DoF humanoid; dense reward for matching a walking speed |
132
+ | `mjx/pendulum_swingup-v0` | Single-link pendulum; dense reward for swinging up and balancing |
133
+ | `mjx/point_mass-v0` | Planar point mass actuated in 2D; dense reward to a randomised target |
134
+ | `mjx/reacher_easy-v0` | Two-link planar arm reaching a large target |
135
+ | `mjx/reacher_hard-v0` | Same as `reacher_easy` with a smaller target |
136
+ | `mjx/swimmer_swimmer6-v0` | Six-link planar swimmer; dense reward for the head reaching a target |
137
+ | `mjx/walker_run-v0` | Planar bipedal walker; dense reward for running speed |
138
+ | `mjx/walker_stand-v0` | Planar bipedal walker; dense reward for standing upright |
139
+ | `mjx/walker_walk-v0` | Planar bipedal walker; dense reward for walking speed |
140
+
141
+ ## Acknowledgements
142
+
143
+ Mujorax wouldn't be possible without these incredible projects:
144
+
145
+ - [MuJoCo Playground](https://github.com/google-deepmind/mujoco_playground) — the underlying environment implementations.
146
+ - [MuJoCo](https://github.com/google-deepmind/mujoco) and [MJX](https://github.com/google-deepmind/mujoco) — the physics engine and JAX bindings.
147
+ - [Envrax](https://github.com/Achronus/envrax) — the registry and base environment API standard.
148
+
149
+ ❤️ Thank you to all the developers involved - you guys are awesome! ❤️
@@ -0,0 +1,121 @@
1
+ ![Logo](https://raw.githubusercontent.com/Achronus/mujorax/main/docs/assets/imgs/main.png)
2
+
3
+ ![Python Version](https://img.shields.io/pypi/pyversions/mujorax)
4
+ ![License](https://img.shields.io/github/license/Achronus/mujorax)
5
+
6
+ Mujorax is a lightweight open-source JAX-native MuJoCo environment suite for single-agent Reinforcement Learning (RL), built on top of [Envrax](https://github.com/Achronus/envrax). It wraps [MuJoCo Playground](https://github.com/google-deepmind/mujoco_playground) environments with Envrax's `JaxEnv` so you can use them with `envrax.make`, `envrax.make_vec`, and the rest of Envrax's tooling.
7
+
8
+ It comes with __25 environments from the DM Control Suite__. All environment logic follows a *stateless functional design* that builds on top of the [MJX](https://github.com/google-deepmind/mujoco), [JAX](https://github.com/jax-ml/jax), and [Chex](https://github.com/google-deepmind/chex) packages to benefit from JAX accelerator efficiency.
9
+
10
+ ## Why Mujorax?
11
+
12
+ [Envrax](https://github.com/Achronus/envrax) provides a JAX-native [Gymnasium-style](https://gymnasium.farama.org/) API standard for RL environments, but it doesn't ship with any environments of its own. One of the biggest spaces in RL is robotics, and the gold-standard physics engine for this is [MuJoCo](https://github.com/google-deepmind/mujoco). This makes it the perfect fit for one of the first Envrax environment suites!
13
+
14
+ [MuJoCo Playground](https://github.com/google-deepmind/mujoco_playground) is Google DeepMind's open-source library of MuJoCo environments, built on top of [MJX](https://github.com/google-deepmind/mujoco) (MuJoCo's JAX port that preserves the simulator's full physics fidelity). It already solves the hard parts: research-validated reward and termination logic for DM Control, locomotion, and manipulation environments. The only catch is that its environments expose a Brax-style `MjxEnv` API, which doesn't quite fit Envrax's API standard.
15
+
16
+ Rather than reinventing the wheel, Mujorax acts as a thin, type-safe wrapper around the MuJoCo Playground environments to maximise their benefits while maintaining Envrax's API standard, making it completely plug-and-play with Envrax's toolkit.
17
+
18
+ ## Requirements
19
+
20
+ - Python 3.13+
21
+ - JAX 0.9+ (CPU, CUDA, or TPU backend)
22
+
23
+ ## Installation
24
+
25
+ ```bash
26
+ pip install mujorax
27
+ ```
28
+
29
+ Or with [uv](https://docs.astral.sh/uv/):
30
+
31
+ ```bash
32
+ uv add mujorax
33
+ ```
34
+
35
+ ## Quick Start
36
+
37
+ ```python
38
+ import jax
39
+ import mujorax # registers the suite at import
40
+ import envrax
41
+
42
+ env = envrax.make("mjx/cartpole_balance-v0")
43
+ obs, state = env.reset(jax.random.PRNGKey(0))
44
+
45
+ action = env.action_space.sample(jax.random.PRNGKey(1))
46
+ obs, state, reward, done, info = env.step(state, action)
47
+ ```
48
+
49
+ Vectorised rollouts work the same way:
50
+
51
+ ```python
52
+ env = envrax.make_vec("mjx/cartpole_balance-v0", n_envs=128)
53
+ obs, state = env.reset(jax.random.PRNGKey(0)) # obs.shape == (128, 5)
54
+ ```
55
+
56
+ You can also use `make_multi` to utilise several heterogeneous environments at once:
57
+
58
+ ```python
59
+ env = envrax.make_multi([
60
+ "mjx/cartpole_balance-v0",
61
+ "mjx/cheetah_run-v0",
62
+ ])
63
+ obs_list, state_list = env.reset(jax.random.PRNGKey(0)) # one entry per env
64
+ ```
65
+
66
+ Or, the `make_multi_vec` method for vectorised parallel copies of each environment:
67
+
68
+ ```python
69
+ env = envrax.make_multi_vec(
70
+ ["mjx/cartpole_balance-v0", "mjx/cheetah_run-v0"],
71
+ n_envs=64,
72
+ )
73
+ obs_list, state_list = env.reset(jax.random.PRNGKey(0))
74
+ # each entries obs.shape == (64, *single_obs.shape)
75
+ ```
76
+
77
+ Mujorax auto-detects whether a CUDA backend is available; on CPU-only systems it transparently falls back to MJX's pure-JAX physics implementation.
78
+
79
+ You can override this choice through this `MjxPlaygroundConfig(config_overrides={"impl": ...})` if needed.
80
+
81
+ ## Environments
82
+
83
+ All environments share canonical IDs in the form `mjx/<name>-v0`. Here's the full list of supported environments:
84
+
85
+ | Canonical ID | Description |
86
+ | --- | --- |
87
+ | `mjx/acrobot_swingup-v0` | Two-link underactuated pendulum; dense reward for swinging the tip to target |
88
+ | `mjx/acrobot_swingup_sparse-v0` | Same as `acrobot_swingup` with a sparse (binary) reward |
89
+ | `mjx/ball_in_cup-v0` | Planar ball-and-cup catching task; sparse reward when caught |
90
+ | `mjx/cartpole_balance-v0` | Cart starts near upright; dense reward for keeping the pole upright |
91
+ | `mjx/cartpole_balance_sparse-v0` | Same as `cartpole_balance` with a sparse reward |
92
+ | `mjx/cartpole_swingup-v0` | Cart starts hanging; dense reward for swinging up and balancing |
93
+ | `mjx/cartpole_swingup_sparse-v0` | Same as `cartpole_swingup` with a sparse reward |
94
+ | `mjx/cheetah_run-v0` | Planar bipedal cheetah; dense reward proportional to forward speed |
95
+ | `mjx/finger_spin-v0` | Two-DoF finger spinning a free body; dense reward for angular velocity |
96
+ | `mjx/finger_turn_easy-v0` | Two-DoF finger rotating a body to a target with large tolerance |
97
+ | `mjx/finger_turn_hard-v0` | Same as `finger_turn_easy` with a tighter tolerance |
98
+ | `mjx/fish_swim-v0` | 3D free-swimming fish; dense reward for swimming to a randomised target |
99
+ | `mjx/hopper_hop-v0` | One-legged planar hopper; dense reward for forward speed |
100
+ | `mjx/hopper_stand-v0` | One-legged hopper; dense reward for standing upright |
101
+ | `mjx/humanoid_run-v0` | 21-DoF humanoid; dense reward for matching a running speed |
102
+ | `mjx/humanoid_stand-v0` | 21-DoF humanoid; dense reward for standing upright |
103
+ | `mjx/humanoid_walk-v0` | 21-DoF humanoid; dense reward for matching a walking speed |
104
+ | `mjx/pendulum_swingup-v0` | Single-link pendulum; dense reward for swinging up and balancing |
105
+ | `mjx/point_mass-v0` | Planar point mass actuated in 2D; dense reward to a randomised target |
106
+ | `mjx/reacher_easy-v0` | Two-link planar arm reaching a large target |
107
+ | `mjx/reacher_hard-v0` | Same as `reacher_easy` with a smaller target |
108
+ | `mjx/swimmer_swimmer6-v0` | Six-link planar swimmer; dense reward for the head reaching a target |
109
+ | `mjx/walker_run-v0` | Planar bipedal walker; dense reward for running speed |
110
+ | `mjx/walker_stand-v0` | Planar bipedal walker; dense reward for standing upright |
111
+ | `mjx/walker_walk-v0` | Planar bipedal walker; dense reward for walking speed |
112
+
113
+ ## Acknowledgements
114
+
115
+ Mujorax wouldn't be possible without these incredible projects:
116
+
117
+ - [MuJoCo Playground](https://github.com/google-deepmind/mujoco_playground) — the underlying environment implementations.
118
+ - [MuJoCo](https://github.com/google-deepmind/mujoco) and [MJX](https://github.com/google-deepmind/mujoco) — the physics engine and JAX bindings.
119
+ - [Envrax](https://github.com/Achronus/envrax) — the registry and base environment API standard.
120
+
121
+ ❤️ Thank you to all the developers involved - you guys are awesome! ❤️
@@ -0,0 +1 @@
1
+ mujorax.achronus.dev
@@ -0,0 +1,70 @@
1
+ """Griffe extension that polishes numpy-style docstrings for mkdocstrings rendering.
2
+
3
+ Two transforms are applied at the source / parsed-section level so the rest of
4
+ mkdocstrings's pipeline (cross-references, inventories, default templates)
5
+ just works on the result.
6
+
7
+ 1. Strip trailing ` (optional)` from parameter type lines. The project writes
8
+ optional parameters as `name : Type (optional)`; griffe's numpy parser only
9
+ strips `, optional`, so without this the annotation ends up parsed as a
10
+ Python call `Type(optional)` which renders verbatim. The `Default` column
11
+ already conveys optionality.
12
+
13
+ 2. Split Raises entries of the form `name : ExceptionType` into a real `name`
14
+ attribute plus a typed `annotation` expression. Griffe's numpy parser only
15
+ recognises bare exception types (`ExceptionType`) — the `name :` prefix
16
+ makes it leave the whole line as a raw string, which blocks cross-reference
17
+ resolution (e.g. linking `ValueError` to python.org). After this transform
18
+ the custom `raises.html.jinja` template can render the type via the
19
+ standard expression pipeline and get autoref'd inventory links for free.
20
+ """
21
+
22
+ from __future__ import annotations
23
+
24
+ import re
25
+
26
+ import griffe
27
+ from griffe._internal.docstrings.utils import parse_docstring_annotation
28
+
29
+
30
+ _OPTIONAL_RE = re.compile(r"^(?P<prefix>\s*\w[\w\d_]*\s*:\s*.+?)\s*\(optional\)\s*$", re.MULTILINE)
31
+
32
+
33
+ def _strip_optional(text: str | None) -> str | None:
34
+ if not text or "(optional)" not in text:
35
+ return text
36
+ return _OPTIONAL_RE.sub(r"\g<prefix>", text)
37
+
38
+
39
+ def _split_raises(docstring: griffe.Docstring) -> None:
40
+ for section in docstring.parsed:
41
+ if section.kind != griffe.DocstringSectionKind.raises:
42
+ continue
43
+ for raise_obj in section.value:
44
+ annot = raise_obj.annotation
45
+ if not isinstance(annot, str) or " : " not in annot:
46
+ continue
47
+ name_str, type_str = annot.split(" : ", 1)
48
+ raise_obj.name = name_str.strip()
49
+ raise_obj.annotation = parse_docstring_annotation(type_str.strip(), docstring)
50
+
51
+
52
+ class DocstringPolish(griffe.Extension):
53
+ """Project-specific numpy docstring cleanup for mkdocstrings."""
54
+
55
+ def on_instance(
56
+ self,
57
+ *,
58
+ obj: griffe.Object,
59
+ **_: object,
60
+ ) -> None:
61
+ doc = obj.docstring
62
+ if doc is None:
63
+ return
64
+
65
+ cleaned = _strip_optional(doc.value)
66
+ if cleaned is not None and cleaned != doc.value:
67
+ doc.value = cleaned
68
+ doc.__dict__.pop("parsed", None)
69
+
70
+ _split_raises(doc)