newlithic 0.1.0__tar.gz
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.
- newlithic-0.1.0/LICENSE +202 -0
- newlithic-0.1.0/PKG-INFO +80 -0
- newlithic-0.1.0/README.md +60 -0
- newlithic-0.1.0/pyproject.toml +33 -0
- newlithic-0.1.0/setup.cfg +4 -0
- newlithic-0.1.0/src/newlithic/__init__.py +127 -0
- newlithic-0.1.0/src/newlithic/__main__.py +5 -0
- newlithic-0.1.0/src/newlithic/cli.py +135 -0
- newlithic-0.1.0/src/newlithic.egg-info/PKG-INFO +80 -0
- newlithic-0.1.0/src/newlithic.egg-info/SOURCES.txt +13 -0
- newlithic-0.1.0/src/newlithic.egg-info/dependency_links.txt +1 -0
- newlithic-0.1.0/src/newlithic.egg-info/entry_points.txt +2 -0
- newlithic-0.1.0/src/newlithic.egg-info/requires.txt +3 -0
- newlithic-0.1.0/src/newlithic.egg-info/top_level.txt +1 -0
- newlithic-0.1.0/tests/test_sandbox.py +82 -0
newlithic-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
newlithic-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: newlithic
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: SDK and CLI for Newlithic Robotics: book a call, request free robot demonstration data for a task, and get the bimanual sample dataset. No API key; sandbox included.
|
|
5
|
+
Author-email: Newlithic Robotics <build@newlithicrobotics.com>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://newlithicrobotics.com
|
|
8
|
+
Project-URL: Documentation, https://newlithicrobotics.com/docs
|
|
9
|
+
Keywords: newlithic,robotics,robot learning,demonstration data,bimanual,lerobot,imitation learning,sdk,cli
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
15
|
+
Requires-Python: >=3.9
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Requires-Dist: tzdata; sys_platform == "win32"
|
|
19
|
+
Dynamic: license-file
|
|
20
|
+
|
|
21
|
+
# newlithic
|
|
22
|
+
|
|
23
|
+
SDK and command-line tool for [Newlithic Robotics](https://newlithicrobotics.com). Newlithic collects task-specific robot demonstration data with wearable grippers, and delivers it in LeRobot format.
|
|
24
|
+
|
|
25
|
+
With this package you can:
|
|
26
|
+
|
|
27
|
+
- list open call times and book a 30-minute call;
|
|
28
|
+
- send a task card to get free demos (up to 500 demonstrations of your task within 5 business days);
|
|
29
|
+
- get the free bimanual sample dataset.
|
|
30
|
+
|
|
31
|
+
There is no API key and no sign-up. A sandbox runs every check without booking or sending anything.
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
pip install newlithic
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Command line
|
|
38
|
+
|
|
39
|
+
```sh
|
|
40
|
+
newlithic slots --limit 5
|
|
41
|
+
newlithic book --start 2026-12-08T17:00:00.000Z --name "Ada Lovelace" --email ada@example.com --org "Example Lab" --sandbox
|
|
42
|
+
newlithic task-card --email ada@example.com --task "Fold a T-shirt with two hands" --robot "Two arms with parallel grippers" --sandbox
|
|
43
|
+
newlithic dataset
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
`python -m newlithic` works too. Run `newlithic --help` for every option.
|
|
47
|
+
|
|
48
|
+
When `book` and `task-card` run in a terminal, they ask before sending. In scripts they need `--yes`. Add `--sandbox` or `--dry-run` to test.
|
|
49
|
+
|
|
50
|
+
## SDK
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
from newlithic import Newlithic
|
|
54
|
+
|
|
55
|
+
nl = Newlithic() # or Newlithic(sandbox=True)
|
|
56
|
+
slots = nl.list_slots(after="2026-12-08", limit=5)["slots"]
|
|
57
|
+
booking = nl.book_call(slots[0], "Ada Lovelace", "ada@example.com", organization="Example Lab")
|
|
58
|
+
nl.send_task_card("ada@example.com", "Fold a T-shirt with two hands")
|
|
59
|
+
print(nl.dataset()["url"])
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Errors raise `NewlithicError`, with `.status` set:
|
|
63
|
+
|
|
64
|
+
- **409**: the slot was taken. List the slots again and pick another.
|
|
65
|
+
- **422**: a required field is missing.
|
|
66
|
+
|
|
67
|
+
Requires Python 3.9 or later. The package uses only the standard library, plus `tzdata` on Windows.
|
|
68
|
+
|
|
69
|
+
Book a call or send a task card only with the consent of the person named. Each one emails them and the Newlithic team.
|
|
70
|
+
|
|
71
|
+
## Other ways in
|
|
72
|
+
|
|
73
|
+
- **MCP server**: `https://newlithicrobotics.com/mcp`
|
|
74
|
+
- **REST API**: [OpenAPI](https://newlithicrobotics.com/openapi.json)
|
|
75
|
+
- **Sandbox**: `https://newlithicrobotics.com/sandbox`
|
|
76
|
+
- **Docs**: https://newlithicrobotics.com/docs
|
|
77
|
+
|
|
78
|
+
## License
|
|
79
|
+
|
|
80
|
+
Apache-2.0
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# newlithic
|
|
2
|
+
|
|
3
|
+
SDK and command-line tool for [Newlithic Robotics](https://newlithicrobotics.com). Newlithic collects task-specific robot demonstration data with wearable grippers, and delivers it in LeRobot format.
|
|
4
|
+
|
|
5
|
+
With this package you can:
|
|
6
|
+
|
|
7
|
+
- list open call times and book a 30-minute call;
|
|
8
|
+
- send a task card to get free demos (up to 500 demonstrations of your task within 5 business days);
|
|
9
|
+
- get the free bimanual sample dataset.
|
|
10
|
+
|
|
11
|
+
There is no API key and no sign-up. A sandbox runs every check without booking or sending anything.
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
pip install newlithic
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Command line
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
newlithic slots --limit 5
|
|
21
|
+
newlithic book --start 2026-12-08T17:00:00.000Z --name "Ada Lovelace" --email ada@example.com --org "Example Lab" --sandbox
|
|
22
|
+
newlithic task-card --email ada@example.com --task "Fold a T-shirt with two hands" --robot "Two arms with parallel grippers" --sandbox
|
|
23
|
+
newlithic dataset
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
`python -m newlithic` works too. Run `newlithic --help` for every option.
|
|
27
|
+
|
|
28
|
+
When `book` and `task-card` run in a terminal, they ask before sending. In scripts they need `--yes`. Add `--sandbox` or `--dry-run` to test.
|
|
29
|
+
|
|
30
|
+
## SDK
|
|
31
|
+
|
|
32
|
+
```python
|
|
33
|
+
from newlithic import Newlithic
|
|
34
|
+
|
|
35
|
+
nl = Newlithic() # or Newlithic(sandbox=True)
|
|
36
|
+
slots = nl.list_slots(after="2026-12-08", limit=5)["slots"]
|
|
37
|
+
booking = nl.book_call(slots[0], "Ada Lovelace", "ada@example.com", organization="Example Lab")
|
|
38
|
+
nl.send_task_card("ada@example.com", "Fold a T-shirt with two hands")
|
|
39
|
+
print(nl.dataset()["url"])
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Errors raise `NewlithicError`, with `.status` set:
|
|
43
|
+
|
|
44
|
+
- **409**: the slot was taken. List the slots again and pick another.
|
|
45
|
+
- **422**: a required field is missing.
|
|
46
|
+
|
|
47
|
+
Requires Python 3.9 or later. The package uses only the standard library, plus `tzdata` on Windows.
|
|
48
|
+
|
|
49
|
+
Book a call or send a task card only with the consent of the person named. Each one emails them and the Newlithic team.
|
|
50
|
+
|
|
51
|
+
## Other ways in
|
|
52
|
+
|
|
53
|
+
- **MCP server**: `https://newlithicrobotics.com/mcp`
|
|
54
|
+
- **REST API**: [OpenAPI](https://newlithicrobotics.com/openapi.json)
|
|
55
|
+
- **Sandbox**: `https://newlithicrobotics.com/sandbox`
|
|
56
|
+
- **Docs**: https://newlithicrobotics.com/docs
|
|
57
|
+
|
|
58
|
+
## License
|
|
59
|
+
|
|
60
|
+
Apache-2.0
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=69"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "newlithic"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "SDK and CLI for Newlithic Robotics: book a call, request free robot demonstration data for a task, and get the bimanual sample dataset. No API key; sandbox included."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = "Apache-2.0"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
authors = [{ name = "Newlithic Robotics", email = "build@newlithicrobotics.com" }]
|
|
14
|
+
keywords = ["newlithic", "robotics", "robot learning", "demonstration data", "bimanual", "lerobot", "imitation learning", "sdk", "cli"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"Operating System :: OS Independent",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"Intended Audience :: Science/Research",
|
|
20
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
21
|
+
]
|
|
22
|
+
# Windows has no system time-zone database; zoneinfo needs tzdata there
|
|
23
|
+
dependencies = ['tzdata; sys_platform == "win32"']
|
|
24
|
+
|
|
25
|
+
[project.urls]
|
|
26
|
+
Homepage = "https://newlithicrobotics.com"
|
|
27
|
+
Documentation = "https://newlithicrobotics.com/docs"
|
|
28
|
+
|
|
29
|
+
[project.scripts]
|
|
30
|
+
newlithic = "newlithic.cli:main"
|
|
31
|
+
|
|
32
|
+
[tool.setuptools.packages.find]
|
|
33
|
+
where = ["src"]
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"""Newlithic Robotics SDK: list open call slots, book a call, request free task demos, and read about the sample
|
|
2
|
+
dataset, through the public API at https://newlithicrobotics.com (no API key). Standard library only.
|
|
3
|
+
|
|
4
|
+
Sandbox: ``Newlithic(sandbox=True)`` sends everything to https://newlithicrobotics.com/sandbox, where every action runs
|
|
5
|
+
all checks and answers normally but books, stores and emails nothing.
|
|
6
|
+
"""
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
import json
|
|
10
|
+
import urllib.error
|
|
11
|
+
import urllib.parse
|
|
12
|
+
import urllib.request
|
|
13
|
+
from datetime import datetime
|
|
14
|
+
from typing import Any, Dict, List, Optional, Union
|
|
15
|
+
|
|
16
|
+
__version__ = "0.1.0"
|
|
17
|
+
__all__ = ["Newlithic", "NewlithicError", "DATASET", "PRODUCTION_URL", "SANDBOX_URL", "__version__"]
|
|
18
|
+
|
|
19
|
+
PRODUCTION_URL = "https://newlithicrobotics.com"
|
|
20
|
+
SANDBOX_URL = "https://newlithicrobotics.com/sandbox"
|
|
21
|
+
|
|
22
|
+
DATASET: Dict[str, Any] = {
|
|
23
|
+
"id": "Newlithic/bimanual-ee-pose",
|
|
24
|
+
"url": "https://huggingface.co/datasets/Newlithic/bimanual-ee-pose",
|
|
25
|
+
"task": "Unscrew the M5 nut from the bolt held by the other hand",
|
|
26
|
+
"episodes": 50,
|
|
27
|
+
"frames": 32567,
|
|
28
|
+
"fps": 30,
|
|
29
|
+
"format": "LeRobot v3.0 (parquet + AV1 MP4)",
|
|
30
|
+
"license": "Apache-2.0",
|
|
31
|
+
"size_mb": 877,
|
|
32
|
+
"gated": "Sign in to Hugging Face and accept the terms on the dataset page; access is granted at once.",
|
|
33
|
+
"state": [f"{h}_{k}" for h in ("left", "right") for k in ("x", "y", "z", "r1x", "r1y", "r1z", "r2x", "r2y", "r2z", "gap")],
|
|
34
|
+
"frame": "left dock: origin at the docked left grip on the table plane, x along its heading, z up",
|
|
35
|
+
"download": "hf download Newlithic/bimanual-ee-pose --repo-type dataset --local-dir bimanual-ee-pose",
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class NewlithicError(Exception):
|
|
40
|
+
"""An error answer from the API. ``status`` is the HTTP status (409: slot taken, 422: a required field missing)."""
|
|
41
|
+
|
|
42
|
+
def __init__(self, message: str, status: int = 0, body: Any = None):
|
|
43
|
+
super().__init__(message)
|
|
44
|
+
self.status = status
|
|
45
|
+
self.body = body
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class Newlithic:
|
|
49
|
+
def __init__(self, base_url: Optional[str] = None, sandbox: bool = False, timeout: float = 30.0,
|
|
50
|
+
user_agent: Optional[str] = None):
|
|
51
|
+
self.sandbox = bool(sandbox)
|
|
52
|
+
self.base_url = (base_url or (SANDBOX_URL if self.sandbox else PRODUCTION_URL)).rstrip("/")
|
|
53
|
+
self.timeout = timeout
|
|
54
|
+
self.user_agent = user_agent or f"newlithic-python/{__version__}"
|
|
55
|
+
|
|
56
|
+
def _request(self, method: str, path: str, body: Optional[dict] = None) -> Dict[str, Any]:
|
|
57
|
+
data = json.dumps(body).encode("utf-8") if body is not None else None
|
|
58
|
+
headers = {"Accept": "application/json", "User-Agent": self.user_agent}
|
|
59
|
+
if data is not None:
|
|
60
|
+
headers["Content-Type"] = "application/json"
|
|
61
|
+
req = urllib.request.Request(self.base_url + path, data=data, method=method, headers=headers)
|
|
62
|
+
try:
|
|
63
|
+
with urllib.request.urlopen(req, timeout=self.timeout) as res:
|
|
64
|
+
status, text = res.status, res.read().decode("utf-8")
|
|
65
|
+
except urllib.error.HTTPError as e:
|
|
66
|
+
status, text = e.code, e.read().decode("utf-8", "replace")
|
|
67
|
+
try:
|
|
68
|
+
payload = json.loads(text) if text else {}
|
|
69
|
+
except ValueError:
|
|
70
|
+
payload = {"error": text}
|
|
71
|
+
if status >= 400 or payload.get("ok") is False or payload.get("error"):
|
|
72
|
+
raise NewlithicError(payload.get("error") or f"HTTP {status}", status, payload)
|
|
73
|
+
return payload
|
|
74
|
+
|
|
75
|
+
def list_slots(self, after: Union[str, datetime, None] = None, limit: Optional[int] = None) -> Dict[str, Any]:
|
|
76
|
+
"""Open 30-minute call slots (Mon-Fri 9:00-17:00 Pacific, 12 hours to 3 weeks ahead) as UTC ISO start times.
|
|
77
|
+
|
|
78
|
+
Returns ``{"tz", "slotMinutes", "slots": [...]}`` (plus ``"sandbox": True`` in the sandbox).
|
|
79
|
+
"""
|
|
80
|
+
q = {}
|
|
81
|
+
if after is not None:
|
|
82
|
+
q["after"] = after.isoformat() if isinstance(after, datetime) else str(after)
|
|
83
|
+
if limit:
|
|
84
|
+
q["limit"] = str(int(limit))
|
|
85
|
+
data = self._request("GET", "/api/book" + ("?" + urllib.parse.urlencode(q) if q else ""))
|
|
86
|
+
out = {"tz": data.get("tz"), "slotMinutes": data.get("slotMinutes"), "slots": data.get("slots") or []}
|
|
87
|
+
if data.get("sandbox"):
|
|
88
|
+
out["sandbox"] = True
|
|
89
|
+
return out
|
|
90
|
+
|
|
91
|
+
def book_call(self, start: str, name: str, email: str, organization: Optional[str] = None,
|
|
92
|
+
notes: Optional[str] = None, tz: Optional[str] = None, dry_run: bool = False) -> Dict[str, Any]:
|
|
93
|
+
"""Book one slot (``start`` exactly as listed). Emails a calendar invite to ``email`` and to the Newlithic team.
|
|
94
|
+
|
|
95
|
+
Use only with that person's consent. ``dry_run=True`` runs every check without booking.
|
|
96
|
+
"""
|
|
97
|
+
if not (start and name and email):
|
|
98
|
+
raise ValueError("start, name and email are required")
|
|
99
|
+
body = {"start": start, "name": name, "email": email, "organization": organization, "notes": notes, "tz": tz}
|
|
100
|
+
body = {k: v for k, v in body.items() if v}
|
|
101
|
+
if dry_run:
|
|
102
|
+
body["dryRun"] = True
|
|
103
|
+
return self._request("POST", "/api/book", body)
|
|
104
|
+
|
|
105
|
+
def send_task_card(self, email: str, task: str, name: Optional[str] = None, objects: Optional[str] = None,
|
|
106
|
+
success: Optional[str] = None, robot: Optional[str] = None, organization: Optional[str] = None,
|
|
107
|
+
dry_run: bool = False) -> Dict[str, Any]:
|
|
108
|
+
"""Request free demos: up to 500 demonstrations of the task within 5 business days. Use only with consent."""
|
|
109
|
+
if not (email and task):
|
|
110
|
+
raise ValueError("email and task are required")
|
|
111
|
+
body = {"email": email, "task": task, "name": name, "objects": objects, "success": success, "robot": robot,
|
|
112
|
+
"organization": organization}
|
|
113
|
+
body = {k: v for k, v in body.items() if v}
|
|
114
|
+
if dry_run:
|
|
115
|
+
body["dryRun"] = True
|
|
116
|
+
return self._request("POST", "/api/task-card", body)
|
|
117
|
+
|
|
118
|
+
def overview(self) -> str:
|
|
119
|
+
"""What Newlithic does and how agents should act for a user (llms.txt, Markdown)."""
|
|
120
|
+
req = urllib.request.Request(PRODUCTION_URL + "/llms.txt", headers={"User-Agent": self.user_agent})
|
|
121
|
+
with urllib.request.urlopen(req, timeout=self.timeout) as res:
|
|
122
|
+
return res.read().decode("utf-8")
|
|
123
|
+
|
|
124
|
+
@staticmethod
|
|
125
|
+
def dataset() -> Dict[str, Any]:
|
|
126
|
+
"""Facts about the free sample dataset on Hugging Face."""
|
|
127
|
+
return dict(DATASET)
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"""newlithic: command-line client for Newlithic Robotics' public API. No API key."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import argparse
|
|
5
|
+
import json
|
|
6
|
+
import sys
|
|
7
|
+
from datetime import datetime
|
|
8
|
+
from zoneinfo import ZoneInfo
|
|
9
|
+
|
|
10
|
+
from . import Newlithic, NewlithicError, __version__
|
|
11
|
+
|
|
12
|
+
PACIFIC = ZoneInfo("America/Los_Angeles")
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _pt(iso: str) -> str:
|
|
16
|
+
t = datetime.fromisoformat(iso.replace("Z", "+00:00")).astimezone(PACIFIC)
|
|
17
|
+
return t.strftime("%a, %b %d, %I:%M %p ") + t.tzname()
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def _local(iso: str) -> str:
|
|
21
|
+
t = datetime.fromisoformat(iso.replace("Z", "+00:00")).astimezone()
|
|
22
|
+
off = t.strftime("%z") # tzname() on Windows is a long name such as "US Mountain Standard Time"
|
|
23
|
+
return t.strftime("%a, %b %d, %I:%M %p ") + (f"UTC{off[:3]}:{off[3:]}" if off else "")
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class _Usage(Exception):
|
|
27
|
+
pass
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def _confirm(args, what: str) -> None:
|
|
31
|
+
if args.yes or args.sandbox or args.dry_run:
|
|
32
|
+
return
|
|
33
|
+
refuse = _Usage(f"{what} for real needs --yes (or use --sandbox / --dry-run to test)")
|
|
34
|
+
if not sys.stdin.isatty():
|
|
35
|
+
raise refuse
|
|
36
|
+
try:
|
|
37
|
+
answer = input(f"{what}? [y/N] ")
|
|
38
|
+
except EOFError: # e.g. stdin is NUL on Windows, which reports itself as a terminal
|
|
39
|
+
print(file=sys.stderr)
|
|
40
|
+
raise refuse
|
|
41
|
+
if answer.strip().lower() not in ("y", "yes"):
|
|
42
|
+
raise _Usage("Cancelled.")
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def _common(suppress: bool) -> argparse.ArgumentParser:
|
|
46
|
+
# The same options before or after the command. On subcommands the defaults are SUPPRESS, so
|
|
47
|
+
# "newlithic --sandbox slots" is not overwritten by the subcommand's own default.
|
|
48
|
+
d = {"default": argparse.SUPPRESS} if suppress else {}
|
|
49
|
+
c = argparse.ArgumentParser(add_help=False)
|
|
50
|
+
c.add_argument("--sandbox", action="store_true", help="use https://newlithicrobotics.com/sandbox: every check runs, nothing is booked or sent", **d)
|
|
51
|
+
c.add_argument("--dry-run", action="store_true", help="same for one command on production", **d)
|
|
52
|
+
c.add_argument("--json", action="store_true", help="print JSON", **d)
|
|
53
|
+
c.add_argument("--base-url", help="another server", **d)
|
|
54
|
+
return c
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def _parser() -> argparse.ArgumentParser:
|
|
58
|
+
common = _common(suppress=True)
|
|
59
|
+
p = argparse.ArgumentParser(prog="newlithic", parents=[_common(suppress=False)],
|
|
60
|
+
description="Newlithic Robotics from the command line (no API key).",
|
|
61
|
+
epilog="Book or send only with the consent of the person named. Docs: https://newlithicrobotics.com/docs")
|
|
62
|
+
p.add_argument("-v", "--version", action="version", version=__version__)
|
|
63
|
+
sub = p.add_subparsers(dest="cmd", metavar="command")
|
|
64
|
+
s = sub.add_parser("slots", parents=[common], help="open 30-minute call slots")
|
|
65
|
+
s.add_argument("--after", help="only slots at or after this ISO date or date-time")
|
|
66
|
+
s.add_argument("--limit", type=int, default=20)
|
|
67
|
+
b = sub.add_parser("book", parents=[common], help="book a call (emails a calendar invite)")
|
|
68
|
+
b.add_argument("--start", required=True, help="a UTC start time exactly as listed by slots")
|
|
69
|
+
b.add_argument("--name", required=True)
|
|
70
|
+
b.add_argument("--email", required=True)
|
|
71
|
+
b.add_argument("--org")
|
|
72
|
+
b.add_argument("--notes")
|
|
73
|
+
b.add_argument("--tz", help="your IANA time zone, e.g. Europe/Berlin")
|
|
74
|
+
b.add_argument("--yes", action="store_true", help="book without asking (needed when not run in a terminal)")
|
|
75
|
+
t = sub.add_parser("task-card", parents=[common], help="request free task demos")
|
|
76
|
+
t.add_argument("--email", required=True)
|
|
77
|
+
t.add_argument("--task", required=True)
|
|
78
|
+
for k in ("name", "objects", "success", "robot", "org"):
|
|
79
|
+
t.add_argument("--" + k)
|
|
80
|
+
t.add_argument("--yes", action="store_true", help="send without asking (needed when not run in a terminal)")
|
|
81
|
+
sub.add_parser("dataset", parents=[common], help="the free sample dataset")
|
|
82
|
+
sub.add_parser("overview", parents=[common], help="what Newlithic does (llms.txt)")
|
|
83
|
+
return p
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def main(argv=None) -> int:
|
|
87
|
+
p = _parser()
|
|
88
|
+
args = p.parse_args(argv)
|
|
89
|
+
if not args.cmd:
|
|
90
|
+
p.print_help()
|
|
91
|
+
return 0
|
|
92
|
+
client = Newlithic(base_url=args.base_url, sandbox=args.sandbox)
|
|
93
|
+
out = lambda o: print(o if isinstance(o, str) else json.dumps(o, indent=2))
|
|
94
|
+
try:
|
|
95
|
+
if args.cmd == "slots":
|
|
96
|
+
r = client.list_slots(after=args.after, limit=args.limit)
|
|
97
|
+
if args.json:
|
|
98
|
+
return out(r) or 0
|
|
99
|
+
if not r["slots"]:
|
|
100
|
+
return out("No open call times match. Email build@newlithicrobotics.com instead.") or 0
|
|
101
|
+
tag = " (sandbox)" if r.get("sandbox") else ""
|
|
102
|
+
out("\n".join([f"Open 30-minute slots{tag} (UTC start | Pacific | your time):"]
|
|
103
|
+
+ [f" {s} {_pt(s)} | {_local(s)}" for s in r["slots"]]))
|
|
104
|
+
elif args.cmd == "book":
|
|
105
|
+
_confirm(args, f"Book {_pt(args.start)} for {args.name} <{args.email}>")
|
|
106
|
+
r = client.book_call(args.start, args.name, args.email, organization=args.org, notes=args.notes,
|
|
107
|
+
tz=args.tz, dry_run=args.dry_run)
|
|
108
|
+
out(r if args.json else (
|
|
109
|
+
f"Sandbox: {_pt(r['start'])} is open and the details are valid. Nothing was booked and no email was sent."
|
|
110
|
+
if r.get("sandbox") else f"Booked: {_pt(r['start'])} (30 minutes). A calendar invite is on its way to {args.email}."))
|
|
111
|
+
elif args.cmd == "task-card":
|
|
112
|
+
_confirm(args, f"Send the task card to Newlithic Robotics from {args.email}")
|
|
113
|
+
r = client.send_task_card(args.email, args.task, name=args.name, objects=args.objects, success=args.success,
|
|
114
|
+
robot=args.robot, organization=args.org, dry_run=args.dry_run)
|
|
115
|
+
out(r if args.json else ("Sandbox: the task card is valid. Nothing was stored or sent." if r.get("sandbox") else
|
|
116
|
+
f"Sent. Newlithic will reply to {args.email}; it records up to 500 demonstrations of the task within 5 business days."))
|
|
117
|
+
elif args.cmd == "dataset":
|
|
118
|
+
d = client.dataset()
|
|
119
|
+
out(d if args.json else "\n".join([
|
|
120
|
+
f"{d['id']}: {d['url']}",
|
|
121
|
+
f"{d['episodes']} demonstrations of \"{d['task']}\", {d['frames']} frames at {d['fps']} fps, {d['format']}, about {d['size_mb']} MB, {d['license']}.",
|
|
122
|
+
f"State per frame (20 floats): {', '.join(d['state'])}", f"Frame: {d['frame']}", f"Access: {d['gated']}", f"Download: {d['download']}"]))
|
|
123
|
+
elif args.cmd == "overview":
|
|
124
|
+
out(client.overview())
|
|
125
|
+
except _Usage as e:
|
|
126
|
+
print(e, file=sys.stderr)
|
|
127
|
+
return 2
|
|
128
|
+
except NewlithicError as e:
|
|
129
|
+
print(f"Error{f' ({e.status})' if e.status else ''}: {e}", file=sys.stderr)
|
|
130
|
+
return 1
|
|
131
|
+
return 0
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
if __name__ == "__main__":
|
|
135
|
+
sys.exit(main())
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: newlithic
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: SDK and CLI for Newlithic Robotics: book a call, request free robot demonstration data for a task, and get the bimanual sample dataset. No API key; sandbox included.
|
|
5
|
+
Author-email: Newlithic Robotics <build@newlithicrobotics.com>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://newlithicrobotics.com
|
|
8
|
+
Project-URL: Documentation, https://newlithicrobotics.com/docs
|
|
9
|
+
Keywords: newlithic,robotics,robot learning,demonstration data,bimanual,lerobot,imitation learning,sdk,cli
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
15
|
+
Requires-Python: >=3.9
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Requires-Dist: tzdata; sys_platform == "win32"
|
|
19
|
+
Dynamic: license-file
|
|
20
|
+
|
|
21
|
+
# newlithic
|
|
22
|
+
|
|
23
|
+
SDK and command-line tool for [Newlithic Robotics](https://newlithicrobotics.com). Newlithic collects task-specific robot demonstration data with wearable grippers, and delivers it in LeRobot format.
|
|
24
|
+
|
|
25
|
+
With this package you can:
|
|
26
|
+
|
|
27
|
+
- list open call times and book a 30-minute call;
|
|
28
|
+
- send a task card to get free demos (up to 500 demonstrations of your task within 5 business days);
|
|
29
|
+
- get the free bimanual sample dataset.
|
|
30
|
+
|
|
31
|
+
There is no API key and no sign-up. A sandbox runs every check without booking or sending anything.
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
pip install newlithic
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Command line
|
|
38
|
+
|
|
39
|
+
```sh
|
|
40
|
+
newlithic slots --limit 5
|
|
41
|
+
newlithic book --start 2026-12-08T17:00:00.000Z --name "Ada Lovelace" --email ada@example.com --org "Example Lab" --sandbox
|
|
42
|
+
newlithic task-card --email ada@example.com --task "Fold a T-shirt with two hands" --robot "Two arms with parallel grippers" --sandbox
|
|
43
|
+
newlithic dataset
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
`python -m newlithic` works too. Run `newlithic --help` for every option.
|
|
47
|
+
|
|
48
|
+
When `book` and `task-card` run in a terminal, they ask before sending. In scripts they need `--yes`. Add `--sandbox` or `--dry-run` to test.
|
|
49
|
+
|
|
50
|
+
## SDK
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
from newlithic import Newlithic
|
|
54
|
+
|
|
55
|
+
nl = Newlithic() # or Newlithic(sandbox=True)
|
|
56
|
+
slots = nl.list_slots(after="2026-12-08", limit=5)["slots"]
|
|
57
|
+
booking = nl.book_call(slots[0], "Ada Lovelace", "ada@example.com", organization="Example Lab")
|
|
58
|
+
nl.send_task_card("ada@example.com", "Fold a T-shirt with two hands")
|
|
59
|
+
print(nl.dataset()["url"])
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Errors raise `NewlithicError`, with `.status` set:
|
|
63
|
+
|
|
64
|
+
- **409**: the slot was taken. List the slots again and pick another.
|
|
65
|
+
- **422**: a required field is missing.
|
|
66
|
+
|
|
67
|
+
Requires Python 3.9 or later. The package uses only the standard library, plus `tzdata` on Windows.
|
|
68
|
+
|
|
69
|
+
Book a call or send a task card only with the consent of the person named. Each one emails them and the Newlithic team.
|
|
70
|
+
|
|
71
|
+
## Other ways in
|
|
72
|
+
|
|
73
|
+
- **MCP server**: `https://newlithicrobotics.com/mcp`
|
|
74
|
+
- **REST API**: [OpenAPI](https://newlithicrobotics.com/openapi.json)
|
|
75
|
+
- **Sandbox**: `https://newlithicrobotics.com/sandbox`
|
|
76
|
+
- **Docs**: https://newlithicrobotics.com/docs
|
|
77
|
+
|
|
78
|
+
## License
|
|
79
|
+
|
|
80
|
+
Apache-2.0
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
src/newlithic/__init__.py
|
|
5
|
+
src/newlithic/__main__.py
|
|
6
|
+
src/newlithic/cli.py
|
|
7
|
+
src/newlithic.egg-info/PKG-INFO
|
|
8
|
+
src/newlithic.egg-info/SOURCES.txt
|
|
9
|
+
src/newlithic.egg-info/dependency_links.txt
|
|
10
|
+
src/newlithic.egg-info/entry_points.txt
|
|
11
|
+
src/newlithic.egg-info/requires.txt
|
|
12
|
+
src/newlithic.egg-info/top_level.txt
|
|
13
|
+
tests/test_sandbox.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
newlithic
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"""Runs against the live sandbox (https://newlithicrobotics.com/sandbox): nothing is booked or sent.
|
|
2
|
+
The only production calls are reads (slots) and a dry run."""
|
|
3
|
+
import json
|
|
4
|
+
import os
|
|
5
|
+
import subprocess
|
|
6
|
+
import sys
|
|
7
|
+
import unittest
|
|
8
|
+
|
|
9
|
+
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "src"))
|
|
10
|
+
from newlithic import DATASET, SANDBOX_URL, Newlithic, NewlithicError # noqa: E402
|
|
11
|
+
|
|
12
|
+
SRC = os.path.join(os.path.dirname(__file__), "..", "src")
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def cli(*args):
|
|
16
|
+
env = dict(os.environ, PYTHONPATH=SRC)
|
|
17
|
+
return subprocess.run([sys.executable, "-m", "newlithic", *args], capture_output=True, text=True, env=env, stdin=subprocess.DEVNULL)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class Sandbox(unittest.TestCase):
|
|
21
|
+
sb = Newlithic(sandbox=True)
|
|
22
|
+
|
|
23
|
+
def test_points_at_sandbox(self):
|
|
24
|
+
self.assertEqual(self.sb.base_url, SANDBOX_URL)
|
|
25
|
+
|
|
26
|
+
def test_list_slots(self):
|
|
27
|
+
r = self.sb.list_slots(limit=3)
|
|
28
|
+
self.assertTrue(r["sandbox"])
|
|
29
|
+
self.assertEqual(r["slotMinutes"], 30)
|
|
30
|
+
self.assertTrue(0 < len(r["slots"]) <= 3)
|
|
31
|
+
later = self.sb.list_slots(after=r["slots"][-1], limit=1)
|
|
32
|
+
self.assertGreaterEqual(later["slots"][0], r["slots"][-1])
|
|
33
|
+
|
|
34
|
+
def test_book_sandbox(self):
|
|
35
|
+
s = self.sb.list_slots(limit=1)["slots"][0]
|
|
36
|
+
r = self.sb.book_call(s, "SDK Test", "test@example.com")
|
|
37
|
+
self.assertEqual((r["ok"], r["sandbox"], r["id"]), (True, True, None))
|
|
38
|
+
|
|
39
|
+
def test_book_errors(self):
|
|
40
|
+
with self.assertRaises(NewlithicError) as e:
|
|
41
|
+
self.sb.book_call("2020-01-01T00:00:00.000Z", "SDK Test", "test@example.com")
|
|
42
|
+
self.assertEqual(e.exception.status, 409)
|
|
43
|
+
s = self.sb.list_slots(limit=1)["slots"][0]
|
|
44
|
+
with self.assertRaises(NewlithicError) as e:
|
|
45
|
+
self.sb.book_call(s, "SDK Test", "nope")
|
|
46
|
+
self.assertEqual(e.exception.status, 422)
|
|
47
|
+
|
|
48
|
+
def test_production_dry_run(self):
|
|
49
|
+
nl = Newlithic()
|
|
50
|
+
s = nl.list_slots(limit=1)["slots"][0]
|
|
51
|
+
r = nl.book_call(s, "SDK Test", "test@example.com", dry_run=True)
|
|
52
|
+
self.assertEqual((r["sandbox"], r["id"]), (True, None))
|
|
53
|
+
|
|
54
|
+
def test_task_card(self):
|
|
55
|
+
r = self.sb.send_task_card("test@example.com", "SDK test task")
|
|
56
|
+
self.assertEqual((r["ok"], r["sandbox"], r["id"]), (True, True, None))
|
|
57
|
+
with self.assertRaises(ValueError):
|
|
58
|
+
self.sb.send_task_card("test@example.com", "")
|
|
59
|
+
|
|
60
|
+
def test_dataset(self):
|
|
61
|
+
self.assertEqual(DATASET["episodes"], 50)
|
|
62
|
+
self.assertEqual(len(DATASET["state"]), 20)
|
|
63
|
+
|
|
64
|
+
def test_cli(self):
|
|
65
|
+
r = cli("--sandbox", "slots", "--limit", "2", "--json") # option before the command
|
|
66
|
+
self.assertEqual(r.returncode, 0, r.stderr)
|
|
67
|
+
out = json.loads(r.stdout)
|
|
68
|
+
self.assertTrue(out.get("sandbox"))
|
|
69
|
+
s = out["slots"][0]
|
|
70
|
+
b = cli("book", "--sandbox", "--start", s, "--name", "CLI Test", "--email", "test@example.com")
|
|
71
|
+
self.assertEqual(b.returncode, 0, b.stderr)
|
|
72
|
+
self.assertTrue(b.stdout.startswith("Sandbox: "))
|
|
73
|
+
self.assertIn("Newlithic/bimanual-ee-pose", cli("dataset").stdout)
|
|
74
|
+
|
|
75
|
+
def test_cli_refuses_real_booking_without_yes(self):
|
|
76
|
+
r = cli("book", "--start", "2026-12-08T17:00:00.000Z", "--name", "CLI Test", "--email", "test@example.com")
|
|
77
|
+
self.assertEqual(r.returncode, 2)
|
|
78
|
+
self.assertIn("needs --yes", r.stderr)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
if __name__ == "__main__":
|
|
82
|
+
unittest.main()
|