cli
¶
Defines the CLI for mujoco-mojo.
SettingsScope
¶
Bases: StrEnum
Which settings settings show should display.
-
Reference
mujoco_mojoutilslayersclisettings_show
EFFECTIVE
class-attribute
instance-attribute
¶
The fully resolved, merged settings (project + global + env + defaults).
-
Reference
mujoco_mojoutilslayersclisettings_show
PROJECT
class-attribute
instance-attribute
¶
The raw, unmerged contents of just the project-local settings file.
GLOBAL
class-attribute
instance-attribute
¶
The raw, unmerged contents of just the global settings file.
main
¶
main(
ctx: Context,
version: Annotated[
bool,
Option(
"--version",
callback=version_callback,
is_eager=True,
help="Show version and exit.",
),
] = False,
) -> None
[bold cyan]MuJoCo Mojo:[/bold cyan] High-performance and extensible physics simulation manager.
Source code in src/mujoco_mojo/utils/layers/cli.py
run_monte_carlo
¶
run_monte_carlo(
ctx: Context,
generator: GeneratorType,
runtime: RuntimeType = DEFAULT_RUNTIME,
workdir: WorkdirType = DEFAULT_WORKDIR,
n_trial: NTrialType = DEFAULT_MC_N_TRIAL,
n_proc: NProcType = n_proc,
resume: ResumeType = resume,
seed: SeedType = DEFAULT_SEED,
clean_workdir: CleanWorkdirType = clean_workdir,
model_config_name: ModelConfigNameType = model_config_name,
xml_name: XMLNameType = xml_name,
execution_mode: ExecutionModeType = LOCAL,
overrides: OverridesType = None,
trial_nums: TrialNumsType = [],
args: ArgsType = [],
kwargs: KwargsType = [],
verbose: VerboseType = 0,
quiet: QuietType = 0,
) -> None
[bold yellow]Execute a Monte Carlo campaign.[/bold yellow]
This command handles the directory setup, distribution salting, and parallel execution of physics trials.
Source code in src/mujoco_mojo/utils/layers/cli.py
| Python | |
|---|---|
707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 | |
run_single
¶
run_single(
ctx: Context,
generator: GeneratorType,
runtime: RuntimeType = DEFAULT_RUNTIME,
workdir: WorkdirType = DEFAULT_WORKDIR,
n_proc: NProcType = n_proc,
resume: ResumeType = resume,
seed: SeedType = DEFAULT_SEED,
clean_workdir: CleanWorkdirType = clean_workdir,
model_config_name: ModelConfigNameType = model_config_name,
xml_name: XMLNameType = xml_name,
execution_mode: ExecutionModeType = LOCAL,
overrides: OverridesType = None,
trial_num: TrialNumType = NOMINAL_TRIAL_NUM,
padding: PaddingType = None,
args: ArgsType = [],
kwargs: KwargsType = [],
verbose: VerboseType = 0,
quiet: QuietType = 0,
) -> None
[bold yellow]Execute a single trial.[/bold yellow]
This command handles the directory setup, distribution salting, and execution of exactly one physics trial (trial 0, the nominal run, unless [bold cyan]--trial-num[/bold cyan] targets a different one).
Source code in src/mujoco_mojo/utils/layers/cli.py
| Python | |
|---|---|
855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 | |
run_watch_workdir
¶
run_watch_workdir(
workdir: WorkdirType = DEFAULT_WORKDIR,
interval: IntervalType = 10.0,
n_proc: NProcType = n_proc,
verbose: VerboseType = 0,
quiet: QuietType = 0,
) -> None
[bold yellow]Keep a job's status current until it finishes.[/bold yellow]
For jobs whose trials are run by other processes, such as the tasks of a SLURM job. They only write their own trial's status, so [bold]job_status.json[/bold] (elapsed time, trial durations) and the runtime report would otherwise stay as they were at submission. This checks the trials every few seconds and updates both, and exits by itself once every trial is done. Safe to stop with Ctrl+C and start again; the job is not affected.
Source code in src/mujoco_mojo/utils/layers/cli.py
docs_path
¶
[bold yellow]Print the folder that holds the documentation source.[/bold yellow]
It is the same pages and mkdocs.yml as the online docs, as markdown, for the version you have installed, so it needs no network. The guides are in docs/user-guides/ and the command line reference is docs/reference/cli.md. The images are left out. Only the path is printed, for scripts and coding assistants to use. To read the pages as a site, see docs serve.
Source code in src/mujoco_mojo/utils/layers/cli.py
docs_build
¶
[bold yellow]Build the documentation site for this version of mujoco-mojo.[/bold yellow]
The site is the same as the online docs, built from the source that ships with the package and kept in ~/.mujoco-mojo/docs/v<version>. It is built once per version: the command does nothing if it is already there, unless --rebuild is given. Building needs the docs extra (pip install mujoco-mojo\[docs]). Browsing the site afterwards does not, see docs serve. The folder is printed.
Source code in src/mujoco_mojo/utils/layers/cli.py
docs_serve
¶
docs_serve(
version: DocsVersionType = None,
host: HostType = default_host,
port: PortType = default_port,
) -> None
[bold yellow]Browse the documentation site in a web browser.[/bold yellow]
Serves the site built by docs build. If this version's docs are not built yet they are built first, which needs the docs extra (pip install mujoco-mojo\[docs]) once; after that nothing extra is needed.
Source code in src/mujoco_mojo/utils/layers/cli.py
docs_list
¶
[bold yellow]List the documentation sites that are built.[/bold yellow]
One line for each, the version and the folder it is in, oldest first, with a * before the installed version. A site is built by docs build (or by docs serve, the first time) and kept in ~/.mujoco-mojo/docs, and one that an older install built is still there. Serve one with docs serve --version.
Source code in src/mujoco_mojo/utils/layers/cli.py
init_project
¶
init_project(
optimizer: Annotated[
bool,
Option(
"--optimizer/--no-optimizer",
"-op/-nop",
help="Include an [bold cyan]objective[/bold cyan] function stub for use with [bold]mujoco-mojo run optimization[/bold].",
),
] = False,
) -> None
[bold yellow]Initialize a new empty mujoco-mojo project.[/bold yellow]
Writes these to the current directory: a [bold cyan]simulation.py[/bold cyan] scaffold, the [bold cyan]run.sh[/bold cyan] and [bold cyan]reloaded.sh[/bold cyan] scripts, a project settings file, and an [bold cyan]AGENTS.md[/bold cyan] that points coding agents at the user guides (an existing [bold cyan]AGENTS.md[/bold cyan] is left alone). The scaffold contains stub implementations of [bold]generate[/bold], [bold]runtime[/bold], and [bold]UserData[/bold]. Pass [bold cyan]--optimizer[/bold cyan] to also include an [bold]objective[/bold] stub.
Source code in src/mujoco_mojo/utils/layers/cli.py
| Python | |
|---|---|
1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 | |
settings_init
¶
settings_init(
force: Annotated[
bool,
Option(
"--force",
"-f",
help="Overwrite an existing settings file (will not overwrite existing settings).",
),
] = False,
project: Annotated[
bool,
Option(
"--project",
"-p",
help="Initialize the project-local settings file (./.mujoco-mojo/settings.toml, in the current directory) instead of the global one.",
),
] = False,
) -> None
[bold yellow]Initialize a settings file with defaults.[/bold yellow]
Writes [bold cyan]~/.mujoco-mojo/settings.toml[/bold cyan] (or, with [bold]--project[/bold], [bold cyan]./.mujoco-mojo/settings.toml[/bold cyan]) plus a [bold]settings.schema.json[/bold] and [bold].taplo.toml[/bold] colocated in the same directory, for TOML editor intellisense. Safe to re-run any time to refresh the schema, e.g. after upgrading mujoco-mojo. A project file is meant to hold only the specific keys that differ from the global settings (e.g. per-project SLURM extras or force-scaling), not a full copy - and gets its own self-contained schema, independent of the global one, so intellisense keeps working even when only the project directory is visible to your editor (e.g. opened over SSH/SSHFS without the home directory mounted).
Source code in src/mujoco_mojo/utils/layers/cli.py
| Python | |
|---|---|
1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 | |
settings_show
¶
settings_show(
scope: Annotated[
SettingsScope,
Option(
"--scope",
"-s",
help="Which settings to display.",
case_sensitive=False,
),
] = EFFECTIVE,
) -> None
[bold yellow]Display settings.[/bold yellow]
By default, resolves values from all sources in priority order (environment variables, project settings file, global settings file, then defaults) and shows the resulting effective settings, with the API key masked. Pass [bold]--scope project[/bold] or [bold]--scope global[/bold] to instead show the raw, unmerged contents of just that one file (also masked).
Source code in src/mujoco_mojo/utils/layers/cli.py
| Python | |
|---|---|
1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 | |
settings_set_cmd
¶
settings_set_cmd(
key: Annotated[
str,
Argument(
help="Dotted key path (e.g. [bold cyan]dojo.sensai.enabled[/bold cyan])",
show_default=False,
),
],
value: Annotated[
str,
Argument(
help="Value to assign. Integers, floats, and [bold]True[/bold]/[bold]False[/bold] are auto-parsed.",
show_default=False,
),
],
project: Annotated[
bool,
Option(
"--project",
"-p",
help="Write to the project-local settings file (the nearest .mujoco-mojo/settings.toml in this or a parent directory, else a new one in ./.mujoco-mojo/) instead of the global one.",
),
] = False,
) -> None
[bold yellow]Update a setting.[/bold yellow]
Example: [bold cyan]mujoco-mojo settings set dojo.sensai.enabled true[/bold cyan]
Add [bold]--project[/bold] to write only the changed key into this project's local override file, leaving everything else there untouched.
Source code in src/mujoco_mojo/utils/layers/cli.py
| Python | |
|---|---|
1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 | |
settings_reset
¶
settings_reset(
project: Annotated[
bool,
Option(
"--project",
"-p",
help="Delete the project-local settings file (the nearest .mujoco-mojo/settings.toml in this or a parent directory) instead of resetting the global one.",
),
] = False,
) -> None
[bold yellow]Reset settings back to their defaults.[/bold yellow]
Without [bold]--project[/bold]: overwrites every value in [bold cyan]~/.mujoco-mojo/settings.toml[/bold cyan] with its default (comments you've added by hand are kept). With [bold]--project[/bold]: deletes the project-local override file entirely, since it's meant to hold only a small, deliberate diff, not a full copy of every setting.
Source code in src/mujoco_mojo/utils/layers/cli.py
run_reloaded
¶
run_reloaded(
generator: ReloadedGeneratorType = None,
runtime: RuntimeType = DEFAULT_RUNTIME,
workdir: WorkdirType = DEFAULT_WORKDIR,
ui: UIType = ui,
gfx: GfxType = gfx,
overrides_path: OverridesType = None,
trial_num: TrialNumType = 0,
seed: SeedType = DEFAULT_SEED,
config_path: ConfigPathFileType = None,
model_config_name: ModelConfigNameType = model_config_name,
xml_name: XMLNameType = xml_name,
watch: WatchType = watch,
record: RecordType = record,
args: ArgsType = [],
kwargs: KwargsType = [],
port: PortType = default_port,
verbose: VerboseType = 0,
quiet: QuietType = 0,
) -> None
[bold yellow]Run a development session in a terminal UI, with the model shown in a MuJoCo viewer.[/bold yellow]
Regenerates and reloads the MJCF model on command, or whenever your source files change, for rapid prototyping.
Source code in src/mujoco_mojo/utils/layers/cli.py
| Python | |
|---|---|
1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 | |
run_dojo
¶
run_dojo(
ctx: Context,
workdir: DojoWorkdirType,
host: HostType = default_host,
port: PortType = default_port,
n_proc: NProcType = n_proc,
password: DojoPassword = None,
verbose: VerboseType = 0,
quiet: QuietType = 0,
) -> None
[bold yellow]Launch the Mojo Dojo to monitor the progress of a running job.[/bold yellow]
This command reads status files in the workdir to give live updates.
Source code in src/mujoco_mojo/utils/layers/cli.py
| Python | |
|---|---|
1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 | |
run_optimizer
¶
run_optimizer(
ctx: Context,
generator: GeneratorType,
objective: ObjectiveType,
runtime: RuntimeType = DEFAULT_RUNTIME,
workdir: WorkdirType = DEFAULT_WORKDIR,
n_trial: NTrialType = DEFAULT_OP_N_TRIAL,
n_proc: NProcType = n_proc,
timeout: TimeoutType = timeout,
study_name: StudyNameType = study_name,
direction: DirectionType = direction,
sampler: SamplerType = sampler,
storage: StorageType = storage,
resume: ResumeType = resume,
seed: SeedType = DEFAULT_SEED,
evals_per_trial: EvalsPerTrialType = evals_per_trial,
refine_search_factor: RefineSearchFactorType = refine_search_factor,
prune_failed_trials: PruneFailedTrialsType = prune_failed_trials,
clean_workdir: CleanWorkdirType = clean_workdir,
model_config_name: ModelConfigNameType = model_config_name,
xml_name: XMLNameType = xml_name,
overrides: OverridesType = None,
args: ArgsType = [],
kwargs: KwargsType = [],
verbose: VerboseType = 0,
quiet: QuietType = 0,
) -> None
[bold yellow]Execute an automated Design Optimization study.[/bold yellow]
This command uses Optuna to intelligently navigate the search space defined by [bold cyan]model.design_float[/bold cyan] and [bold cyan]model.design_categorical[/bold cyan] calls within your generator.
Source code in src/mujoco_mojo/utils/layers/cli.py
| Python | |
|---|---|
1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 | |