Skip to content

settings

Global user settings for mujoco_mojo, persisted to ~/.mujoco-mojo/settings.toml.

PROJECT_SETTINGS_DIR_NAME module-attribute

Python
PROJECT_SETTINGS_DIR_NAME = '.mujoco-mojo'

Name of the directory, at the root of a project, that holds its project-local files. The settings live in .mujoco-mojo/settings.toml, and the directory is the place for any other project-local file added later.

DEFAULT_MAX_REQUESTS module-attribute

Python
DEFAULT_MAX_REQUESTS = 12

The default of dojo.sensai.max_requests.

DEFAULT_MAX_VERSUS_TRIALS module-attribute

Python
DEFAULT_MAX_VERSUS_TRIALS = 50

The default of dojo.sensai.max_versus_trials.

SlurmSettingsSource dataclass

Python
SlurmSettingsSource(
    label: str,
    path: Path,
    exists: bool,
    entries: dict[str, Any] = dict(),
    error: str | None = None,
)

One settings file that can contribute [slurm] entries.

label instance-attribute

Python
label: str

global or project.

path instance-attribute

Python
path: Path

Where the file is (or would be) located.

exists instance-attribute

Python
exists: bool

Whether the file exists.

entries class-attribute instance-attribute

Python
entries: dict[str, Any] = field(default_factory=dict)

The raw [slurm] entries this file defines, empty if it has none or couldn't be read.

error class-attribute instance-attribute

Python
error: str | None = None

Why the file couldn't be read, if it couldn't.

VisualizationSettings

Bases: BaseModel

Colors for force, torque, contact, and proximity overlays rendered during simulation.

SensAIModelEntry

Bases: BaseModel

One entry in SensAISettings.models - a provider paired with that provider's own model identifier.

SensAISettings

Bases: BaseModel

Settings for the SensAI assistant embedded in the Dojo dashboard.

DojoSettings

Bases: BaseModel

Settings for the Dojo dashboard.

SlurmExtraSettings

Bases: RootModel[dict[str, SlurmScalar]]

Flat key-value pairs used to extend a SLURM submission. sbatch.-prefixed keys become #SBATCH lines; everything else becomes an exported environment variable. Values must be scalars.

GeneralSettings

Bases: BaseModel

General-purpose defaults shared across mujoco-mojo's CLI commands, plus asset-bundling behavior.

ReloadedKeySettings

Bases: BaseModel

Keyboard shortcuts of the Reloaded terminal UI. Each action takes a list of Textual key names such as f2 or ctrl+g, and the first one is shown in the footer.

ReloadedStudioSettings

Bases: BaseModel

Which parts of MuJoCo Studio show when it opens, as Studio's own show_ options, which its View menu still toggles. Not used by the opengl viewer. The defaults are Studio's own.

ReloadedSettings

Bases: BaseModel

Settings for mujoco-mojo reloaded.

MonteCarloRunSettings

Bases: _RunDefaults

Settings for mujoco-mojo run monte-carlo.

SingleRunSettings

Bases: _RunDefaults

Settings for mujoco-mojo run single.

OptimizeRunSettings

Bases: _RunDefaults

Settings for mujoco-mojo run optimization.

RunSettings

Bases: BaseModel

Settings for mujoco-mojo run's subcommands.

GenerateJsonSchemaWithDefaults

Bases: GenerateJsonSchema

Appends each field's default value to its description, so editors that only surface description on hover (e.g. VS Code's Even Better TOML) still show it, without hand-duplicating every Field(default=...) into its own description text.

Also attaches an x-enum-descriptions extension (value -> that member's own attribute-docstring, via _enum_value_descriptions above) to every enum schema - generic to any StrEnum with attribute-docstring'd members, not specific to whichever model happens to use this generator, so a consumer like the Dojo settings panel and PlotConfig's Plot Editor/JSON editor tooltips (dojo/plot_config.py) both get per-dropdown-option descriptions for free from the same one generator, rather than each redefining this behavior in its own subclass.

get_default_value

Python
get_default_value(schema: WithDefaultSchema) -> Any

Pydantic's own default implementation only ever surfaces a static default=, never a default_factory= result, since a factory could be expensive or side-effecting. Every default_factory actually used across this codebase (dict, list, lambda: SlurmExtraSettings({}), and the nested settings-group constructors) is cheap and side-effect-free, so calling it here is safe, and it's what lets _append_defaults below show a real "Default: ..." for fields like PlotConfig.y_axes/annotations/shapes that would otherwise silently show none.

Source code in src/mujoco_mojo/settings.py
Python
def get_default_value(self, schema: core_schema.WithDefaultSchema) -> Any:
    """
    Pydantic's own default implementation only ever surfaces a static `default=`, never a `default_factory=` result, since a factory could be expensive or side-effecting. Every `default_factory` actually used across this codebase (`dict`, `list`, `lambda: SlurmExtraSettings({})`, and the nested settings-group constructors) is cheap and side-effect-free, so calling it here is safe, and it's what lets `_append_defaults` below show a real "Default: ..." for fields like `PlotConfig.y_axes`/`annotations`/`shapes` that would otherwise silently show none.
    """
    default = super().get_default_value(schema)
    if default is not NoDefault:
        return default
    factory = schema.get("default_factory")
    if factory is None or schema.get("default_factory_takes_data"):
        return NoDefault
    # `default_factory_takes_data` being falsy is what actually
    # guarantees the zero-argument overload at runtime; the stub's
    # `Callable[[], Any] | Callable[[dict[str, Any]], Any]` union
    # can't express that correlation itself.
    no_arg_factory = cast("Callable[[], Any]", factory)
    try:
        return no_arg_factory()
    except Exception:
        return NoDefault

MujocoMojoSettings

Bases: BaseSettings

Global user-level settings persisted to ~/.mujoco-mojo/settings.toml, layered with an optional project-local override file, found by searching the current directory and its parents - the same User-settings-vs-Workspace-settings model VS Code uses.

Instantiate to load. Sources are checked in priority order: constructor kwargs > environment variables > .env file (env_file in model_config) > project settings file (project_settings_file(), the nearest .mujoco-mojo/settings.toml in the current directory or a parent) > global settings file (~/.mujoco-mojo/settings.toml) > defaults. Every field can be overridden at the project level, not just a specific subset - a project file is expected to hold only the handful of keys that genuinely differ from the global defaults (e.g. per-project SLURM extras or force-scaling), not a full copy. Environment variables (real ones and .env entries alike) use the prefix MUJOCO_MOJO_ with __ as the nested delimiter, e.g. MUJOCO_MOJO_DOJO__SENSAI__MODEL_NAME=llama3.2:3b.

defaults classmethod

Python
defaults() -> MujocoMojoSettings

Builds a fresh instance from pure code-level defaults, ignoring environment variables and any existing settings.toml.

A constructor kwarg left unset resolves against this class's other settings sources (env vars, then the TOML file) rather than the field's own default - that layering is the entire reason BaseSettings exists - so every field's default must be passed explicitly here to get a true reset. Iterating model_fields rather than hand-listing field names means a newly added settings field is automatically covered, with nothing to remember to update.

Returns:

Type Description
MujocoMojoSettings

A MujocoMojoSettings instance with every field at its code-level default.

Source code in src/mujoco_mojo/settings.py
Python
@classmethod
def defaults(cls) -> MujocoMojoSettings:
    """
    Builds a fresh instance from pure code-level defaults, ignoring environment variables and any existing settings.toml.

    A constructor kwarg left unset resolves against this class's other settings sources (env vars, then the TOML file) rather than the field's own default - that layering is the entire reason `BaseSettings` exists - so every field's default must be passed explicitly here to get a true reset. Iterating `model_fields` rather than hand-listing field names means a newly added settings field is automatically covered, with nothing to remember to update.

    Returns:
        A `MujocoMojoSettings` instance with every field at its code-level default.

    """
    field_defaults = {
        name: info.get_default(call_default_factory=True)
        for name, info in cls.model_fields.items()
    }
    return cls(**field_defaults)

set_project_value classmethod

Python
set_project_value(key: str, value: Any) -> Path

Sets a single dotted-path setting (e.g. "assets.symlink") in the project-local settings file, creating any intermediate tables as needed, without touching anything else already there.

key.split(".") is ambiguous for a free-form group like slurm (a RootModel[dict[str, ...]]), whose own keys legitimately contain literal dots (e.g. "sbatch.account") - "slurm.sbatch.account" must set that one flat key, not descend two more table levels. Resolved by walking the declared field types (not the current data) until a RootModel field is reached; everything after that point is rejoined into a single literal key instead of split further.

Validated by overlaying the new value onto the full currently-effective settings (project + global + env + defaults) and calling model_validate on the result - model_config forbids extra fields on every fixed-shape settings group, so a typo'd leaf and a wrong-typed value both raise pydantic.ValidationError before anything is written. The validated and re-dumped leaf value is what actually gets persisted, not the raw value argument, so e.g. the CLI's loosely-typed input string "true" for a bool field is written to TOML as a real boolean, not a quoted string. Only that one changed leaf is written into the project file, keeping it a small, deliberate diff rather than a full mirror of every setting - contrast with save(), which always persists every field (correct for the global file, wrong here).

Parameters:

Name Type Description Default
key str

Dotted path, e.g. "dojo.sensai.max_requests", "assets.symlink", or "slurm.sbatch.account".

required
value Any

The value to set, already parsed to its target Python type.

required

Returns:

Type Description
Path

The project settings file that was written: the one found by searching the current directory and its parents, or a new one in the current directory if there wasn't one.

Raises:

Type Description
KeyError

If an intermediate segment of key isn't a real settings table.

ValidationError

If the resulting settings are invalid (unknown leaf, wrong type, etc.).

Source code in src/mujoco_mojo/settings.py
Python
@classmethod
def set_project_value(cls, key: str, value: Any) -> Path:
    """
    Sets a single dotted-path setting (e.g. "assets.symlink") in the project-local settings file, creating any intermediate tables as needed, without touching anything else already there.

    `key.split(".")` is ambiguous for a free-form group like `slurm` (a `RootModel[dict[str, ...]]`), whose own keys legitimately contain literal dots (e.g. `"sbatch.account"`) - `"slurm.sbatch.account"` must set that one flat key, not descend two more table levels. Resolved by walking the *declared field types* (not the current data) until a `RootModel` field is reached; everything after that point is rejoined into a single literal key instead of split further.

    Validated by overlaying the new value onto the full currently-effective settings (project + global + env + defaults) and calling `model_validate` on the result - `model_config` forbids extra fields on every fixed-shape settings group, so a typo'd leaf and a wrong-typed value both raise `pydantic.ValidationError` before anything is written. The *validated and re-dumped* leaf value is what actually gets persisted, not the raw `value` argument, so e.g. the CLI's loosely-typed input string `"true"` for a `bool` field is written to TOML as a real boolean, not a quoted string. Only that one changed leaf is written into the project file, keeping it a small, deliberate diff rather than a full mirror of every setting - contrast with `save()`, which always persists every field (correct for the global file, wrong here).

    Args:
        key: Dotted path, e.g. "dojo.sensai.max_requests", "assets.symlink", or "slurm.sbatch.account".
        value: The value to set, already parsed to its target Python type.

    Returns:
        The project settings file that was written: the one found by searching the current directory and its parents, or a new one in the current directory if there wasn't one.

    Raises:
        KeyError: If an intermediate segment of `key` isn't a real settings table.
        pydantic.ValidationError: If the resulting settings are invalid (unknown leaf, wrong type, etc.).

    """
    parts = key.split(".")

    # stop splitting once a free-form (RootModel) group is reached - the
    # rest of the path is that group's own literal key, dots and all
    model: type[BaseModel] = cls
    for i, part in enumerate(parts[:-1]):
        field_info = model.model_fields.get(part)
        annotation = field_info.annotation if field_info else None
        if not (isinstance(annotation, type) and issubclass(annotation, BaseModel)):
            msg = f"Unknown settings path: {key}"
            raise KeyError(msg)
        if issubclass(annotation, RootModel):
            parts = [*parts[: i + 1], ".".join(parts[i + 1 :])]
            break
        model = annotation

    # mode="json" turns any SecretStr field into its masked string rather
    # than a raw object tomlkit can't write, and exclude_none=True omits
    # an unset Optional field entirely - see save()
    effective = cls().model_dump(mode="json", exclude_none=True)
    overlay = effective
    for part in parts[:-1]:
        nxt = overlay.get(part)
        if not isinstance(nxt, dict):
            msg = f"Unknown settings path: {key}"
            raise KeyError(msg)
        overlay = nxt
    overlay[parts[-1]] = value
    validated = cls.model_validate(effective).model_dump(
        mode="json", exclude_none=True
    )

    coerced = validated
    for part in parts[:-1]:
        coerced = coerced[part]
    coerced_leaf = coerced[parts[-1]]

    path = project_settings_file()
    if path.exists():
        doc = tomlkit.parse(path.read_text(encoding="utf-8"))
    else:
        # model_construct() bypasses BaseSettings' usual env/TOML-reading
        # __init__ entirely - safe here since save(project=True) never
        # reads the instance's field values, and this path must not
        # require the *global* settings file (a wholly separate file) to
        # currently be valid just to bootstrap a fresh project file
        cls.model_construct().save(path.parent, project=True)
        doc = tomlkit.parse(path.read_text(encoding="utf-8"))

    node = doc
    for part in parts[:-1]:
        if part not in node or not isinstance(node[part], (Table, dict)):
            node[part] = tomlkit.table()
        node = node[part]
    node[parts[-1]] = coerced_leaf

    path.write_text(tomlkit.dumps(doc), encoding="utf-8")
    return path

save

Python
save(
    directory: Path | None = None, *, project: bool = False
) -> Path

Persist settings to directory (defaults to the global settings directory, ~/.mujoco-mojo), alongside a freshly (re)generated settings.schema.json/.taplo.toml pair (see write_schema_files) - one method covers both the global settings file and a project-local override file, so there's no separate init_project_file-style method to keep in sync with this one.

project=False (the default - the global file): every field's current value is merged into settings.toml with tomlkit, preserving any comments or formatting added by hand. A key that exists in the file but no longer has a corresponding settings value (e.g. a removed slurm entry) is left as-is rather than deleted.

project=True (for a project's .mujoco-mojo/settings.toml): self's field values are never written - a project file is meant to hold only a small, deliberate diff from the global defaults, not a full mirror of every setting (see set_project_value) - so an existing file's contents are left completely untouched, and a fresh one gets just the #:schema header. Also drops a .gitignore (*) next to it if one isn't already there, so a project's local overrides - which may be machine-specific - don't get committed by accident.

Either way, a brand-new file starts with a #:schema header pointing at the colocated settings.schema.json - a bare relative filename, resolved by taplo against the TOML file's own directory, rather than a cross-directory reference to another directory's schema. The latter is what broke under SSH/SSHFS-style setups where only one of the two directories was visible to the editor - every settings directory is now self-contained. An existing file that's missing that header (written before schema support existed, or hand-edited to drop the line) gets it prepended on the next save too, except for the already-exists project-file case just above, which skips reading the file at all.

Parameters:

Name Type Description Default
directory Path | None

Where to write settings.toml, settings.schema.json, and .taplo.toml. Defaults to SETTINGS_DIR (looked up at call time, not import time, so tests can monkeypatch it).

None
project bool

Write the sparse project-local form described above instead of the full global one.

False

Returns:

Type Description
Path

The settings.toml path written to.

Source code in src/mujoco_mojo/settings.py
Python
def save(self, directory: Path | None = None, *, project: bool = False) -> Path:
    """
    Persist settings to `directory` (defaults to the global settings directory, `~/.mujoco-mojo`), alongside a freshly (re)generated `settings.schema.json`/`.taplo.toml` pair (see `write_schema_files`) - one method covers both the global settings file and a project-local override file, so there's no separate `init_project_file`-style method to keep in sync with this one.

    `project=False` (the default - the global file): every field's current value is merged into `settings.toml` with `tomlkit`, preserving any comments or formatting added by hand. A key that exists in the file but no longer has a corresponding settings value (e.g. a removed `slurm` entry) is left as-is rather than deleted.

    `project=True` (for a project's `.mujoco-mojo/settings.toml`): `self`'s field values are never written - a project file is meant to hold only a small, deliberate diff from the global defaults, not a full mirror of every setting (see `set_project_value`) - so an existing file's contents are left completely untouched, and a fresh one gets just the `#:schema` header. Also drops a `.gitignore` (`*`) next to it if one isn't already there, so a project's local overrides - which may be machine-specific - don't get committed by accident.

    Either way, a brand-new file starts with a `#:schema` header pointing at the colocated settings.schema.json - a bare relative filename, resolved by taplo against the TOML file's own directory, rather than a cross-directory reference to another directory's schema. The latter is what broke under SSH/SSHFS-style setups where only one of the two directories was visible to the editor - every settings directory is now self-contained. An existing file that's missing that header (written before schema support existed, or hand-edited to drop the line) gets it prepended on the next save too, except for the already-exists project-file case just above, which skips reading the file at all.

    Args:
        directory: Where to write `settings.toml`, `settings.schema.json`, and `.taplo.toml`. Defaults to `SETTINGS_DIR` (looked up at call time, not import time, so tests can monkeypatch it).
        project: Write the sparse project-local form described above instead of the full global one.

    Returns:
        The `settings.toml` path written to.

    """
    if directory is None:
        directory = SETTINGS_DIR
    directory.mkdir(parents=True, exist_ok=True)
    toml_path = directory / SETTINGS_FILENAME

    if project:
        gitignore = directory / ".gitignore"
        if not gitignore.exists():
            gitignore.write_text("*\n", encoding="utf-8")

    if not (project and toml_path.exists()):
        # guards the read-modify-write below against concurrent writers -
        # the CLI, the Dojo settings panel, and multiple browser tabs can
        # all call save() around the same time
        lock_path = toml_path.with_suffix(toml_path.suffix + ".lock")
        with FileLock(lock_path):
            if toml_path.exists():
                text = _ensure_schema_header(toml_path.read_text(encoding="utf-8"))
                doc = tomlkit.parse(text)
            else:
                doc = tomlkit.parse(f"#:schema {SCHEMA_FILENAME}\n")

            if not project:
                # mode="json" turns any SecretStr field (e.g. dojo.password)
                # into its masked "**********" string rather than a raw object
                # tomlkit can't write at all - the real value is never persisted
                # by this method. exclude_none=True omits an unset Optional field
                # (e.g. dojo.chime) entirely, since TOML has no null literal to write.
                _merge_into_toml(
                    doc, self.model_dump(mode="json", exclude_none=True), type(self)
                )

            toml_path.write_text(tomlkit.dumps(doc), encoding="utf-8")

    self.write_schema_files(directory)
    return toml_path

write_schema_files classmethod

Python
write_schema_files(directory: Path | None = None) -> None

Writes settings.schema.json and a companion .taplo.toml into directory, so taplo-based editors (VS Code's Even Better TOML, Neovim, etc.) get hover hints and validation for whatever settings.toml lives there. Safe to re-run any time, e.g. after upgrading mujoco-mojo changes the settings shape.

The schema and taplo config are always colocated with the settings.toml they describe, rather than one directory's file referencing another's schema by absolute path - that cross-directory reference is exactly what broke under SSH/SSHFS-style setups where only one of the two directories (typically just the project one) is visible to the editor.

Parameters:

Name Type Description Default
directory Path | None

Where to write settings.schema.json and .taplo.toml. Defaults to SETTINGS_DIR (looked up at call time, not import time, so tests can monkeypatch it).

None
Source code in src/mujoco_mojo/settings.py
Python
@classmethod
def write_schema_files(cls, directory: Path | None = None) -> None:
    """
    Writes settings.schema.json and a companion .taplo.toml into `directory`, so taplo-based editors (VS Code's Even Better TOML, Neovim, etc.) get hover hints and validation for whatever settings.toml lives there. Safe to re-run any time, e.g. after upgrading mujoco-mojo changes the settings shape.

    The schema and taplo config are always colocated with the settings.toml they describe, rather than one directory's file referencing another's schema by absolute path - that cross-directory reference is exactly what broke under SSH/SSHFS-style setups where only one of the two directories (typically just the project one) is visible to the editor.

    Args:
        directory: Where to write `settings.schema.json` and `.taplo.toml`. Defaults to `SETTINGS_DIR` (looked up at call time, not import time, so tests can monkeypatch it).

    """
    if directory is None:
        directory = SETTINGS_DIR
    directory.mkdir(parents=True, exist_ok=True)

    schema_file = directory / SCHEMA_FILENAME
    taplo_file = directory / TAPLO_FILENAME

    schema = cls.model_json_schema(schema_generator=GenerateJsonSchemaWithDefaults)
    schema_file.write_text(json.dumps(schema), encoding="utf-8")

    # taplo requires a file:// URI for the schema url - a relative path is not supported
    schema_uri = schema_file.as_uri()
    taplo_file.write_text(
        f'[[rule]]\ninclude = ["{SETTINGS_FILENAME}"]\n\n[rule.schema]\nurl = "{schema_uri}"\n',
        encoding="utf-8",
    )

find_project_settings_file

Python
find_project_settings_file(
    start: Path | None = None,
) -> Path | None

Searches start (default: the current directory) and then each parent directory for a project settings file, .mujoco-mojo/settings.toml, the way uv looks for its own configuration.

The nearest file wins and the search stops there: files in further parent directories are not merged in. The global settings directory (~/.mujoco-mojo) is skipped, since it holds the global settings and would otherwise be found as the "project" of anything under the home directory. A directory that cannot be read counts as not having a file.

Parameters:

Name Type Description Default
start Path | None

Directory to start from. Defaults to Path.cwd(), evaluated on every call rather than cached, since the working directory can legitimately differ across calls within one process (e.g. a long-running dashboard server, a script that cds first, or tests).

None

Returns:

Type Description
Path | None

The nearest project settings file, or None if there isn't one.

Source code in src/mujoco_mojo/settings.py
Python
def find_project_settings_file(start: Path | None = None) -> Path | None:
    """
    Searches `start` (default: the current directory) and then each parent directory for a project settings file, `.mujoco-mojo/settings.toml`, the way uv looks for its own configuration.

    The nearest file wins and the search stops there: files in further parent directories are not merged in. The global settings directory (`~/.mujoco-mojo`) is skipped, since it holds the global settings and would otherwise be found as the "project" of anything under the home directory. A directory that cannot be read counts as not having a file.

    Args:
        start: Directory to start from. Defaults to `Path.cwd()`, evaluated on every call rather than cached, since the working directory can legitimately differ across calls within one process (e.g. a long-running dashboard server, a script that `cd`s first, or tests).

    Returns:
        The nearest project settings file, or `None` if there isn't one.

    """

    def resolved(path: Path) -> Path:
        try:
            return path.resolve()
        except OSError:
            return path

    global_dir = resolved(GLOBAL_SETTINGS_FILE.parent)
    directory = Path.cwd() if start is None else start
    for ancestor in (directory, *directory.parents):
        project_dir = ancestor / PROJECT_SETTINGS_DIR_NAME
        if resolved(project_dir) == global_dir:
            continue
        candidate = project_dir / SETTINGS_FILENAME
        try:
            if candidate.is_file():
                return candidate
        except OSError:
            continue
    return None

project_settings_file

Python
project_settings_file() -> Path

Path to the project-local settings file in effect: the nearest .mujoco-mojo/settings.toml found by searching the current directory and its parents (see find_project_settings_file).

If there isn't one, this is the file that would be created for the current directory, <cwd>/.mujoco-mojo/settings.toml, which is where settings set --project writes first.

Returns:

Type Description
Path

The discovered file, or Path.cwd() / ".mujoco-mojo" / "settings.toml" if none exists.

Source code in src/mujoco_mojo/settings.py
Python
def project_settings_file() -> Path:
    """
    Path to the project-local settings file in effect: the nearest `.mujoco-mojo/settings.toml` found by searching the current directory and its parents (see `find_project_settings_file`).

    If there isn't one, this is the file that would be created for the current directory, `<cwd>/.mujoco-mojo/settings.toml`, which is where `settings set --project` writes first.

    Returns:
        The discovered file, or `Path.cwd() / ".mujoco-mojo" / "settings.toml"` if none exists.

    """
    found = find_project_settings_file()
    if found is not None:
        return found
    return Path.cwd() / PROJECT_SETTINGS_DIR_NAME / SETTINGS_FILENAME

slurm_settings_sources

Python
slurm_settings_sources() -> list[SlurmSettingsSource]

The settings files that can contribute [slurm] entries, lowest priority first (global, then project), each read on its own.

MujocoMojoSettings().slurm only has the merged result, which hides a project file that wasn't found, since the project file is looked up relative to the current directory. This reports each file separately so a submission can say where it looked and what each one contributed.

Source code in src/mujoco_mojo/settings.py
Python
def slurm_settings_sources() -> list[SlurmSettingsSource]:
    """
    The settings files that can contribute `[slurm]` entries, lowest priority first (global, then project), each read on its own.

    `MujocoMojoSettings().slurm` only has the merged result, which hides a project file that wasn't found, since the project file is looked up relative to the current directory. This reports each file separately so a submission can say where it looked and what each one contributed.
    """
    sources: list[SlurmSettingsSource] = []
    for label, path in (
        ("global", GLOBAL_SETTINGS_FILE),
        ("project", project_settings_file()),
    ):
        if not path.is_file():
            sources.append(SlurmSettingsSource(label, path, exists=False))
            continue
        try:
            with path.open("rb") as handle:
                table = tomllib.load(handle).get("slurm", {})
        except (OSError, tomllib.TOMLDecodeError) as exc:
            sources.append(
                SlurmSettingsSource(label, path, exists=True, error=str(exc))
            )
            continue
        entries = dict(table) if isinstance(table, dict) else {}
        sources.append(SlurmSettingsSource(label, path, exists=True, entries=entries))
    return sources

default_user_interface

Python
default_user_interface() -> UserInterface

The viewer for this machine: Studio in a browser where this MuJoCo build can serve it, and the classic OpenGL window where it cannot. The native Studio window is never chosen automatically, but studio can still be set.

Source code in src/mujoco_mojo/settings.py
Python
def default_user_interface() -> UserInterface:
    """The viewer for this machine: Studio in a browser where this MuJoCo build can serve it, and the classic OpenGL window where it cannot. The native Studio window is never chosen automatically, but `studio` can still be set."""
    return UserInterface.WEB if web_client_available() else UserInterface.OPENGL