exprts-ai 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.
- exprts_ai-0.1.0/.github/workflows/ci.yml +21 -0
- exprts_ai-0.1.0/LICENSE +202 -0
- exprts_ai-0.1.0/MANIFEST.in +6 -0
- exprts_ai-0.1.0/PKG-INFO +111 -0
- exprts_ai-0.1.0/README.md +88 -0
- exprts_ai-0.1.0/RELEASE.md +22 -0
- exprts_ai-0.1.0/examples/background.py +12 -0
- exprts_ai-0.1.0/examples/webots_controller.py +21 -0
- exprts_ai-0.1.0/pyproject.toml +46 -0
- exprts_ai-0.1.0/setup.cfg +4 -0
- exprts_ai-0.1.0/src/exprts_ai/__init__.py +29 -0
- exprts_ai-0.1.0/src/exprts_ai/client.py +240 -0
- exprts_ai-0.1.0/src/exprts_ai/config.py +75 -0
- exprts_ai-0.1.0/src/exprts_ai/errors.py +34 -0
- exprts_ai-0.1.0/src/exprts_ai/models.py +54 -0
- exprts_ai-0.1.0/src/exprts_ai/py.typed +0 -0
- exprts_ai-0.1.0/src/exprts_ai/transport.py +78 -0
- exprts_ai-0.1.0/src/exprts_ai.egg-info/PKG-INFO +111 -0
- exprts_ai-0.1.0/src/exprts_ai.egg-info/SOURCES.txt +22 -0
- exprts_ai-0.1.0/src/exprts_ai.egg-info/dependency_links.txt +1 -0
- exprts_ai-0.1.0/src/exprts_ai.egg-info/requires.txt +7 -0
- exprts_ai-0.1.0/src/exprts_ai.egg-info/top_level.txt +1 -0
- exprts_ai-0.1.0/tests/test_sdk.py +365 -0
- exprts_ai-0.1.0/tests/webots_smoke.py +116 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
name: SDK checks
|
|
2
|
+
on: [push, pull_request]
|
|
3
|
+
permissions:
|
|
4
|
+
contents: read
|
|
5
|
+
jobs:
|
|
6
|
+
test:
|
|
7
|
+
runs-on: ubuntu-latest
|
|
8
|
+
strategy:
|
|
9
|
+
matrix:
|
|
10
|
+
python: ['3.10', '3.11', '3.12', '3.13', '3.14']
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
- uses: actions/setup-python@v5
|
|
14
|
+
with:
|
|
15
|
+
python-version: '${{ matrix.python }}'
|
|
16
|
+
- run: python -m pip install '.[dev]'
|
|
17
|
+
- run: ruff check .
|
|
18
|
+
- run: mypy src
|
|
19
|
+
- run: pytest
|
|
20
|
+
- run: python -m build
|
|
21
|
+
- run: python -m twine check dist/*
|
exprts_ai-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.
|
exprts_ai-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: exprts-ai
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Exprts.ai robotics connectivity SDK
|
|
5
|
+
Author: Exprts.ai
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Classifier: Development Status :: 3 - Alpha
|
|
8
|
+
Classifier: Intended Audience :: Developers
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Typing :: Typed
|
|
13
|
+
Requires-Python: >=3.10
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Provides-Extra: dev
|
|
17
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
|
18
|
+
Requires-Dist: build>=1.2; extra == "dev"
|
|
19
|
+
Requires-Dist: twine>=6; extra == "dev"
|
|
20
|
+
Requires-Dist: ruff>=0.11; extra == "dev"
|
|
21
|
+
Requires-Dist: mypy>=1.15; extra == "dev"
|
|
22
|
+
Dynamic: license-file
|
|
23
|
+
|
|
24
|
+
# Exprts.ai Python SDK
|
|
25
|
+
|
|
26
|
+
Connectivity-only SDK v0.1.0 for Python 3.10+. Distribution: **exprts-ai**. Import: **exprts_ai**. No runtime dependencies.
|
|
27
|
+
|
|
28
|
+
This source is prepared locally. Installation from PyPI becomes available after a separate release; the commands below currently use a local checkout or wheel.
|
|
29
|
+
|
|
30
|
+
## Quick start
|
|
31
|
+
|
|
32
|
+
Register a robot in the customer dashboard and generate its **device credential**. A project API key cannot authenticate a device. Identity is determined by the server; do not supply robot or project IDs.
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
python -m pip install /path/to/python-sdk
|
|
36
|
+
export EXPRTS_API_URL=https://api.exprts.ai
|
|
37
|
+
read -rs -p 'Device credential: ' EXPRTS_DEVICE_TOKEN
|
|
38
|
+
export EXPRTS_DEVICE_TOKEN
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Use your actual API origin. HTTP is allowed only for `localhost`, `127.0.0.1` and `::1` development. URLs must not include `/v1`, credentials, a query, or a fragment. TLS certificate verification stays enabled; redirects and ambient HTTP proxies are disabled.
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
from exprts_ai import ExprtsClient
|
|
45
|
+
|
|
46
|
+
with ExprtsClient(integration="custom") as client:
|
|
47
|
+
# start() / entering the context launches a background thread immediately.
|
|
48
|
+
# Put the existing robot application's loop here; do not wait on cloud access.
|
|
49
|
+
run_local_robot_application()
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
For a blocking connectivity check outside a control loop:
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
from exprts_ai import ExprtsClient, ExprtsError
|
|
56
|
+
|
|
57
|
+
client = ExprtsClient() # Reads EXPRTS_API_URL and EXPRTS_DEVICE_TOKEN.
|
|
58
|
+
try:
|
|
59
|
+
info = client.connect() # GET /v1/device/verify, POST /v1/device/heartbeat.
|
|
60
|
+
print(info.robot_id, info.heartbeat_interval_seconds)
|
|
61
|
+
except ExprtsError as error:
|
|
62
|
+
print(error) # SDK error text excludes request credentials and server bodies.
|
|
63
|
+
finally:
|
|
64
|
+
client.close()
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
After release the installation command will be `python -m pip install exprts-ai==0.1.0`.
|
|
68
|
+
|
|
69
|
+
## API
|
|
70
|
+
|
|
71
|
+
- `ExprtsClient(api_url=None, device_token=None, timeout=3, max_backoff=30, max_retry_after=300, integration="python", runtime=None)`: explicit arguments override environment variables. Default origin is `https://api.exprts.ai`; no connection occurs during initialization.
|
|
72
|
+
- `verify() -> DeviceInfo`: blocking credential check, no retries. Does not record a heartbeat.
|
|
73
|
+
- `heartbeat() -> DeviceInfo`: blocking single heartbeat, no retries.
|
|
74
|
+
- `connect() -> DeviceInfo`: blocking verify followed by heartbeat, no retries.
|
|
75
|
+
- `start() -> ExprtsClient`: background verification and heartbeats; duplicate running starts raise `RuntimeError`.
|
|
76
|
+
- `stop(timeout=None) -> bool` / `close()`: signal stop, interrupt retry waits and join. Returns false if a request is still in progress. Restart only once the old worker exits.
|
|
77
|
+
- `wait_until_connected(timeout=10) -> bool`: optional bounded wait, outside control loops.
|
|
78
|
+
- `status -> ConnectionStatus`: immutable snapshot with state, last device response and sanitized error text.
|
|
79
|
+
- `is_connected -> bool`: whether the last connectivity attempt succeeded. It is not a safety signal or a real-time guarantee of network reachability.
|
|
80
|
+
|
|
81
|
+
States: `stopped`, `connecting`, `connected`, `retrying`, `authentication_failed`, `failed`.
|
|
82
|
+
|
|
83
|
+
The background worker follows the server heartbeat interval. Network failures and HTTP 408/429/500/502/503/504 trigger bounded exponential backoff with jitter and re-verification. `Retry-After` supports seconds and HTTP dates, capped by `max_retry_after`. HTTP 401/403 stops the worker rather than repeatedly submitting rejected credentials. Generate/rotate a credential in the dashboard, stop the old client and create a new client with the replacement. Other HTTP errors and invalid/oversized responses stop the worker; inspect `status` before restarting.
|
|
84
|
+
|
|
85
|
+
The three-second default timeout is a socket timeout, not a hard total deadline against a peer that continuously trickles bytes. Shutdown cannot cancel an in-flight standard-library HTTP operation; its join budget defaults to timeout + one second and the worker is a daemon. Never wait for shutdown in a safety-critical control loop. No samples or robot commands are queued, persisted, replayed or sent.
|
|
86
|
+
|
|
87
|
+
## Robotics integration
|
|
88
|
+
|
|
89
|
+
The worker accesses no robot hardware or simulator objects. Start it beside an existing Python controller and keep local control independent of connectivity. See `examples/webots_controller.py` and `examples/background.py`. ROS, Gazebo, Isaac Sim and other Python runtimes can use the same pattern; native adapters are not included or claimed tested. Webots must use a Python interpreter where this package is installed.
|
|
90
|
+
|
|
91
|
+
SDK v0.1.0 does not implement telemetry ingestion, tables, streams, recording policies, experiences, storage, datasets, managed processing, billing or deployments.
|
|
92
|
+
|
|
93
|
+
## Development
|
|
94
|
+
|
|
95
|
+
From this SDK directory:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
python -m venv .venv
|
|
99
|
+
.venv/bin/python -m pip install -e '.[dev]'
|
|
100
|
+
.venv/bin/python -m pytest
|
|
101
|
+
.venv/bin/ruff check .
|
|
102
|
+
.venv/bin/mypy src
|
|
103
|
+
.venv/bin/python -m build
|
|
104
|
+
.venv/bin/python -m twine check dist/*
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
The included CI workflow runs after this directory is exported as the root of its own repository. The workflow tests Python 3.10–3.14; local results are recorded in `RELEASE.md` and are not a claim that every matrix version has run locally.
|
|
108
|
+
|
|
109
|
+
## License and contribution
|
|
110
|
+
|
|
111
|
+
Apache License 2.0 applies to this SDK directory only. It does not license the surrounding platform repository. Report security issues privately to the SDK maintainer; do not include credentials in issues, logs or screenshots. Contributions should include focused tests and pass the checks above.
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# Exprts.ai Python SDK
|
|
2
|
+
|
|
3
|
+
Connectivity-only SDK v0.1.0 for Python 3.10+. Distribution: **exprts-ai**. Import: **exprts_ai**. No runtime dependencies.
|
|
4
|
+
|
|
5
|
+
This source is prepared locally. Installation from PyPI becomes available after a separate release; the commands below currently use a local checkout or wheel.
|
|
6
|
+
|
|
7
|
+
## Quick start
|
|
8
|
+
|
|
9
|
+
Register a robot in the customer dashboard and generate its **device credential**. A project API key cannot authenticate a device. Identity is determined by the server; do not supply robot or project IDs.
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
python -m pip install /path/to/python-sdk
|
|
13
|
+
export EXPRTS_API_URL=https://api.exprts.ai
|
|
14
|
+
read -rs -p 'Device credential: ' EXPRTS_DEVICE_TOKEN
|
|
15
|
+
export EXPRTS_DEVICE_TOKEN
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Use your actual API origin. HTTP is allowed only for `localhost`, `127.0.0.1` and `::1` development. URLs must not include `/v1`, credentials, a query, or a fragment. TLS certificate verification stays enabled; redirects and ambient HTTP proxies are disabled.
|
|
19
|
+
|
|
20
|
+
```python
|
|
21
|
+
from exprts_ai import ExprtsClient
|
|
22
|
+
|
|
23
|
+
with ExprtsClient(integration="custom") as client:
|
|
24
|
+
# start() / entering the context launches a background thread immediately.
|
|
25
|
+
# Put the existing robot application's loop here; do not wait on cloud access.
|
|
26
|
+
run_local_robot_application()
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
For a blocking connectivity check outside a control loop:
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
from exprts_ai import ExprtsClient, ExprtsError
|
|
33
|
+
|
|
34
|
+
client = ExprtsClient() # Reads EXPRTS_API_URL and EXPRTS_DEVICE_TOKEN.
|
|
35
|
+
try:
|
|
36
|
+
info = client.connect() # GET /v1/device/verify, POST /v1/device/heartbeat.
|
|
37
|
+
print(info.robot_id, info.heartbeat_interval_seconds)
|
|
38
|
+
except ExprtsError as error:
|
|
39
|
+
print(error) # SDK error text excludes request credentials and server bodies.
|
|
40
|
+
finally:
|
|
41
|
+
client.close()
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
After release the installation command will be `python -m pip install exprts-ai==0.1.0`.
|
|
45
|
+
|
|
46
|
+
## API
|
|
47
|
+
|
|
48
|
+
- `ExprtsClient(api_url=None, device_token=None, timeout=3, max_backoff=30, max_retry_after=300, integration="python", runtime=None)`: explicit arguments override environment variables. Default origin is `https://api.exprts.ai`; no connection occurs during initialization.
|
|
49
|
+
- `verify() -> DeviceInfo`: blocking credential check, no retries. Does not record a heartbeat.
|
|
50
|
+
- `heartbeat() -> DeviceInfo`: blocking single heartbeat, no retries.
|
|
51
|
+
- `connect() -> DeviceInfo`: blocking verify followed by heartbeat, no retries.
|
|
52
|
+
- `start() -> ExprtsClient`: background verification and heartbeats; duplicate running starts raise `RuntimeError`.
|
|
53
|
+
- `stop(timeout=None) -> bool` / `close()`: signal stop, interrupt retry waits and join. Returns false if a request is still in progress. Restart only once the old worker exits.
|
|
54
|
+
- `wait_until_connected(timeout=10) -> bool`: optional bounded wait, outside control loops.
|
|
55
|
+
- `status -> ConnectionStatus`: immutable snapshot with state, last device response and sanitized error text.
|
|
56
|
+
- `is_connected -> bool`: whether the last connectivity attempt succeeded. It is not a safety signal or a real-time guarantee of network reachability.
|
|
57
|
+
|
|
58
|
+
States: `stopped`, `connecting`, `connected`, `retrying`, `authentication_failed`, `failed`.
|
|
59
|
+
|
|
60
|
+
The background worker follows the server heartbeat interval. Network failures and HTTP 408/429/500/502/503/504 trigger bounded exponential backoff with jitter and re-verification. `Retry-After` supports seconds and HTTP dates, capped by `max_retry_after`. HTTP 401/403 stops the worker rather than repeatedly submitting rejected credentials. Generate/rotate a credential in the dashboard, stop the old client and create a new client with the replacement. Other HTTP errors and invalid/oversized responses stop the worker; inspect `status` before restarting.
|
|
61
|
+
|
|
62
|
+
The three-second default timeout is a socket timeout, not a hard total deadline against a peer that continuously trickles bytes. Shutdown cannot cancel an in-flight standard-library HTTP operation; its join budget defaults to timeout + one second and the worker is a daemon. Never wait for shutdown in a safety-critical control loop. No samples or robot commands are queued, persisted, replayed or sent.
|
|
63
|
+
|
|
64
|
+
## Robotics integration
|
|
65
|
+
|
|
66
|
+
The worker accesses no robot hardware or simulator objects. Start it beside an existing Python controller and keep local control independent of connectivity. See `examples/webots_controller.py` and `examples/background.py`. ROS, Gazebo, Isaac Sim and other Python runtimes can use the same pattern; native adapters are not included or claimed tested. Webots must use a Python interpreter where this package is installed.
|
|
67
|
+
|
|
68
|
+
SDK v0.1.0 does not implement telemetry ingestion, tables, streams, recording policies, experiences, storage, datasets, managed processing, billing or deployments.
|
|
69
|
+
|
|
70
|
+
## Development
|
|
71
|
+
|
|
72
|
+
From this SDK directory:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
python -m venv .venv
|
|
76
|
+
.venv/bin/python -m pip install -e '.[dev]'
|
|
77
|
+
.venv/bin/python -m pytest
|
|
78
|
+
.venv/bin/ruff check .
|
|
79
|
+
.venv/bin/mypy src
|
|
80
|
+
.venv/bin/python -m build
|
|
81
|
+
.venv/bin/python -m twine check dist/*
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
The included CI workflow runs after this directory is exported as the root of its own repository. The workflow tests Python 3.10–3.14; local results are recorded in `RELEASE.md` and are not a claim that every matrix version has run locally.
|
|
85
|
+
|
|
86
|
+
## License and contribution
|
|
87
|
+
|
|
88
|
+
Apache License 2.0 applies to this SDK directory only. It does not license the surrounding platform repository. Report security issues privately to the SDK maintainer; do not include credentials in issues, logs or screenshots. Contributions should include focused tests and pass the checks above.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# SDK v0.1.0 release preparation
|
|
2
|
+
|
|
3
|
+
Prepared for local review. Public repository creation and PyPI upload are intentionally pending the owner's chosen destination. Keep the main platform repository private.
|
|
4
|
+
|
|
5
|
+
1. Export **only this directory** to a new repository root; never change the main repository's visibility. Include README, LICENSE, source, tests, examples, pyproject.toml and `.github/workflows/ci.yml`. Exclude `.venv`, caches, build outputs, credentials and `.env` files.
|
|
6
|
+
2. Run CI on supported Python versions and record actual Webots acceptance before claiming that runtime tested for this SDK. The older standalone REST example's manual acceptance does not certify this package.
|
|
7
|
+
3. Build from the SDK root with `python -m build`; validate with `python -m twine check dist/*`. Inspect wheel and source archive member lists and contents for secrets and platform files.
|
|
8
|
+
4. Install the wheel into a clean environment with `pip install --no-deps /path/to/wheel.whl`; import `exprts_ai` outside the source tree. Repeat by building/installing from the source archive.
|
|
9
|
+
5. Confirm PyPI ownership/name availability immediately before publishing. An available name is not reserved. Configure the chosen separate repository's release identity and PyPI Trusted Publishing or a securely stored scoped upload credential.
|
|
10
|
+
6. Publish only the reviewed v0.1.0 artifacts to the intended index, tag the SDK repository and verify `pip install exprts-ai==0.1.0` in a clean environment. Do not commit upload tokens or place them in shell history.
|
|
11
|
+
|
|
12
|
+
No publishing workflow is enabled automatically. Release completion stays unchecked in the platform roadmap until the separate repository, public documentation and actual PyPI installation are verified.
|
|
13
|
+
|
|
14
|
+
## Local verification — 2026-12-01
|
|
15
|
+
|
|
16
|
+
- Python 3.12.3: 61 tests passed, Ruff passed, strict mypy passed.
|
|
17
|
+
- Wheel and source archive built; Twine metadata checks passed; both installed into separate clean virtual environments without runtime dependencies. Import and package license metadata verified outside the source checkout.
|
|
18
|
+
- Reviewed archive member lists and scanned contents for credentials/private keys; no platform backend/frontend or environment files included.
|
|
19
|
+
- Real Webots R2025a under Xvfb with software rendering: 135,144 simulation steps in the six-second controller window; 89,118 steps while disconnected. Observed connecting, connected, retrying and authentication_failed; three verify requests, four heartbeats, and clean worker shutdown. A local synthetic HTTP fixture injected 503 failures and 401 rejection. This proves runtime integration with this SDK; it does not certify production API, physical hardware, other simulators or all supported Python versions.
|
|
20
|
+
- Reproduce the optional simulator check from the SDK root: `python tests/webots_smoke.py` (requires Webots and xvfb-run).
|
|
21
|
+
|
|
22
|
+
The SDK is ready for a separate public-repository review. It has not been uploaded to PyPI.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"""Run with credentials in the environment; Ctrl-C stops this connectivity demo."""
|
|
2
|
+
|
|
3
|
+
import threading
|
|
4
|
+
|
|
5
|
+
from exprts_ai import ExprtsClient
|
|
6
|
+
|
|
7
|
+
if __name__ == "__main__":
|
|
8
|
+
try:
|
|
9
|
+
with ExprtsClient(integration="python-demo"):
|
|
10
|
+
threading.Event().wait() # Replace with your independent application loop.
|
|
11
|
+
except KeyboardInterrupt:
|
|
12
|
+
pass
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"""Install exprts-ai into Webots' Python environment before using this controller."""
|
|
2
|
+
|
|
3
|
+
from controller import Robot # Webots supplies this module.
|
|
4
|
+
|
|
5
|
+
from exprts_ai import ConfigurationError, ExprtsClient
|
|
6
|
+
|
|
7
|
+
robot = Robot()
|
|
8
|
+
timestep = int(robot.getBasicTimeStep())
|
|
9
|
+
client = None
|
|
10
|
+
try:
|
|
11
|
+
try:
|
|
12
|
+
client = ExprtsClient(integration="webots").start()
|
|
13
|
+
except ConfigurationError:
|
|
14
|
+
print("Exprts is not configured; local simulation continues.")
|
|
15
|
+
while robot.step(timestep) != -1:
|
|
16
|
+
# Retain your movement, device access and safety logic here.
|
|
17
|
+
# Cloud requests run only on the SDK's background thread.
|
|
18
|
+
pass
|
|
19
|
+
finally:
|
|
20
|
+
if client is not None:
|
|
21
|
+
client.stop()
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77.0.3"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "exprts-ai"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Exprts.ai robotics connectivity SDK"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "Apache-2.0"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
authors = [{name = "Exprts.ai"}]
|
|
14
|
+
dependencies = []
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 3 - Alpha",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
20
|
+
"Operating System :: OS Independent",
|
|
21
|
+
"Typing :: Typed",
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
[project.optional-dependencies]
|
|
25
|
+
dev = ["pytest>=8", "build>=1.2", "twine>=6", "ruff>=0.11", "mypy>=1.15"]
|
|
26
|
+
|
|
27
|
+
[tool.setuptools.packages.find]
|
|
28
|
+
where = ["src"]
|
|
29
|
+
|
|
30
|
+
[tool.setuptools.package-data]
|
|
31
|
+
exprts_ai = ["py.typed"]
|
|
32
|
+
|
|
33
|
+
[tool.pytest.ini_options]
|
|
34
|
+
testpaths = ["tests"]
|
|
35
|
+
pythonpath = ["src"]
|
|
36
|
+
|
|
37
|
+
[tool.ruff]
|
|
38
|
+
line-length = 100
|
|
39
|
+
target-version = "py310"
|
|
40
|
+
|
|
41
|
+
[tool.ruff.lint]
|
|
42
|
+
select = ["E", "F", "I", "UP", "B"]
|
|
43
|
+
|
|
44
|
+
[tool.mypy]
|
|
45
|
+
python_version = "3.10"
|
|
46
|
+
strict = true
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"""Exprts.ai connectivity SDK. Install ``exprts-ai``; import ``exprts_ai``."""
|
|
2
|
+
|
|
3
|
+
from .client import ConnectionState, ConnectionStatus, ExprtsClient
|
|
4
|
+
from .config import Config
|
|
5
|
+
from .errors import (
|
|
6
|
+
APIError,
|
|
7
|
+
AuthenticationError,
|
|
8
|
+
ConfigurationError,
|
|
9
|
+
ExprtsError,
|
|
10
|
+
ProtocolError,
|
|
11
|
+
TransportError,
|
|
12
|
+
)
|
|
13
|
+
from .models import DeviceInfo
|
|
14
|
+
|
|
15
|
+
__version__ = "0.1.0"
|
|
16
|
+
__all__ = [
|
|
17
|
+
"ExprtsClient",
|
|
18
|
+
"Config",
|
|
19
|
+
"DeviceInfo",
|
|
20
|
+
"ConnectionState",
|
|
21
|
+
"ConnectionStatus",
|
|
22
|
+
"ExprtsError",
|
|
23
|
+
"ConfigurationError",
|
|
24
|
+
"AuthenticationError",
|
|
25
|
+
"APIError",
|
|
26
|
+
"ProtocolError",
|
|
27
|
+
"TransportError",
|
|
28
|
+
"__version__",
|
|
29
|
+
]
|