kscale 0.3.4__py3-none-any.whl → 0.3.6__py3-none-any.whl

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.
kscale/__init__.py CHANGED
@@ -1,6 +1,6 @@
1
1
  """Defines the common interface for the K-Scale Python API."""
2
2
 
3
- __version__ = "0.3.4"
3
+ __version__ = "0.3.6"
4
4
 
5
5
  from pathlib import Path
6
6
 
@@ -145,12 +145,12 @@ async def upload(class_name: str, urdf_file: str) -> None:
145
145
 
146
146
  @urdf.command()
147
147
  @click.argument("class_name")
148
- @click.option("--no-cache", is_flag=True, default=False)
148
+ @click.option("--cache", is_flag=True, default=False)
149
149
  @coro
150
- async def download(class_name: str, no_cache: bool) -> None:
150
+ async def download(class_name: str, cache: bool) -> None:
151
151
  """Downloads a URDF file from a robot class."""
152
152
  async with RobotClassClient() as client:
153
- urdf_file = await client.download_compressed_urdf(class_name, cache=not no_cache)
153
+ urdf_file = await client.download_and_extract_urdf(class_name, cache=cache)
154
154
  click.echo(f"URDF downloaded: {click.style(urdf_file, fg='green')}")
155
155
 
156
156
 
@@ -432,5 +432,40 @@ async def pybullet(
432
432
  last_time = cur_time
433
433
 
434
434
 
435
+ @urdf.command()
436
+ @click.argument("class_name")
437
+ @click.option("--no-cache", is_flag=True, default=False)
438
+ @coro
439
+ async def mujoco(class_name: str, no_cache: bool) -> None:
440
+ """Shows the URDF file for a robot class in Mujoco.
441
+
442
+ This command downloads and extracts the robot class URDF folder,
443
+ searches for an MJCF file (unless --mjcf-path is provided), and then
444
+ launches the Mujoco viewer using the provided MJCF file.
445
+ """
446
+ try:
447
+ from mujoco.viewer import launch_from_path
448
+ except ImportError:
449
+ click.echo(
450
+ click.style(
451
+ "Mujoco and mujoco-python-viewer are required; install with `pip install mujoco mujoco-python-viewer`",
452
+ fg="red",
453
+ )
454
+ )
455
+ return
456
+
457
+ async with RobotClassClient() as client:
458
+ extracted_folder = await client.download_and_extract_urdf(class_name, cache=not no_cache)
459
+
460
+ try:
461
+ mjcf_file = next(extracted_folder.glob("*.mjcf"))
462
+ except StopIteration:
463
+ click.echo(click.style(f"No MJCF file found in {extracted_folder}", fg="red"))
464
+ return
465
+
466
+ click.echo(f"Launching Mujoco viewer with: {click.style(str(mjcf_file.resolve()), fg='green')}")
467
+ launch_from_path(str(mjcf_file.resolve()))
468
+
469
+
435
470
  if __name__ == "__main__":
436
471
  cli()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: kscale
3
- Version: 0.3.4
3
+ Version: 0.3.6
4
4
  Summary: The kscale project
5
5
  Home-page: https://github.com/kscalelabs/kscale
6
6
  Author: Benjamin Bolte
@@ -1,4 +1,4 @@
1
- kscale/__init__.py,sha256=V2Cyf1VdoNg6oWf_oDeuT68atrI9yCcJ_ZKhQm7TEoM,200
1
+ kscale/__init__.py,sha256=ny2947fOKliAIcJrudjMn6Ocfzk9Hb-VXUNFPikAPGo,200
2
2
  kscale/cli.py,sha256=PMHLKR5UwdbbReVmqHXpJ-K9-mGHv_0I7KQkwxmFcUA,881
3
3
  kscale/conf.py,sha256=dm35XSnzJp93St-ixVtYN4Nvqvb5upPGBrWkSI6Yb-4,1743
4
4
  kscale/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -15,7 +15,7 @@ kscale/web/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
15
  kscale/web/utils.py,sha256=Mme-FAQ0_zbjjOQeX8wyq8F4kL4i9fH7ytri16U6qOA,1046
16
16
  kscale/web/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
17
  kscale/web/cli/robot.py,sha256=rI-A4_0uvJPeA71Apl4Z3mV5fIfWkgmzT9JRmJYxz3A,3307
18
- kscale/web/cli/robot_class.py,sha256=Gvfg_TsSC0MRUhBIx0yDVXOf8P4kyDbR_glFv5svuDA,17481
18
+ kscale/web/cli/robot_class.py,sha256=Ymyrc3UqsO7PzP_wJFXEWW37knMCDZTYP-8ziXVa-AQ,18710
19
19
  kscale/web/cli/token.py,sha256=1rFC8MYKtqbNsQa2KIqwW1tqpaMtFaxuNsallwejXTU,787
20
20
  kscale/web/cli/user.py,sha256=aaJJCL1P5lfhK6ZC9OwOHXKA-I3MWqVZ_k7TYnx33CY,1303
21
21
  kscale/web/clients/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -26,9 +26,9 @@ kscale/web/clients/robot_class.py,sha256=G8Nk6V7LGJE9Wpg9tyyCkIfz1fRTsxXQRgHtlei
26
26
  kscale/web/clients/user.py,sha256=jsa1_s6qXRM-AGBbHlPhd1NierUtynjY9tVAPNr6_Os,568
27
27
  kscale/web/gen/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
28
28
  kscale/web/gen/api.py,sha256=VWlt8TaMZaAhCPPIWhx1d4yE0BRfpVz0-_Cps8hjgAI,4662
29
- kscale-0.3.4.dist-info/LICENSE,sha256=HCN2bImAzUOXldAZZI7JZ9PYq6OwMlDAP_PpX1HnuN0,1071
30
- kscale-0.3.4.dist-info/METADATA,sha256=pC6jmfVl-vgdGoqEkyOu6Ekhz0-Ppb5iKPCwhBvq0Ic,2340
31
- kscale-0.3.4.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
32
- kscale-0.3.4.dist-info/entry_points.txt,sha256=N_0pCpPnwGDYVzOeuaSOrbJkS5L3lS9d8CxpJF1f8UI,62
33
- kscale-0.3.4.dist-info/top_level.txt,sha256=C2ynjYwopg6YjgttnI2dJjasyq3EKNmYp-IfQg9Xms4,7
34
- kscale-0.3.4.dist-info/RECORD,,
29
+ kscale-0.3.6.dist-info/LICENSE,sha256=HCN2bImAzUOXldAZZI7JZ9PYq6OwMlDAP_PpX1HnuN0,1071
30
+ kscale-0.3.6.dist-info/METADATA,sha256=IHjwsym9rqmZnPltfYE3nGywHbDFR-HCOVfh_YrG_Bg,2340
31
+ kscale-0.3.6.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
32
+ kscale-0.3.6.dist-info/entry_points.txt,sha256=N_0pCpPnwGDYVzOeuaSOrbJkS5L3lS9d8CxpJF1f8UI,62
33
+ kscale-0.3.6.dist-info/top_level.txt,sha256=C2ynjYwopg6YjgttnI2dJjasyq3EKNmYp-IfQg9Xms4,7
34
+ kscale-0.3.6.dist-info/RECORD,,
File without changes