Skip to content

mujoco_mojo

mujoco_mojo is a collection of Python objects built to make working with MuJoCo via Python easier.

It provides vast bindings for all MJCF XML schema objects, tools to convert to XML, run MuJoCo simulations, and more.

MuJoCo Type Stubs:

MuJoCo does not ship Python type stubs. Generate them once with pybind11-stubgen:

.. code-block:: bash pip install pybind11-stubgen pybind11-stubgen mujoco -o typings/ --numpy-array-wrap-with-annotated pybind11-stubgen mujoco.viewer -o typings/ --numpy-array-wrap-with-annotated pybind11-stubgen mujoco.studio -o typings/ --numpy-array-wrap-with-annotated

Run this from the project root. The typings/ directory is gitignored. Then point your type checker at it by adding to pyproject.toml. For Pyright:

.. code-block:: toml [tool.pyright] stubPath = "typings" venvPath = "." venv = ".venv"

For ty, which finds a .venv in the project root on its own:

.. code-block:: toml [tool.ty.environment] extra-paths = ["typings"]