kscale 0.0.1__tar.gz → 0.0.2__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. kscale-0.0.2/PKG-INFO +52 -0
  2. kscale-0.0.2/README.md +32 -0
  3. kscale-0.0.2/kscale/__init__.py +1 -0
  4. {kscale-0.0.1 → kscale-0.0.2}/kscale/conf.py +3 -11
  5. kscale-0.0.2/kscale/formats/mjcf.py +509 -0
  6. kscale-0.0.2/kscale/requirements.txt +8 -0
  7. kscale-0.0.2/kscale/store/bullet/MANIFEST.in +1 -0
  8. kscale-0.0.2/kscale/store/cli.py +30 -0
  9. kscale-0.0.2/kscale/store/pybullet.py +178 -0
  10. kscale-0.0.2/kscale/store/urdf.py +174 -0
  11. kscale-0.0.2/kscale.egg-info/PKG-INFO +52 -0
  12. {kscale-0.0.1 → kscale-0.0.2}/kscale.egg-info/SOURCES.txt +5 -1
  13. kscale-0.0.2/kscale.egg-info/entry_points.txt +2 -0
  14. {kscale-0.0.1 → kscale-0.0.2}/kscale.egg-info/requires.txt +2 -0
  15. {kscale-0.0.1 → kscale-0.0.2}/setup.cfg +4 -0
  16. {kscale-0.0.1 → kscale-0.0.2}/setup.py +1 -1
  17. kscale-0.0.1/PKG-INFO +0 -29
  18. kscale-0.0.1/README.md +0 -11
  19. kscale-0.0.1/kscale/requirements.txt +0 -3
  20. kscale-0.0.1/kscale/store/auth.py +0 -13
  21. kscale-0.0.1/kscale/store/gen/__init__.py +0 -0
  22. kscale-0.0.1/kscale/store/urdf.py +0 -1
  23. kscale-0.0.1/kscale.egg-info/PKG-INFO +0 -29
  24. {kscale-0.0.1 → kscale-0.0.2}/LICENSE +0 -0
  25. {kscale-0.0.1 → kscale-0.0.2}/MANIFEST.in +0 -0
  26. {kscale-0.0.1 → kscale-0.0.2}/kscale/py.typed +0 -0
  27. {kscale-0.0.1 → kscale-0.0.2}/kscale/requirements-dev.txt +0 -0
  28. {kscale-0.0.1/kscale → kscale-0.0.2/kscale/store}/__init__.py +0 -0
  29. {kscale-0.0.1/kscale/store → kscale-0.0.2/kscale/store/gen}/__init__.py +0 -0
  30. {kscale-0.0.1 → kscale-0.0.2}/kscale/store/gen/api.py +0 -0
  31. {kscale-0.0.1 → kscale-0.0.2}/kscale.egg-info/dependency_links.txt +0 -0
  32. {kscale-0.0.1 → kscale-0.0.2}/kscale.egg-info/top_level.txt +0 -0
  33. {kscale-0.0.1 → kscale-0.0.2}/pyproject.toml +0 -0
  34. {kscale-0.0.1 → kscale-0.0.2}/tests/test_dummy.py +0 -0
kscale-0.0.2/PKG-INFO ADDED
@@ -0,0 +1,52 @@
1
+ Metadata-Version: 2.1
2
+ Name: kscale
3
+ Version: 0.0.2
4
+ Summary: The kscale project
5
+ Home-page: https://github.com/kscalelabs/kscale
6
+ Author: Benjamin Bolte
7
+ Requires-Python: >=3.11
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Requires-Dist: omegaconf
11
+ Requires-Dist: httpx
12
+ Requires-Dist: requests
13
+ Provides-Extra: dev
14
+ Requires-Dist: black; extra == "dev"
15
+ Requires-Dist: darglint; extra == "dev"
16
+ Requires-Dist: mypy; extra == "dev"
17
+ Requires-Dist: pytest; extra == "dev"
18
+ Requires-Dist: ruff; extra == "dev"
19
+ Requires-Dist: datamodel-code-generator; extra == "dev"
20
+
21
+ <p align="center">
22
+ <picture>
23
+ <img alt="K-Scale Open Source Robotics" src="https://media.kscale.dev/kscale-open-source-header.png" style="max-width: 100%;">
24
+ </picture>
25
+ </p>
26
+
27
+ <div align="center">
28
+
29
+ [![License](https://img.shields.io/badge/license-MIT-green)](https://github.com/kscalelabs/ksim/blob/main/LICENSE)
30
+ [![Discord](https://img.shields.io/discord/1224056091017478166)](https://discord.gg/k5mSvCkYQh)
31
+ [![Wiki](https://img.shields.io/badge/wiki-humanoids-black)](https://humanoids.wiki)
32
+ <br />
33
+ [![python](https://img.shields.io/badge/-Python_3.11-blue?logo=python&logoColor=white)](https://github.com/pre-commit/pre-commit)
34
+ [![black](https://img.shields.io/badge/Code%20Style-Black-black.svg?labelColor=gray)](https://black.readthedocs.io/en/stable/)
35
+ [![ruff](https://img.shields.io/badge/Linter-Ruff-red.svg?labelColor=gray)](https://github.com/charliermarsh/ruff)
36
+ <br />
37
+ [![Python Checks](https://github.com/kscalelabs/kscale/actions/workflows/test.yml/badge.svg)](https://github.com/kscalelabs/kscale/actions/workflows/test.yml)
38
+ [![Publish Python Package](https://github.com/kscalelabs/kscale/actions/workflows/publish.yml/badge.svg)](https://github.com/kscalelabs/kscale/actions/workflows/publish.yml)
39
+
40
+ </div>
41
+
42
+ # K-Scale Command Line Interface
43
+
44
+ This is a command line tool for interacting with various services provided by K-Scale Labs, such as:
45
+
46
+ - [K-Scale Store](https://kscale.store/)
47
+
48
+ ## Installation
49
+
50
+ ```bash
51
+ pip install kscale
52
+ ```
kscale-0.0.2/README.md ADDED
@@ -0,0 +1,32 @@
1
+ <p align="center">
2
+ <picture>
3
+ <img alt="K-Scale Open Source Robotics" src="https://media.kscale.dev/kscale-open-source-header.png" style="max-width: 100%;">
4
+ </picture>
5
+ </p>
6
+
7
+ <div align="center">
8
+
9
+ [![License](https://img.shields.io/badge/license-MIT-green)](https://github.com/kscalelabs/ksim/blob/main/LICENSE)
10
+ [![Discord](https://img.shields.io/discord/1224056091017478166)](https://discord.gg/k5mSvCkYQh)
11
+ [![Wiki](https://img.shields.io/badge/wiki-humanoids-black)](https://humanoids.wiki)
12
+ <br />
13
+ [![python](https://img.shields.io/badge/-Python_3.11-blue?logo=python&logoColor=white)](https://github.com/pre-commit/pre-commit)
14
+ [![black](https://img.shields.io/badge/Code%20Style-Black-black.svg?labelColor=gray)](https://black.readthedocs.io/en/stable/)
15
+ [![ruff](https://img.shields.io/badge/Linter-Ruff-red.svg?labelColor=gray)](https://github.com/charliermarsh/ruff)
16
+ <br />
17
+ [![Python Checks](https://github.com/kscalelabs/kscale/actions/workflows/test.yml/badge.svg)](https://github.com/kscalelabs/kscale/actions/workflows/test.yml)
18
+ [![Publish Python Package](https://github.com/kscalelabs/kscale/actions/workflows/publish.yml/badge.svg)](https://github.com/kscalelabs/kscale/actions/workflows/publish.yml)
19
+
20
+ </div>
21
+
22
+ # K-Scale Command Line Interface
23
+
24
+ This is a command line tool for interacting with various services provided by K-Scale Labs, such as:
25
+
26
+ - [K-Scale Store](https://kscale.store/)
27
+
28
+ ## Installation
29
+
30
+ ```bash
31
+ pip install kscale
32
+ ```
@@ -0,0 +1 @@
1
+ __version__ = "0.0.2"
@@ -17,21 +17,13 @@ def get_path() -> Path:
17
17
 
18
18
  @dataclass
19
19
  class StoreSettings:
20
- api_key: str = field(default=II("oc.env:KSCALE_API_KEY"))
21
-
22
- def get_api_key(self) -> str:
23
- try:
24
- return self.api_key
25
- except AttributeError:
26
- raise ValueError(
27
- "API key not found! Get one here and set it as the `KSCALE_API_KEY` "
28
- "environment variable: https://kscale.store/keys"
29
- )
20
+ api_key: str = field(default=II("oc.env:KSCALE_API_KEY,"))
21
+ cache_dir: str = field(default=II("oc.env:KSCALE_CACHE_DIR,'~/.kscale/cache/'"))
30
22
 
31
23
 
32
24
  @dataclass
33
25
  class Settings:
34
- store: StoreSettings = StoreSettings()
26
+ store: StoreSettings = field(default_factory=StoreSettings)
35
27
 
36
28
  def save(self) -> None:
37
29
  (dir_path := get_path()).mkdir(parents=True, exist_ok=True)
@@ -0,0 +1,509 @@
1
+ """Defines common types and functions for exporting MJCF files.
2
+
3
+ API reference:
4
+ https://github.com/google-deepmind/mujoco/blob/main/src/xml/xml_native_writer.cc#L780
5
+
6
+ Todo:
7
+ 1. Clean up the inertia config
8
+ 2. Add visual and imu support
9
+ """
10
+
11
+ import glob
12
+ import os
13
+ import shutil
14
+ import xml.etree.ElementTree as ET
15
+ from dataclasses import dataclass, field
16
+ from pathlib import Path
17
+ from typing import Literal
18
+
19
+
20
+ @dataclass
21
+ class Compiler:
22
+ coordinate: Literal["local", "global"] | None = None
23
+ angle: Literal["radian", "degree"] = "radian"
24
+ meshdir: str | None = None
25
+ eulerseq: Literal["xyz", "zxy", "zyx", "yxz", "yzx", "xzy"] | None = None
26
+ autolimits: bool | None = None
27
+
28
+ def to_xml(self, compiler: ET.Element | None = None) -> ET.Element:
29
+ if compiler is None:
30
+ compiler = ET.Element("compiler")
31
+ if self.coordinate is not None:
32
+ compiler.set("coordinate", self.coordinate)
33
+ compiler.set("angle", self.angle)
34
+ if self.meshdir is not None:
35
+ compiler.set("meshdir", self.meshdir)
36
+ if self.eulerseq is not None:
37
+ compiler.set("eulerseq", self.eulerseq)
38
+ if self.autolimits is not None:
39
+ compiler.set("autolimits", str(self.autolimits).lower())
40
+ return compiler
41
+
42
+
43
+ @dataclass
44
+ class Mesh:
45
+ name: str
46
+ file: str
47
+ scale: tuple[float, float, float] | None = None
48
+
49
+ def to_xml(self, root: ET.Element | None = None) -> ET.Element:
50
+ mesh = ET.Element("mesh") if root is None else ET.SubElement(root, "mesh")
51
+ mesh.set("name", self.name)
52
+ mesh.set("file", self.file)
53
+ if self.scale is not None:
54
+ mesh.set("scale", " ".join(map(str, self.scale)))
55
+ return mesh
56
+
57
+
58
+ @dataclass
59
+ class Joint:
60
+ name: str | None = None
61
+ type: Literal["hinge", "slide", "ball", "free"] | None = None
62
+ pos: tuple[float, float, float] | None = None
63
+ axis: tuple[float, float, float] | None = None
64
+ limited: bool | None = None
65
+ range: tuple[float, float] | None = None
66
+ damping: float | None = None
67
+ stiffness: float | None = None
68
+ armature: float | None = None
69
+ frictionloss: float | None = None
70
+
71
+ def to_xml(self, root: ET.Element | None = None) -> ET.Element:
72
+ joint = ET.Element("joint") if root is None else ET.SubElement(root, "joint")
73
+ if self.name is not None:
74
+ joint.set("name", self.name)
75
+ if self.type is not None:
76
+ joint.set("type", self.type)
77
+ if self.pos is not None:
78
+ joint.set("pos", " ".join(map(str, self.pos)))
79
+ if self.axis is not None:
80
+ joint.set("axis", " ".join(map(str, self.axis)))
81
+ if self.range is not None:
82
+ joint.set("range", " ".join(map(str, self.range)))
83
+ if self.limited is not None:
84
+ joint.set("limited", str(self.limited).lower())
85
+ if self.damping is not None:
86
+ joint.set("damping", str(self.damping))
87
+ if self.stiffness is not None:
88
+ joint.set("stiffness", str(self.stiffness))
89
+ if self.armature is not None:
90
+ joint.set("armature", str(self.armature))
91
+ if self.frictionloss is not None:
92
+ joint.set("frictionloss", str(self.frictionloss))
93
+ return joint
94
+
95
+
96
+ @dataclass
97
+ class Geom:
98
+ name: str | None = None
99
+ type: Literal["plane", "sphere", "cylinder", "box", "capsule", "ellipsoid", "mesh"] | None = None
100
+ plane: str | None = None
101
+ rgba: tuple[float, float, float, float] | None = None
102
+ pos: tuple[float, float, float] | None = None
103
+ quat: tuple[float, float, float, float] | None = None
104
+ matplane: str | None = None
105
+ material: str | None = None
106
+ condim: int | None = None
107
+ contype: int | None = None
108
+ conaffinity: int | None = None
109
+ size: tuple[float, float, float] | None = None
110
+ friction: tuple[float, float, float] | None = None
111
+ solref: tuple[float, float] | None = None
112
+ density: float | None = None
113
+
114
+ def to_xml(self, root: ET.Element | None = None) -> ET.Element:
115
+ geom = ET.Element("geom") if root is None else ET.SubElement(root, "geom")
116
+ if self.name is not None:
117
+ geom.set("name", self.name)
118
+ if self.type is not None:
119
+ geom.set("type", self.type)
120
+ if self.rgba is not None:
121
+ geom.set("rgba", " ".join(map(str, self.rgba)))
122
+ if self.pos is not None:
123
+ geom.set("pos", " ".join(map(str, self.pos)))
124
+ if self.quat is not None:
125
+ geom.set("quat", " ".join(map(str, self.quat)))
126
+ if self.matplane is not None:
127
+ geom.set("matplane", self.matplane)
128
+ if self.material is not None:
129
+ geom.set("material", self.material)
130
+ if self.condim is not None:
131
+ geom.set("condim", str(self.condim))
132
+ if self.contype is not None:
133
+ geom.set("contype", str(self.contype))
134
+ if self.conaffinity is not None:
135
+ geom.set("conaffinity", str(self.conaffinity))
136
+ if self.plane is not None:
137
+ geom.set("plane", self.plane)
138
+ if self.size is not None:
139
+ geom.set("size", " ".join(map(str, self.size)))
140
+ if self.friction is not None:
141
+ geom.set("friction", " ".join(map(str, self.friction)))
142
+ if self.solref is not None:
143
+ geom.set("solref", " ".join(map(str, self.solref)))
144
+ if self.density is not None:
145
+ geom.set("density", str(self.density))
146
+ return geom
147
+
148
+
149
+ @dataclass
150
+ class Body:
151
+ name: str
152
+ pos: tuple[float, float, float] | None = field(default=None)
153
+ quat: tuple[float, float, float, float] | None = field(default=None)
154
+ geom: Geom | None = field(default=None)
155
+ joint: Joint | None = field(default=None)
156
+
157
+ # TODO - Fix inertia, until then rely on Mujoco's engine
158
+ # inertial: Inertial = None
159
+
160
+ def to_xml(self, root: ET.Element | None = None) -> ET.Element:
161
+ body = ET.Element("body") if root is None else ET.SubElement(root, "body")
162
+ body.set("name", self.name)
163
+ if self.pos is not None:
164
+ body.set("pos", " ".join(map(str, self.pos)))
165
+ if self.quat is not None:
166
+ body.set("quat", " ".join(f"{x:.8g}" for x in self.quat))
167
+ if self.joint is not None:
168
+ self.joint.to_xml(body)
169
+ if self.geom is not None:
170
+ self.geom.to_xml(body)
171
+ return body
172
+
173
+
174
+ @dataclass
175
+ class Flag:
176
+ frictionloss: str | None = None
177
+ # removed at 3.1.4
178
+ # sensornoise: str | None = None
179
+
180
+ def to_xml(self, root: ET.Element | None = None) -> ET.Element:
181
+ flag = ET.Element("flag") if root is None else ET.SubElement(root, "flag")
182
+ if self.frictionloss is not None:
183
+ flag.set("frictionloss", self.frictionloss)
184
+ return flag
185
+
186
+
187
+ @dataclass
188
+ class Option:
189
+ timestep: float | None = None
190
+ viscosity: float | None = None
191
+ iterations: int | None = None
192
+ solver: Literal["PGS", "CG", "Newton"] | None = None
193
+ gravity: tuple[float, float, float] | None = None
194
+ flag: Flag | None = None
195
+
196
+ def to_xml(self, root: ET.Element | None = None) -> ET.Element:
197
+ if root is None:
198
+ option = ET.Element("option")
199
+ else:
200
+ option = ET.SubElement(root, "option")
201
+ if self.iterations is not None:
202
+ option.set("iterations", str(self.iterations))
203
+ if self.timestep is not None:
204
+ option.set("timestep", str(self.timestep))
205
+ if self.viscosity is not None:
206
+ option.set("viscosity", str(self.viscosity))
207
+ if self.solver is not None:
208
+ option.set("solver", self.solver)
209
+ if self.gravity is not None:
210
+ option.set("gravity", " ".join(map(str, self.gravity)))
211
+ if self.flag is not None:
212
+ self.flag.to_xml(option)
213
+ return option
214
+
215
+
216
+ @dataclass
217
+ class Motor:
218
+ name: str | None = None
219
+ joint: str | None = None
220
+ ctrlrange: tuple[float, float] | None = None
221
+ ctrllimited: bool | None = None
222
+ gear: float | None = None
223
+
224
+ def to_xml(self, root: ET.Element | None = None) -> ET.Element:
225
+ if root is None:
226
+ motor = ET.Element("motor")
227
+ else:
228
+ motor = ET.SubElement(root, "motor")
229
+ if self.name is not None:
230
+ motor.set("name", self.name)
231
+ if self.joint is not None:
232
+ motor.set("joint", self.joint)
233
+ if self.ctrllimited is not None:
234
+ motor.set("ctrllimited", str(self.ctrllimited).lower())
235
+ if self.ctrlrange is not None:
236
+ motor.set("ctrlrange", " ".join(map(str, self.ctrlrange)))
237
+ if self.gear is not None:
238
+ motor.set("gear", str(self.gear))
239
+ return motor
240
+
241
+
242
+ @dataclass
243
+ class Light:
244
+ directional: bool = True
245
+ diffuse: tuple[float, float, float] | None = None
246
+ specular: tuple[float, float, float] | None = None
247
+ pos: tuple[float, float, float] | None = None
248
+ dir: tuple[float, float, float] | None = None
249
+ castshadow: bool | None = None
250
+
251
+ def to_xml(self, root: ET.Element | None = None) -> ET.Element:
252
+ if root is None:
253
+ light = ET.Element("light")
254
+ else:
255
+ light = ET.SubElement(root, "light")
256
+ if self.directional is not None:
257
+ light.set("directional", str(self.directional).lower())
258
+ if self.diffuse is not None:
259
+ light.set("diffuse", " ".join(map(str, self.diffuse)))
260
+ if self.specular is not None:
261
+ light.set("specular", " ".join(map(str, self.specular)))
262
+ if self.pos is not None:
263
+ light.set("pos", " ".join(map(str, self.pos)))
264
+ if self.dir is not None:
265
+ light.set("dir", " ".join(map(str, self.dir)))
266
+ if self.castshadow is not None:
267
+ light.set("castshadow", str(self.castshadow).lower())
268
+ return light
269
+
270
+
271
+ @dataclass
272
+ class Equality:
273
+ solref: tuple[float, float]
274
+
275
+ def to_xml(self, root: ET.Element | None = None) -> ET.Element:
276
+ equality = ET.Element("equality") if root is None else ET.SubElement(root, "equality")
277
+ equality.set("solref", " ".join(map(str, self.solref)))
278
+ return equality
279
+
280
+
281
+ @dataclass
282
+ class Site:
283
+ name: str | None = None
284
+ size: float | None = None
285
+ pos: tuple[float, float, float] | None = None
286
+
287
+ def to_xml(self, root: ET.Element | None = None) -> ET.Element:
288
+ site = ET.Element("site") if root is None else ET.SubElement(root, "site")
289
+ if self.name is not None:
290
+ site.set("name", self.name)
291
+ if self.size is not None:
292
+ site.set("size", str(self.size))
293
+ if self.pos is not None:
294
+ site.set("pos", " ".join(map(str, self.pos)))
295
+ return site
296
+
297
+
298
+ @dataclass
299
+ class Default:
300
+ joint: Joint | None = None
301
+ geom: Geom | None = None
302
+ class_: str | None = None
303
+ motor: Motor | None = None
304
+ equality: Equality | None = None
305
+ visual_geom: ET.Element | None = None
306
+
307
+ def to_xml(self, default: ET.Element | None = None) -> ET.Element:
308
+ default = ET.Element("default") if default is None else ET.SubElement(default, "default")
309
+ if self.joint is not None:
310
+ self.joint.to_xml(default)
311
+ if self.geom is not None:
312
+ self.geom.to_xml(default)
313
+ if self.class_ is not None:
314
+ default.set("class", self.class_)
315
+ if self.motor is not None:
316
+ self.motor.to_xml(default)
317
+ if self.equality is not None:
318
+ self.equality.to_xml(default)
319
+ if self.visual_geom is not None:
320
+ default.append(self.visual_geom)
321
+ return default
322
+
323
+
324
+ @dataclass
325
+ class Actuator:
326
+ motors: list[Motor]
327
+
328
+ def to_xml(self, root: ET.Element | None = None) -> ET.Element:
329
+ actuator = ET.Element("actuator") if root is None else ET.SubElement(root, "actuator")
330
+ for motor in self.motors:
331
+ motor.to_xml(actuator)
332
+ return actuator
333
+
334
+
335
+ @dataclass
336
+ class Actuatorpos:
337
+ name: str | None = None
338
+ actuator: str | None = None
339
+ user: str | None = None
340
+
341
+ def to_xml(self, root: ET.Element | None = None) -> ET.Element:
342
+ actuatorpos = ET.Element("actuatorpos") if root is None else ET.SubElement(root, "actuatorpos")
343
+ if self.name is not None:
344
+ actuatorpos.set("name", self.name)
345
+ if self.actuator is not None:
346
+ actuatorpos.set("actuator", self.actuator)
347
+ if self.user is not None:
348
+ actuatorpos.set("user", self.user)
349
+ return actuatorpos
350
+
351
+
352
+ @dataclass
353
+ class Actuatorvel:
354
+ name: str | None = None
355
+ actuator: str | None = None
356
+ user: str | None = None
357
+
358
+ def to_xml(self, root: ET.Element | None = None) -> ET.Element:
359
+ actuatorvel = ET.Element("actuatorvel") if root is None else ET.SubElement(root, "actuatorvel")
360
+ if self.name is not None:
361
+ actuatorvel.set("name", self.name)
362
+ if self.actuator is not None:
363
+ actuatorvel.set("actuator", self.actuator)
364
+ if self.user is not None:
365
+ actuatorvel.set("user", self.user)
366
+ return actuatorvel
367
+
368
+
369
+ @dataclass
370
+ class Actuatorfrc:
371
+ name: str | None = None
372
+ actuator: str | None = None
373
+ user: str | None = None
374
+ noise: float | None = None
375
+
376
+ def to_xml(self, root: ET.Element | None = None) -> ET.Element:
377
+ actuatorfrc = ET.Element("actuatorfrc") if root is None else ET.SubElement(root, "actuatorfrc")
378
+ if self.name is not None:
379
+ actuatorfrc.set("name", self.name)
380
+ if self.actuator is not None:
381
+ actuatorfrc.set("actuator", self.actuator)
382
+ if self.user is not None:
383
+ actuatorfrc.set("user", self.user)
384
+ if self.noise is not None:
385
+ actuatorfrc.set("noise", str(self.noise))
386
+ return actuatorfrc
387
+
388
+
389
+ @dataclass
390
+ class Sensor:
391
+ actuatorpos: list[Actuatorpos] | None = None
392
+ actuatorvel: list[Actuatorvel] | None = None
393
+ actuatorfrc: list[Actuatorfrc] | None = None
394
+
395
+ def to_xml(self, root: ET.Element | None = None) -> ET.Element:
396
+ sensor = ET.Element("sensor") if root is None else ET.SubElement(root, "sensor")
397
+ if self.actuatorpos is not None:
398
+ for actuatorpos in self.actuatorpos:
399
+ actuatorpos.to_xml(sensor)
400
+ if self.actuatorvel is not None:
401
+ for actuatorvel in self.actuatorvel:
402
+ actuatorvel.to_xml(sensor)
403
+ if self.actuatorfrc is not None:
404
+ for actuatorfrc in self.actuatorfrc:
405
+ actuatorfrc.to_xml(sensor)
406
+ return sensor
407
+
408
+
409
+ def _copy_stl_files(source_directory: str | Path, destination_directory: str | Path) -> None:
410
+ # Ensure the destination directory exists, create if not
411
+ os.makedirs(destination_directory, exist_ok=True)
412
+
413
+ # Use glob to find all .stl files in the source directory
414
+ pattern = os.path.join(source_directory, "*.stl")
415
+ for file_path in glob.glob(pattern):
416
+ destination_path = os.path.join(destination_directory, os.path.basename(file_path))
417
+ shutil.copy(file_path, destination_path)
418
+ print(f"Copied {file_path} to {destination_path}")
419
+
420
+
421
+ def _remove_stl_files(source_directory: str | Path) -> None:
422
+ for filename in os.listdir(source_directory):
423
+ if filename.endswith(".stl"):
424
+ file_path = os.path.join(source_directory, filename)
425
+ os.remove(file_path)
426
+
427
+
428
+ class Robot:
429
+ """A class to adapt the world in a Mujoco XML file."""
430
+
431
+ def __init__(
432
+ self,
433
+ robot_name: str,
434
+ output_dir: str | Path,
435
+ compiler: Compiler | None = None,
436
+ ) -> None:
437
+ """Initialize the robot.
438
+
439
+ Args:
440
+ robot_name (str): The name of the robot.
441
+ output_dir (str | Path): The output directory.
442
+ compiler (Compiler, optional): The compiler settings.
443
+ """
444
+ self.robot_name = robot_name
445
+ self.output_dir = Path(output_dir)
446
+ self.compiler = compiler
447
+ self._set_clean_up()
448
+ self.tree = ET.parse(self.output_dir / f"{self.robot_name}.xml")
449
+
450
+ def _set_clean_up(self) -> None:
451
+ try:
452
+ import mujoco # type: ignore[import-not-found]
453
+ except ImportError as e:
454
+ raise ImportError(
455
+ "Please install the package with Mujoco as a dependency, using "
456
+ "`pip install kscale-onshape-library[mujoco]`"
457
+ ) from e
458
+
459
+ # HACK
460
+ # mujoco has a hard time reading meshes
461
+ _copy_stl_files(self.output_dir / "meshes", self.output_dir)
462
+
463
+ urdf_tree = ET.parse(self.output_dir / f"{self.robot_name}.urdf")
464
+ root = urdf_tree.getroot()
465
+
466
+ tree = ET.ElementTree(root)
467
+ tree.write(self.output_dir / f"{self.robot_name}.urdf", encoding="utf-8")
468
+ model = mujoco.MjModel.from_xml_path((self.output_dir / f"{self.robot_name}.urdf").as_posix())
469
+ mujoco.mj_saveLastXML((self.output_dir / f"{self.robot_name}.xml").as_posix(), model)
470
+
471
+ # Removes all the existing files.
472
+ _remove_stl_files(self.output_dir)
473
+
474
+ def adapt_world(self) -> None:
475
+ root = self.tree.getroot()
476
+
477
+ # Turn off internal collisions
478
+ for element in root:
479
+ if element.tag == "geom":
480
+ element.attrib["contype"] = str(1)
481
+ element.attrib["conaffinity"] = str(0)
482
+
483
+ compiler = root.find("compiler")
484
+ if self.compiler is not None:
485
+ compiler = self.compiler.to_xml(compiler)
486
+
487
+ worldbody = root.find("worldbody")
488
+ if worldbody is None:
489
+ raise ValueError("No worldbody found in the XML file")
490
+
491
+ new_root_body = Body(name="root", pos=(0, 0, 0), quat=(1, 0, 0, 0)).to_xml()
492
+
493
+ # List to store items to be moved to the new root body
494
+ items_to_move = []
495
+ # Gather all children (geoms and bodies) that need to be moved under the new root body
496
+ for element in worldbody:
497
+ items_to_move.append(element)
498
+
499
+ # Move gathered elements to the new root body
500
+ for item in items_to_move:
501
+ worldbody.remove(item)
502
+ new_root_body.append(item)
503
+
504
+ # Add the new root body to the worldbody
505
+ worldbody.append(new_root_body)
506
+ self.tree = ET.ElementTree(root)
507
+
508
+ def save(self, path: str | Path) -> None:
509
+ self.tree.write(path, encoding="utf-8")
@@ -0,0 +1,8 @@
1
+ # requirements.txt
2
+
3
+ # Configuration
4
+ omegaconf
5
+
6
+ # HTTP requests
7
+ httpx
8
+ requests
@@ -0,0 +1 @@
1
+ include . *.obj *.urdf
@@ -0,0 +1,30 @@
1
+ """Defines the top-level KOL CLI."""
2
+
3
+ import argparse
4
+ from typing import Sequence
5
+
6
+ from kscale.store import pybullet, urdf
7
+
8
+
9
+ def main(args: Sequence[str] | None = None) -> None:
10
+ parser = argparse.ArgumentParser(description="K-Scale OnShape Library", add_help=False)
11
+ parser.add_argument(
12
+ "subcommand",
13
+ choices=[
14
+ "urdf",
15
+ "pybullet",
16
+ ],
17
+ help="The subcommand to run",
18
+ )
19
+ parsed_args, remaining_args = parser.parse_known_args(args)
20
+
21
+ match parsed_args.subcommand:
22
+ case "urdf":
23
+ urdf.main(remaining_args)
24
+ case "pybullet":
25
+ pybullet.main(remaining_args)
26
+
27
+
28
+ if __name__ == "__main__":
29
+ # python3 -m kscale.store.cli
30
+ main()
@@ -0,0 +1,178 @@
1
+ """Simple script to interact with a URDF in PyBullet."""
2
+
3
+ import argparse
4
+ import itertools
5
+ import logging
6
+ import math
7
+ import time
8
+ from pathlib import Path
9
+ from typing import Sequence
10
+
11
+ logger = logging.getLogger(__name__)
12
+
13
+
14
+ def main(args: Sequence[str] | None = None) -> None:
15
+ parser = argparse.ArgumentParser(description="Show a URDF in PyBullet")
16
+ parser.add_argument("urdf", nargs="?", help="Path to the URDF file")
17
+ parser.add_argument("--dt", type=float, default=0.01, help="Time step")
18
+ parser.add_argument("-n", "--hide-gui", action="store_true", help="Hide the GUI")
19
+ parser.add_argument("--no-merge", action="store_true", help="Do not merge fixed links")
20
+ parser.add_argument("--hide-origin", action="store_true", help="Do not show the origin")
21
+ parser.add_argument("--show-inertia", action="store_true", help="Visualizes the inertia frames")
22
+ parser.add_argument("--see-thru", action="store_true", help="Use see-through mode")
23
+ parser.add_argument("--show-collision", action="store_true", help="Show collision meshes")
24
+ parsed_args = parser.parse_args(args)
25
+
26
+ try:
27
+ import pybullet as p # type: ignore[import-not-found]
28
+ except ImportError:
29
+ raise ImportError("pybullet is required to run this script")
30
+
31
+ # Connect to PyBullet.
32
+ p.connect(p.GUI)
33
+ p.setGravity(0, 0, -9.81)
34
+ p.setRealTimeSimulation(0)
35
+
36
+ # Turn off panels.
37
+ if parsed_args.hide_gui:
38
+ p.configureDebugVisualizer(p.COV_ENABLE_GUI, 0)
39
+ p.configureDebugVisualizer(p.COV_ENABLE_SEGMENTATION_MARK_PREVIEW, 0)
40
+ p.configureDebugVisualizer(p.COV_ENABLE_DEPTH_BUFFER_PREVIEW, 0)
41
+ p.configureDebugVisualizer(p.COV_ENABLE_RGB_BUFFER_PREVIEW, 0)
42
+
43
+ # Enable mouse picking.
44
+ p.configureDebugVisualizer(p.COV_ENABLE_MOUSE_PICKING, 1)
45
+
46
+ # Loads the floor plane.
47
+ floor = p.loadURDF(str((Path(__file__).parent / "bullet" / "plane.urdf").resolve()))
48
+
49
+ urdf_path = Path("robot" if parsed_args.urdf is None else parsed_args.urdf)
50
+ if urdf_path.is_dir():
51
+ try:
52
+ urdf_path = next(urdf_path.glob("*.urdf"))
53
+ except StopIteration:
54
+ raise FileNotFoundError(f"No URDF files found in {urdf_path}")
55
+
56
+ # Load the robot URDF.
57
+ start_position = [0.0, 0.0, 1.0]
58
+ start_orientation = p.getQuaternionFromEuler([0.0, 0.0, 0.0])
59
+ flags = p.URDF_USE_INERTIA_FROM_FILE
60
+ if not parsed_args.no_merge:
61
+ flags |= p.URDF_MERGE_FIXED_LINKS
62
+ robot = p.loadURDF(str(urdf_path), start_position, start_orientation, flags=flags, useFixedBase=0)
63
+
64
+ # Display collision meshes as separate object.
65
+ if parsed_args.show_collision:
66
+ collision_flags = p.URDF_USE_INERTIA_FROM_FILE | p.URDF_USE_SELF_COLLISION_EXCLUDE_ALL_PARENTS
67
+ collision = p.loadURDF(str(urdf_path), start_position, start_orientation, flags=collision_flags, useFixedBase=0)
68
+
69
+ # Make collision shapes semi-transparent.
70
+ joint_ids = [i for i in range(p.getNumJoints(collision))] + [-1]
71
+ for i in joint_ids:
72
+ p.changeVisualShape(collision, i, rgbaColor=[1, 0, 0, 0.5])
73
+
74
+ # Initializes physics parameters.
75
+ p.changeDynamics(floor, -1, lateralFriction=1, spinningFriction=-1, rollingFriction=-1)
76
+ p.setPhysicsEngineParameter(fixedTimeStep=parsed_args.dt, maxNumCmdPer1ms=1000)
77
+
78
+ # Shows the origin of the robot.
79
+ if not parsed_args.hide_origin:
80
+ p.addUserDebugLine([0, 0, 0], [0.1, 0, 0], [1, 0, 0], parentObjectUniqueId=robot, parentLinkIndex=-1)
81
+ p.addUserDebugLine([0, 0, 0], [0, 0.1, 0], [0, 1, 0], parentObjectUniqueId=robot, parentLinkIndex=-1)
82
+ p.addUserDebugLine([0, 0, 0], [0, 0, 0.1], [0, 0, 1], parentObjectUniqueId=robot, parentLinkIndex=-1)
83
+
84
+ # Make the robot see-through.
85
+ joint_ids = [i for i in range(p.getNumJoints(robot))] + [-1]
86
+ if parsed_args.see_thru:
87
+ for i in joint_ids:
88
+ p.changeVisualShape(robot, i, rgbaColor=[1, 1, 1, 0.5])
89
+
90
+ def draw_box(pt: list[list[float]], color: tuple[float, float, float], obj_id: int, link_id: int) -> None:
91
+ assert len(pt) == 8
92
+ assert all(len(p) == 3 for p in pt)
93
+
94
+ mapping = [1, 3, 0, 2]
95
+ for i in range(4):
96
+ p.addUserDebugLine(pt[i], pt[i + 4], color, 1, parentObjectUniqueId=obj_id, parentLinkIndex=link_id)
97
+ p.addUserDebugLine(pt[i], pt[mapping[i]], color, 1, parentObjectUniqueId=obj_id, parentLinkIndex=link_id)
98
+ p.addUserDebugLine(
99
+ pt[i + 4], pt[mapping[i] + 4], color, 1, parentObjectUniqueId=obj_id, parentLinkIndex=link_id
100
+ )
101
+
102
+ # Shows bounding boxes around each part of the robot representing the inertia frame.
103
+ if parsed_args.show_inertia:
104
+ for i in joint_ids:
105
+ dynamics_info = p.getDynamicsInfo(robot, i)
106
+ mass = dynamics_info[0]
107
+ if mass <= 0:
108
+ continue
109
+ inertia = dynamics_info[2]
110
+ ixx = inertia[0]
111
+ iyy = inertia[1]
112
+ izz = inertia[2]
113
+ box_scale_x = 0.5 * math.sqrt(6 * (izz + iyy - ixx) / mass)
114
+ box_scale_y = 0.5 * math.sqrt(6 * (izz + ixx - iyy) / mass)
115
+ box_scale_z = 0.5 * math.sqrt(6 * (ixx + iyy - izz) / mass)
116
+
117
+ half_extents = [box_scale_x, box_scale_y, box_scale_z]
118
+ pt = [
119
+ [x, y, z]
120
+ for x, y, z in itertools.product(
121
+ [-half_extents[0], half_extents[0]],
122
+ [-half_extents[1], half_extents[1]],
123
+ [-half_extents[2], half_extents[2]],
124
+ )
125
+ ]
126
+ draw_box(pt, (1, 0, 0), robot, i)
127
+
128
+ # Show joint controller.
129
+ joints: dict[str, int] = {}
130
+ controls: dict[str, float] = {}
131
+ for i in range(p.getNumJoints(robot)):
132
+ joint_info = p.getJointInfo(robot, i)
133
+ name = joint_info[1].decode("utf-8")
134
+ joint_type = joint_info[2]
135
+ joints[name] = i
136
+ if joint_type == p.JOINT_PRISMATIC:
137
+ joint_min, joint_max = joint_info[8:10]
138
+ controls[name] = p.addUserDebugParameter(name, joint_min, joint_max, 0.0)
139
+ elif joint_type == p.JOINT_REVOLUTE:
140
+ joint_min, joint_max = joint_info[8:10]
141
+ controls[name] = p.addUserDebugParameter(name, joint_min, joint_max, 0.0)
142
+
143
+ # Run the simulation until the user closes the window.
144
+ last_time = time.time()
145
+ prev_control_values = {k: 0.0 for k in controls}
146
+ while p.isConnected():
147
+ # Reset the simulation if "r" was pressed.
148
+ keys = p.getKeyboardEvents()
149
+ if ord("r") in keys and keys[ord("r")] & p.KEY_WAS_TRIGGERED:
150
+ p.resetBasePositionAndOrientation(robot, start_position, start_orientation)
151
+ p.setJointMotorControlArray(
152
+ robot,
153
+ range(p.getNumJoints(robot)),
154
+ p.POSITION_CONTROL,
155
+ targetPositions=[0] * p.getNumJoints(robot),
156
+ )
157
+
158
+ # Set joint positions.
159
+ for k, v in controls.items():
160
+ try:
161
+ target_position = p.readUserDebugParameter(v)
162
+ if target_position != prev_control_values[k]:
163
+ prev_control_values[k] = target_position
164
+ p.setJointMotorControl2(robot, joints[k], p.POSITION_CONTROL, target_position)
165
+ except p.error:
166
+ logger.debug("Failed to set joint %s", k)
167
+ pass
168
+
169
+ # Step simulation.
170
+ p.stepSimulation()
171
+ cur_time = time.time()
172
+ time.sleep(max(0, parsed_args.dt - (cur_time - last_time)))
173
+ last_time = cur_time
174
+
175
+
176
+ if __name__ == "__main__":
177
+ # python -m kscale.store.pybullet
178
+ main()
@@ -0,0 +1,174 @@
1
+ """Utility functions for managing artifacts in the K-Scale store."""
2
+
3
+ import argparse
4
+ import asyncio
5
+ import logging
6
+ import os
7
+ import sys
8
+ import tarfile
9
+ from pathlib import Path
10
+ from typing import Literal, Sequence
11
+
12
+ import httpx
13
+ import requests
14
+
15
+ from kscale.conf import Settings
16
+ from kscale.store.gen.api import UrdfResponse
17
+
18
+ # Set up logging
19
+ logging.basicConfig(level=logging.INFO)
20
+ logger = logging.getLogger(__name__)
21
+
22
+
23
+ def get_api_key() -> str:
24
+ api_key = Settings.load().store.api_key
25
+ if not api_key:
26
+ raise ValueError(
27
+ "API key not found! Get one here and set it as the `KSCALE_API_KEY` environment variable or in your"
28
+ "config file: https://kscale.store/keys"
29
+ )
30
+ return api_key
31
+
32
+
33
+ def get_cache_dir() -> Path:
34
+ return Path(Settings.load().store.cache_dir).expanduser().resolve()
35
+
36
+
37
+ def fetch_urdf_info(listing_id: str) -> UrdfResponse:
38
+ url = f"https://api.kscale.store/urdf/info/{listing_id}"
39
+ headers = {
40
+ "Authorization": f"Bearer {get_api_key()}",
41
+ }
42
+ response = requests.get(url, headers=headers)
43
+ response.raise_for_status()
44
+ return UrdfResponse(**response.json())
45
+
46
+
47
+ async def download_artifact(artifact_url: str, cache_dir: Path) -> str:
48
+ filename = os.path.join(cache_dir, artifact_url.split("/")[-1])
49
+ headers = {
50
+ "Authorization": f"Bearer {get_api_key()}",
51
+ }
52
+
53
+ if not os.path.exists(filename):
54
+ logger.info("Downloading artifact from %s" % artifact_url)
55
+
56
+ async with httpx.AsyncClient() as client:
57
+ response = await client.get(artifact_url, headers=headers)
58
+ response.raise_for_status()
59
+ with open(filename, "wb") as f:
60
+ for chunk in response.iter_bytes(chunk_size=8192):
61
+ f.write(chunk)
62
+ logger.info("Artifact downloaded to %s" % filename)
63
+ else:
64
+ logger.info("Artifact already cached at %s" % filename)
65
+
66
+ # Extract the .tgz file
67
+ extract_dir = os.path.join(cache_dir, os.path.splitext(os.path.basename(filename))[0])
68
+ if not os.path.exists(extract_dir):
69
+ logger.info(f"Extracting {filename} to {extract_dir}")
70
+ with tarfile.open(filename, "r:gz") as tar:
71
+ tar.extractall(path=extract_dir)
72
+ logger.info("Extraction complete")
73
+ else:
74
+ logger.info("Artifact already extracted at %s" % extract_dir)
75
+
76
+ return extract_dir
77
+
78
+
79
+ def create_tarball(folder_path: str | Path, output_filename: str, cache_dir: Path) -> str:
80
+ tarball_path = os.path.join(cache_dir, output_filename)
81
+ with tarfile.open(tarball_path, "w:gz") as tar:
82
+ for root, _, files in os.walk(folder_path):
83
+ for file in files:
84
+ file_path = os.path.join(root, file)
85
+ arcname = os.path.relpath(file_path, start=folder_path)
86
+ tar.add(file_path, arcname=arcname)
87
+ logger.info("Added %s as %s" % (file_path, arcname))
88
+ logger.info("Created tarball %s" % tarball_path)
89
+ return tarball_path
90
+
91
+
92
+ async def upload_artifact(tarball_path: str, listing_id: str) -> None:
93
+ url = f"https://api.kscale.store/urdf/upload/{listing_id}"
94
+ headers = {
95
+ "Authorization": f"Bearer {get_api_key()}",
96
+ }
97
+
98
+ async with httpx.AsyncClient() as client:
99
+ with open(tarball_path, "rb") as f:
100
+ files = {"file": (f.name, f, "application/gzip")}
101
+ response = await client.post(url, headers=headers, files=files)
102
+
103
+ response.raise_for_status()
104
+
105
+ logger.info("Uploaded artifact to %s" % url)
106
+
107
+
108
+ def main(args: Sequence[str] | None = None) -> None:
109
+ parser = argparse.ArgumentParser(description="K-Scale URDF Store", add_help=False)
110
+ parser.add_argument(
111
+ "command",
112
+ choices=["get", "info", "upload"],
113
+ help="The command to run",
114
+ )
115
+ parser.add_argument("listing_id", help="The listing ID to operate on")
116
+ parsed_args, remaining_args = parser.parse_known_args(args)
117
+
118
+ command: Literal["get", "info", "upload"] = parsed_args.command
119
+ listing_id: str = parsed_args.listing_id
120
+
121
+ def get_listing_dir() -> Path:
122
+ (cache_dir := get_cache_dir() / listing_id).mkdir(parents=True, exist_ok=True)
123
+ return cache_dir
124
+
125
+ match command:
126
+ case "get":
127
+ try:
128
+ urdf_info = fetch_urdf_info(listing_id)
129
+
130
+ if urdf_info.urdf:
131
+ artifact_url = urdf_info.urdf.url
132
+ asyncio.run(download_artifact(artifact_url, get_listing_dir()))
133
+ else:
134
+ logger.info("No URDF found for listing %s" % listing_id)
135
+ except requests.RequestException as e:
136
+ logger.error("Failed to fetch URDF info: %s" % e)
137
+ sys.exit(1)
138
+
139
+ case "info":
140
+ try:
141
+ urdf_info = fetch_urdf_info(listing_id)
142
+
143
+ if urdf_info.urdf:
144
+ logger.info("URDF Artifact ID: %s" % urdf_info.urdf.artifact_id)
145
+ logger.info("URDF URL: %s" % urdf_info.urdf.url)
146
+ else:
147
+ logger.info("No URDF found for listing %s" % listing_id)
148
+ except requests.RequestException as e:
149
+ logger.error("Failed to fetch URDF info: %s" % e)
150
+ sys.exit(1)
151
+
152
+ case "upload":
153
+ parser = argparse.ArgumentParser(description="Upload a URDF artifact to the K-Scale store")
154
+ parser.add_argument("folder_path", help="The path to the folder containing the URDF files")
155
+ parsed_args = parser.parse_args(remaining_args)
156
+ folder_path = Path(parsed_args.folder_path).expanduser().resolve()
157
+
158
+ output_filename = f"{listing_id}.tgz"
159
+ tarball_path = create_tarball(folder_path, output_filename, get_listing_dir())
160
+
161
+ try:
162
+ urdf_info = fetch_urdf_info(listing_id)
163
+ asyncio.run(upload_artifact(tarball_path, listing_id))
164
+ except requests.RequestException as e:
165
+ logger.error("Failed to upload artifact: %s" % e)
166
+ sys.exit(1)
167
+
168
+ case _:
169
+ logger.error("Invalid command")
170
+ sys.exit(1)
171
+
172
+
173
+ if __name__ == "__main__":
174
+ main()
@@ -0,0 +1,52 @@
1
+ Metadata-Version: 2.1
2
+ Name: kscale
3
+ Version: 0.0.2
4
+ Summary: The kscale project
5
+ Home-page: https://github.com/kscalelabs/kscale
6
+ Author: Benjamin Bolte
7
+ Requires-Python: >=3.11
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Requires-Dist: omegaconf
11
+ Requires-Dist: httpx
12
+ Requires-Dist: requests
13
+ Provides-Extra: dev
14
+ Requires-Dist: black; extra == "dev"
15
+ Requires-Dist: darglint; extra == "dev"
16
+ Requires-Dist: mypy; extra == "dev"
17
+ Requires-Dist: pytest; extra == "dev"
18
+ Requires-Dist: ruff; extra == "dev"
19
+ Requires-Dist: datamodel-code-generator; extra == "dev"
20
+
21
+ <p align="center">
22
+ <picture>
23
+ <img alt="K-Scale Open Source Robotics" src="https://media.kscale.dev/kscale-open-source-header.png" style="max-width: 100%;">
24
+ </picture>
25
+ </p>
26
+
27
+ <div align="center">
28
+
29
+ [![License](https://img.shields.io/badge/license-MIT-green)](https://github.com/kscalelabs/ksim/blob/main/LICENSE)
30
+ [![Discord](https://img.shields.io/discord/1224056091017478166)](https://discord.gg/k5mSvCkYQh)
31
+ [![Wiki](https://img.shields.io/badge/wiki-humanoids-black)](https://humanoids.wiki)
32
+ <br />
33
+ [![python](https://img.shields.io/badge/-Python_3.11-blue?logo=python&logoColor=white)](https://github.com/pre-commit/pre-commit)
34
+ [![black](https://img.shields.io/badge/Code%20Style-Black-black.svg?labelColor=gray)](https://black.readthedocs.io/en/stable/)
35
+ [![ruff](https://img.shields.io/badge/Linter-Ruff-red.svg?labelColor=gray)](https://github.com/charliermarsh/ruff)
36
+ <br />
37
+ [![Python Checks](https://github.com/kscalelabs/kscale/actions/workflows/test.yml/badge.svg)](https://github.com/kscalelabs/kscale/actions/workflows/test.yml)
38
+ [![Publish Python Package](https://github.com/kscalelabs/kscale/actions/workflows/publish.yml/badge.svg)](https://github.com/kscalelabs/kscale/actions/workflows/publish.yml)
39
+
40
+ </div>
41
+
42
+ # K-Scale Command Line Interface
43
+
44
+ This is a command line tool for interacting with various services provided by K-Scale Labs, such as:
45
+
46
+ - [K-Scale Store](https://kscale.store/)
47
+
48
+ ## Installation
49
+
50
+ ```bash
51
+ pip install kscale
52
+ ```
@@ -12,11 +12,15 @@ kscale/requirements.txt
12
12
  kscale.egg-info/PKG-INFO
13
13
  kscale.egg-info/SOURCES.txt
14
14
  kscale.egg-info/dependency_links.txt
15
+ kscale.egg-info/entry_points.txt
15
16
  kscale.egg-info/requires.txt
16
17
  kscale.egg-info/top_level.txt
18
+ kscale/formats/mjcf.py
17
19
  kscale/store/__init__.py
18
- kscale/store/auth.py
20
+ kscale/store/cli.py
21
+ kscale/store/pybullet.py
19
22
  kscale/store/urdf.py
23
+ kscale/store/bullet/MANIFEST.in
20
24
  kscale/store/gen/__init__.py
21
25
  kscale/store/gen/api.py
22
26
  tests/test_dummy.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ kscale = kscale.store.cli:main
@@ -1,4 +1,6 @@
1
1
  omegaconf
2
+ httpx
3
+ requests
2
4
 
3
5
  [dev]
4
6
  black
@@ -5,6 +5,10 @@ packages = find:
5
5
  exclude =
6
6
  tests
7
7
 
8
+ [options.entry_points]
9
+ console_scripts =
10
+ kscale = kscale.store.cli:main
11
+
8
12
  [egg_info]
9
13
  tag_build =
10
14
  tag_date = 0
@@ -1,4 +1,4 @@
1
- # mypy: disable-error-code="import-untyped"
1
+ # mypy: disable-error-code="import-untyped, import-not-found"
2
2
  #!/usr/bin/env python
3
3
  """Setup script for the project."""
4
4
 
kscale-0.0.1/PKG-INFO DELETED
@@ -1,29 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: kscale
3
- Version: 0.0.1
4
- Summary: The kscale project
5
- Home-page: https://github.com/kscalelabs/kscale
6
- Author: Benjamin Bolte
7
- Requires-Python: >=3.11
8
- Description-Content-Type: text/markdown
9
- License-File: LICENSE
10
- Requires-Dist: omegaconf
11
- Provides-Extra: dev
12
- Requires-Dist: black; extra == "dev"
13
- Requires-Dist: darglint; extra == "dev"
14
- Requires-Dist: mypy; extra == "dev"
15
- Requires-Dist: pytest; extra == "dev"
16
- Requires-Dist: ruff; extra == "dev"
17
- Requires-Dist: datamodel-code-generator; extra == "dev"
18
-
19
- # K-Scale Command Line Interface
20
-
21
- This is a command line tool for interacting with various services provided by K-Scale Labs, such as:
22
-
23
- - [K-Scale Store](https://kscale.store/)
24
-
25
- ## Installation
26
-
27
- ```bash
28
- pip install kscale
29
- ```
kscale-0.0.1/README.md DELETED
@@ -1,11 +0,0 @@
1
- # K-Scale Command Line Interface
2
-
3
- This is a command line tool for interacting with various services provided by K-Scale Labs, such as:
4
-
5
- - [K-Scale Store](https://kscale.store/)
6
-
7
- ## Installation
8
-
9
- ```bash
10
- pip install kscale
11
- ```
@@ -1,3 +0,0 @@
1
- # requirements.txt
2
-
3
- omegaconf
@@ -1,13 +0,0 @@
1
- """Defines utility functions for authenticating the K-Scale Store API."""
2
-
3
- from kscale.conf import Settings
4
-
5
-
6
- def get_api_key() -> str:
7
- try:
8
- return Settings.load().store.api_key
9
- except AttributeError:
10
- raise ValueError(
11
- "API key not found! Get one here and set it as the `KSCALE_API_KEY` "
12
- "environment variable: https://kscale.store/keys"
13
- )
File without changes
@@ -1 +0,0 @@
1
- """Utility functions for managing artifacts in the K-Scale store."""
@@ -1,29 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: kscale
3
- Version: 0.0.1
4
- Summary: The kscale project
5
- Home-page: https://github.com/kscalelabs/kscale
6
- Author: Benjamin Bolte
7
- Requires-Python: >=3.11
8
- Description-Content-Type: text/markdown
9
- License-File: LICENSE
10
- Requires-Dist: omegaconf
11
- Provides-Extra: dev
12
- Requires-Dist: black; extra == "dev"
13
- Requires-Dist: darglint; extra == "dev"
14
- Requires-Dist: mypy; extra == "dev"
15
- Requires-Dist: pytest; extra == "dev"
16
- Requires-Dist: ruff; extra == "dev"
17
- Requires-Dist: datamodel-code-generator; extra == "dev"
18
-
19
- # K-Scale Command Line Interface
20
-
21
- This is a command line tool for interacting with various services provided by K-Scale Labs, such as:
22
-
23
- - [K-Scale Store](https://kscale.store/)
24
-
25
- ## Installation
26
-
27
- ```bash
28
- pip install kscale
29
- ```
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes