Introduce explicit VFS in Python MjVfs

This change introduces MjVFS, an explicit object to mirror the C mjVFS. This is meant to replace the MjSpec.assets dict. This latter while convenient guides users towards harmful authoring patterns with respect to data duplication and spec attachment workflows. Making VFS management explicit should encourage better memory usage and allow us to make better compile time optimizations.

From this change, `spec.assets` is deprecated. However we will temporarily support backwards compatibility due to the wide spread usage. An error will be thrown if calling code tries to use a spec that uses both the assets dict and the new MjVfs.

PiperOrigin-RevId: 908772050
Change-Id: I77c6d0369307fc300c954768fed17401261e18da
This commit is contained in:
Sam Haves
2026-05-01 09:33:43 -07:00
committed by Copybara-Service
parent 910b3336ed
commit 723b8b1ea6
10 changed files with 599 additions and 78 deletions
+13
View File
@@ -55,6 +55,19 @@ Bug fixes
than the parent spec. This prevents the origin of the parent spec to affect the resolution of asset paths in the
child spec.
Python
^^^^^^
- Added ``mujoco.MjVfs`` Python binding to interact with the Virtual File System directly from Python.
See :ref:`Virtual File System <PyVFS>` for usage details.
.. warning::
The previous way of passing assets via a dictionary mapping asset names to bytes is **deprecated** and will be
removed in an upcoming release. You cannot specify both the ``assets`` dictionary and the ``vfs`` argument at the same
time. ``MjVfs`` should be used as a drop-in replacement.
Version 3.7.0 (April 14, 2026)
------------------------------