kscale 0.0.9__py3-none-any.whl → 0.0.10__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.0.9"
3
+ __version__ = "0.0.10"
4
4
 
5
5
  from pathlib import Path
6
6
 
kscale/store/api.py CHANGED
@@ -1,6 +1,7 @@
1
1
  """Defines a common interface for the K-Scale Store API."""
2
2
 
3
3
  from pathlib import Path
4
+ from typing import overload
4
5
 
5
6
  from kscale.store.gen.api import UploadArtifactResponse
6
7
  from kscale.store.urdf import download_urdf, upload_urdf
@@ -17,8 +18,47 @@ class StoreAPI(APIBase):
17
18
 
18
19
  self.api_key = api_key
19
20
 
20
- async def urdf(self, artifact_id: str) -> Path:
21
+ async def artifact_root(self, artifact_id: str) -> Path:
21
22
  return await download_urdf(artifact_id)
22
23
 
24
+ @overload
25
+ async def urdf_path(self, artifact_id: str) -> Path: ...
26
+
27
+ @overload
28
+ async def urdf_path(self, artifact_id: str, *, throw_if_missing: bool = True) -> Path | None: ...
29
+
30
+ async def urdf_path(self, artifact_id: str, *, throw_if_missing: bool = True) -> Path | None:
31
+ root_dir = await self.artifact_root(artifact_id)
32
+ urdf_path = next(root_dir.glob("*.urdf"), None)
33
+ if urdf_path is None and throw_if_missing:
34
+ raise FileNotFoundError(f"No URDF found for artifact {artifact_id}")
35
+ return urdf_path
36
+
37
+ @overload
38
+ async def mjcf_path(self, artifact_id: str) -> Path: ...
39
+
40
+ @overload
41
+ async def mjcf_path(self, artifact_id: str, *, throw_if_missing: bool = True) -> Path | None: ...
42
+
43
+ async def mjcf_path(self, artifact_id: str, *, throw_if_missing: bool = True) -> Path | None:
44
+ root_dir = await self.artifact_root(artifact_id)
45
+ mjcf_path = next(root_dir.glob("*.mjcf"), None)
46
+ if mjcf_path is None and throw_if_missing:
47
+ raise FileNotFoundError(f"No MJCF found for artifact {artifact_id}")
48
+ return mjcf_path
49
+
50
+ @overload
51
+ async def xml_path(self, artifact_id: str) -> Path: ...
52
+
53
+ @overload
54
+ async def xml_path(self, artifact_id: str, *, throw_if_missing: bool = True) -> Path | None: ...
55
+
56
+ async def xml_path(self, artifact_id: str, *, throw_if_missing: bool = True) -> Path | None:
57
+ root_dir = await self.artifact_root(artifact_id)
58
+ xml_path = next(root_dir.glob("*.xml"), None)
59
+ if xml_path is None and throw_if_missing:
60
+ raise FileNotFoundError(f"No XML found for artifact {artifact_id}")
61
+ return xml_path
62
+
23
63
  async def upload_urdf(self, listing_id: str, root_dir: Path) -> UploadArtifactResponse:
24
64
  return await upload_urdf(listing_id, root_dir)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: kscale
3
- Version: 0.0.9
3
+ Version: 0.0.10
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=dcfdPhyC9nhbFk5nRj-R299UnVGP9ZLrZLgIGWgE5P0,177
1
+ kscale/__init__.py,sha256=s_FPBlHyXyKecFXm57Q2kH3d0O8suiaE8FrI6n0ckXU,178
2
2
  kscale/api.py,sha256=xBtKj8rgZ400r1Xx9LRY0AzSgIIttoXdejmhHhdVGS0,333
3
3
  kscale/conf.py,sha256=9fShFaYTbnrm_eiGjmy8ZtC4Q4m6PQkWPyoF3eNyov8,1424
4
4
  kscale/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -8,7 +8,7 @@ kscale/artifacts/__init__.py,sha256=RK8wdybtCJPgdLLJ8R8-YMi1Ph5ojqAKVJZowHONtgo,
8
8
  kscale/artifacts/plane.obj,sha256=x59-IIrWpLjhotChiqT2Ul6U8s0RcHkaEeUZb4KXL1c,348
9
9
  kscale/artifacts/plane.urdf,sha256=LCiTk14AyTHjkZ1jvsb0hNaEaJUxDb8Z1JjsgpXu3YM,819
10
10
  kscale/store/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
- kscale/store/api.py,sha256=rydanYGg8zlc_cNuWo9YBG_WVtPKMxFgp6fpec-B8M0,671
11
+ kscale/store/api.py,sha256=JBp4h6yz_ESSdB-2FpkD_1-hdI8_iEKh9svzkyy3jhs,2386
12
12
  kscale/store/cli.py,sha256=8ygg_1tZzOOHJotEIgSN9pfumcriPmA31sI_FCFQiTo,859
13
13
  kscale/store/client.py,sha256=R1IDnf2J4ojAcP8nmUUHfXhcHUt4zP0-mxtVI7MIC5U,2664
14
14
  kscale/store/pybullet.py,sha256=zoeATQStuRWgmPhku65xjfgvE3Y8ReheUIAkZnDr2C0,7614
@@ -18,9 +18,9 @@ kscale/store/gen/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,
18
18
  kscale/store/gen/api.py,sha256=82D41J6pg9KWdgD0lx7NggLcNS32SpnN8DqE3Md6ON0,9559
19
19
  kscale/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
20
  kscale/utils/api_base.py,sha256=Kk_WtRDdJHmOg6NtHmVxVrcfARSUkhfr29ypLch_pO0,112
21
- kscale-0.0.9.dist-info/LICENSE,sha256=HCN2bImAzUOXldAZZI7JZ9PYq6OwMlDAP_PpX1HnuN0,1071
22
- kscale-0.0.9.dist-info/METADATA,sha256=3-UEHjXp3IQo3Cdn7drrOvciylD5MnoOl2gm1V4P4Iw,2504
23
- kscale-0.0.9.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
24
- kscale-0.0.9.dist-info/entry_points.txt,sha256=PaVs1ivqB0BBdGUsiFkxGUYjGLz05VqagxwRVwi4yV4,54
25
- kscale-0.0.9.dist-info/top_level.txt,sha256=C2ynjYwopg6YjgttnI2dJjasyq3EKNmYp-IfQg9Xms4,7
26
- kscale-0.0.9.dist-info/RECORD,,
21
+ kscale-0.0.10.dist-info/LICENSE,sha256=HCN2bImAzUOXldAZZI7JZ9PYq6OwMlDAP_PpX1HnuN0,1071
22
+ kscale-0.0.10.dist-info/METADATA,sha256=4K7YAFdI1P5PIAAw78lvbyUw1zIAZ_-ZiZr2NFx-o2Q,2505
23
+ kscale-0.0.10.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
24
+ kscale-0.0.10.dist-info/entry_points.txt,sha256=PaVs1ivqB0BBdGUsiFkxGUYjGLz05VqagxwRVwi4yV4,54
25
+ kscale-0.0.10.dist-info/top_level.txt,sha256=C2ynjYwopg6YjgttnI2dJjasyq3EKNmYp-IfQg9Xms4,7
26
+ kscale-0.0.10.dist-info/RECORD,,