loobric-cli 1.0.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.
- loobric_cli-1.0.0/LICENSE +21 -0
- loobric_cli-1.0.0/PKG-INFO +141 -0
- loobric_cli-1.0.0/README.md +115 -0
- loobric_cli-1.0.0/loobric/__init__.py +26 -0
- loobric_cli-1.0.0/loobric/cli/__init__.py +8 -0
- loobric_cli-1.0.0/loobric/cli/main.py +1917 -0
- loobric_cli-1.0.0/loobric/client.py +413 -0
- loobric_cli-1.0.0/loobric/errors.py +40 -0
- loobric_cli-1.0.0/loobric/importers/__init__.py +67 -0
- loobric_cli-1.0.0/loobric/importers/_util.py +31 -0
- loobric_cli-1.0.0/loobric/importers/base.py +67 -0
- loobric_cli-1.0.0/loobric/importers/din4000/__init__.py +65 -0
- loobric_cli-1.0.0/loobric/importers/din4000/_codes.py +116 -0
- loobric_cli-1.0.0/loobric/importers/din4000/_csv.py +30 -0
- loobric_cli-1.0.0/loobric/importers/din4000/_xml.py +42 -0
- loobric_cli-1.0.0/loobric/importers/gtc.py +145 -0
- loobric_cli-1.0.0/loobric/importers/hypermill.py +72 -0
- loobric_cli-1.0.0/loobric/importers/p21.py +222 -0
- loobric_cli-1.0.0/loobric/importers/run.py +102 -0
- loobric_cli-1.0.0/loobric/importers/solidcam.py +89 -0
- loobric_cli-1.0.0/loobric/transport.py +210 -0
- loobric_cli-1.0.0/loobric_cli.egg-info/PKG-INFO +141 -0
- loobric_cli-1.0.0/loobric_cli.egg-info/SOURCES.txt +33 -0
- loobric_cli-1.0.0/loobric_cli.egg-info/dependency_links.txt +1 -0
- loobric_cli-1.0.0/loobric_cli.egg-info/entry_points.txt +2 -0
- loobric_cli-1.0.0/loobric_cli.egg-info/requires.txt +9 -0
- loobric_cli-1.0.0/loobric_cli.egg-info/top_level.txt +1 -0
- loobric_cli-1.0.0/pyproject.toml +41 -0
- loobric_cli-1.0.0/setup.cfg +4 -0
- loobric_cli-1.0.0/tests/test_cli.py +894 -0
- loobric_cli-1.0.0/tests/test_client_admin_users.py +36 -0
- loobric_cli-1.0.0/tests/test_client_smoke.py +37 -0
- loobric_cli-1.0.0/tests/test_importers_camxml.py +64 -0
- loobric_cli-1.0.0/tests/test_importers_din4000.py +163 -0
- loobric_cli-1.0.0/tests/test_importers_iso13399.py +193 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 sliptonic
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: loobric-cli
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Python client library and CLI for Loobric Core (CNC tool-data sync).
|
|
5
|
+
Author: sliptonic
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/loobric/loobric-cli
|
|
8
|
+
Project-URL: Repository, https://github.com/loobric/loobric-cli
|
|
9
|
+
Project-URL: Issues, https://github.com/loobric/loobric-cli/issues
|
|
10
|
+
Keywords: cnc,cam,tool-data,freecad,linuxcnc,machining
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Topic :: Scientific/Engineering
|
|
15
|
+
Classifier: Intended Audience :: Manufacturing
|
|
16
|
+
Requires-Python: >=3.9
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
Provides-Extra: importers
|
|
20
|
+
Requires-Dist: lxml>=5.0; extra == "importers"
|
|
21
|
+
Provides-Extra: completion
|
|
22
|
+
Requires-Dist: argcomplete>=3.0; extra == "completion"
|
|
23
|
+
Provides-Extra: dev
|
|
24
|
+
Requires-Dist: pytest>=7.4; extra == "dev"
|
|
25
|
+
Dynamic: license-file
|
|
26
|
+
|
|
27
|
+
# loobric-cli
|
|
28
|
+
|
|
29
|
+
Python client for [Loobric Core](https://github.com/loobric/loobric-core) — the
|
|
30
|
+
library and CLI for synchronizing CNC tool data. It speaks only the public REST
|
|
31
|
+
API and depends on nothing from the server.
|
|
32
|
+
|
|
33
|
+
> **New in v0.4.0 — a seed script + a public sandbox.**
|
|
34
|
+
> [`examples/quickstart.sh`](examples/quickstart.sh) is a readable list of plain
|
|
35
|
+
> `loobric` commands that seeds an account with a small demo catalog (two
|
|
36
|
+
> manufacturers) and walks the whole loop — machine → catalog → instance → tool
|
|
37
|
+
> set → tool-table push. Run it to give a fresh account something to explore;
|
|
38
|
+
> read it to learn how to script the CLI. Point it at the free hosted sandbox and
|
|
39
|
+
> kick the tires without installing a server. See [docs/SANDBOX.md](docs/SANDBOX.md).
|
|
40
|
+
>
|
|
41
|
+
> **New in v0.3.0 — full list/show symmetry.** Every listable entity now has a
|
|
42
|
+
> matching `show` verb: `show-machine`, `show-tool`, and `show-key` join the
|
|
43
|
+
> existing `show-*` commands, each resolving its target by id, name, or unique
|
|
44
|
+
> prefix. List to find it, show to inspect it — one consistent pattern everywhere.
|
|
45
|
+
>
|
|
46
|
+
> **`loobric import` — stop re-typing tool data.** One command auto-detects the
|
|
47
|
+
> format and turns a vendor export into catalog records on your server:
|
|
48
|
+
> **DIN 4000** (CSV + XML 2013/2016), **STEP P21**, **GTC packages** (ISO 13399),
|
|
49
|
+
> **SolidCAM**, and **hyperMILL**. Every imported field keeps its source, and the
|
|
50
|
+
> raw payload is preserved verbatim so nothing is lost or guessed. GTC packages
|
|
51
|
+
> also carry the tool's 3D STEP models and images, uploaded as canonical media on
|
|
52
|
+
> servers whose media backend is enabled. See
|
|
53
|
+
> [docs/IMPORTERS_PLAN.md](docs/IMPORTERS_PLAN.md).
|
|
54
|
+
>
|
|
55
|
+
> The importable library (`loobric.Client`) and the `loobric` CLI are both
|
|
56
|
+
> here, ported from the old single-file `loobric.py` — see
|
|
57
|
+
> [docs/adr/0001-extract-loobric-cli.md](docs/adr/0001-extract-loobric-cli.md).
|
|
58
|
+
|
|
59
|
+
## Install
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
pip install loobric-cli # library + CLI + every bundled importer — stdlib only, no deps
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Everything ships in the base install. The library, the `loobric` CLI, and all of
|
|
66
|
+
today's importers (DIN 4000, STEP P21, GTC, SolidCAM, hyperMILL) are
|
|
67
|
+
standard-library only, so the package stays vendorable and runs in constrained
|
|
68
|
+
interpreters. The optional `[importers]` extra is reserved for future formats
|
|
69
|
+
that need heavier parsers; no bundled importer requires it yet.
|
|
70
|
+
|
|
71
|
+
## Try the sandbox
|
|
72
|
+
|
|
73
|
+
Don't want to run a server yet? Point the client at the free hosted **sandbox**
|
|
74
|
+
and explore against live data:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
pip install loobric-cli
|
|
78
|
+
export LOOBRIC_BASE_URL=https://api.loobric.com
|
|
79
|
+
loobric register you@example.com # create an account
|
|
80
|
+
loobric login you@example.com # then mint a key (below)
|
|
81
|
+
loobric create-key sandbox --scopes "read write"
|
|
82
|
+
export LOOBRIC_API_KEY=<the key it prints> # the CLI reads this automatically
|
|
83
|
+
curl -O https://raw.githubusercontent.com/loobric/loobric-cli/master/examples/quickstart.sh
|
|
84
|
+
bash quickstart.sh # seed a demo and walk the loop
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
The sandbox is a shared demo server — **data may be reset and accounts removed,
|
|
88
|
+
so keep nothing real there.** Full walkthrough (and why API keys, not sessions):
|
|
89
|
+
[docs/SANDBOX.md](docs/SANDBOX.md).
|
|
90
|
+
|
|
91
|
+
## Library
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
from loobric import Client, NotFound
|
|
95
|
+
|
|
96
|
+
c = Client(base_url="http://nas:8000", api_key="...") # solo mode: omit api_key
|
|
97
|
+
for s in c.list_tool_sets():
|
|
98
|
+
print(s)
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Every method returns parsed data and raises a `LoobricClientError` subclass
|
|
102
|
+
(`NotFound`, `AuthRequired`, `HTTPError`, `ConnectionFailed`) on failure — it
|
|
103
|
+
never prints or exits, so callers handle failure themselves.
|
|
104
|
+
|
|
105
|
+
## CLI
|
|
106
|
+
|
|
107
|
+
`loobric <verb>` is the universal command-line client (the role the old `loobric`
|
|
108
|
+
command served). See the [CLI reference and walkthrough](docs/CLI.md).
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
loobric --help
|
|
112
|
+
loobric list-machines
|
|
113
|
+
loobric show-machine mill01 # by name, id, or unique prefix
|
|
114
|
+
loobric create-record --from-catalog B201 --name "1/4 downcut"
|
|
115
|
+
loobric show-tool "1/4 downcut" # one instance, full provenance
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Every `list-*` verb has a matching `show-*` verb (`show-machine`, `show-tool`,
|
|
119
|
+
`show-tool-set`, `show-key`, …), each resolving its target by id, name, or
|
|
120
|
+
unique prefix — list to find it, show to inspect it.
|
|
121
|
+
|
|
122
|
+
### Importing tool data
|
|
123
|
+
|
|
124
|
+
`loobric import` reads a vendor export, detects the format, and creates catalog
|
|
125
|
+
records on the server. Use `--dry-run` to see exactly what would be created
|
|
126
|
+
without sending anything:
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
loobric import tools.csv --dry-run # DIN 4000 CSV — preview only
|
|
130
|
+
loobric import tools.xml # DIN 4000 / SolidCAM / hyperMILL (by XML root)
|
|
131
|
+
loobric import catalog.p21 # STEP P21
|
|
132
|
+
loobric import package.zip # GTC package (ISO 13399) + 3D models & images
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Re-importing the same catalog is detected by natural key and reported as
|
|
136
|
+
*skipped*, never duplicated.
|
|
137
|
+
|
|
138
|
+
## License
|
|
139
|
+
|
|
140
|
+
MIT. (The server, Loobric Core, is AGPL-3.0; this client is MIT so it can be
|
|
141
|
+
freely vendored and reused.)
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# loobric-cli
|
|
2
|
+
|
|
3
|
+
Python client for [Loobric Core](https://github.com/loobric/loobric-core) — the
|
|
4
|
+
library and CLI for synchronizing CNC tool data. It speaks only the public REST
|
|
5
|
+
API and depends on nothing from the server.
|
|
6
|
+
|
|
7
|
+
> **New in v0.4.0 — a seed script + a public sandbox.**
|
|
8
|
+
> [`examples/quickstart.sh`](examples/quickstart.sh) is a readable list of plain
|
|
9
|
+
> `loobric` commands that seeds an account with a small demo catalog (two
|
|
10
|
+
> manufacturers) and walks the whole loop — machine → catalog → instance → tool
|
|
11
|
+
> set → tool-table push. Run it to give a fresh account something to explore;
|
|
12
|
+
> read it to learn how to script the CLI. Point it at the free hosted sandbox and
|
|
13
|
+
> kick the tires without installing a server. See [docs/SANDBOX.md](docs/SANDBOX.md).
|
|
14
|
+
>
|
|
15
|
+
> **New in v0.3.0 — full list/show symmetry.** Every listable entity now has a
|
|
16
|
+
> matching `show` verb: `show-machine`, `show-tool`, and `show-key` join the
|
|
17
|
+
> existing `show-*` commands, each resolving its target by id, name, or unique
|
|
18
|
+
> prefix. List to find it, show to inspect it — one consistent pattern everywhere.
|
|
19
|
+
>
|
|
20
|
+
> **`loobric import` — stop re-typing tool data.** One command auto-detects the
|
|
21
|
+
> format and turns a vendor export into catalog records on your server:
|
|
22
|
+
> **DIN 4000** (CSV + XML 2013/2016), **STEP P21**, **GTC packages** (ISO 13399),
|
|
23
|
+
> **SolidCAM**, and **hyperMILL**. Every imported field keeps its source, and the
|
|
24
|
+
> raw payload is preserved verbatim so nothing is lost or guessed. GTC packages
|
|
25
|
+
> also carry the tool's 3D STEP models and images, uploaded as canonical media on
|
|
26
|
+
> servers whose media backend is enabled. See
|
|
27
|
+
> [docs/IMPORTERS_PLAN.md](docs/IMPORTERS_PLAN.md).
|
|
28
|
+
>
|
|
29
|
+
> The importable library (`loobric.Client`) and the `loobric` CLI are both
|
|
30
|
+
> here, ported from the old single-file `loobric.py` — see
|
|
31
|
+
> [docs/adr/0001-extract-loobric-cli.md](docs/adr/0001-extract-loobric-cli.md).
|
|
32
|
+
|
|
33
|
+
## Install
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
pip install loobric-cli # library + CLI + every bundled importer — stdlib only, no deps
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Everything ships in the base install. The library, the `loobric` CLI, and all of
|
|
40
|
+
today's importers (DIN 4000, STEP P21, GTC, SolidCAM, hyperMILL) are
|
|
41
|
+
standard-library only, so the package stays vendorable and runs in constrained
|
|
42
|
+
interpreters. The optional `[importers]` extra is reserved for future formats
|
|
43
|
+
that need heavier parsers; no bundled importer requires it yet.
|
|
44
|
+
|
|
45
|
+
## Try the sandbox
|
|
46
|
+
|
|
47
|
+
Don't want to run a server yet? Point the client at the free hosted **sandbox**
|
|
48
|
+
and explore against live data:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
pip install loobric-cli
|
|
52
|
+
export LOOBRIC_BASE_URL=https://api.loobric.com
|
|
53
|
+
loobric register you@example.com # create an account
|
|
54
|
+
loobric login you@example.com # then mint a key (below)
|
|
55
|
+
loobric create-key sandbox --scopes "read write"
|
|
56
|
+
export LOOBRIC_API_KEY=<the key it prints> # the CLI reads this automatically
|
|
57
|
+
curl -O https://raw.githubusercontent.com/loobric/loobric-cli/master/examples/quickstart.sh
|
|
58
|
+
bash quickstart.sh # seed a demo and walk the loop
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
The sandbox is a shared demo server — **data may be reset and accounts removed,
|
|
62
|
+
so keep nothing real there.** Full walkthrough (and why API keys, not sessions):
|
|
63
|
+
[docs/SANDBOX.md](docs/SANDBOX.md).
|
|
64
|
+
|
|
65
|
+
## Library
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
from loobric import Client, NotFound
|
|
69
|
+
|
|
70
|
+
c = Client(base_url="http://nas:8000", api_key="...") # solo mode: omit api_key
|
|
71
|
+
for s in c.list_tool_sets():
|
|
72
|
+
print(s)
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Every method returns parsed data and raises a `LoobricClientError` subclass
|
|
76
|
+
(`NotFound`, `AuthRequired`, `HTTPError`, `ConnectionFailed`) on failure — it
|
|
77
|
+
never prints or exits, so callers handle failure themselves.
|
|
78
|
+
|
|
79
|
+
## CLI
|
|
80
|
+
|
|
81
|
+
`loobric <verb>` is the universal command-line client (the role the old `loobric`
|
|
82
|
+
command served). See the [CLI reference and walkthrough](docs/CLI.md).
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
loobric --help
|
|
86
|
+
loobric list-machines
|
|
87
|
+
loobric show-machine mill01 # by name, id, or unique prefix
|
|
88
|
+
loobric create-record --from-catalog B201 --name "1/4 downcut"
|
|
89
|
+
loobric show-tool "1/4 downcut" # one instance, full provenance
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Every `list-*` verb has a matching `show-*` verb (`show-machine`, `show-tool`,
|
|
93
|
+
`show-tool-set`, `show-key`, …), each resolving its target by id, name, or
|
|
94
|
+
unique prefix — list to find it, show to inspect it.
|
|
95
|
+
|
|
96
|
+
### Importing tool data
|
|
97
|
+
|
|
98
|
+
`loobric import` reads a vendor export, detects the format, and creates catalog
|
|
99
|
+
records on the server. Use `--dry-run` to see exactly what would be created
|
|
100
|
+
without sending anything:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
loobric import tools.csv --dry-run # DIN 4000 CSV — preview only
|
|
104
|
+
loobric import tools.xml # DIN 4000 / SolidCAM / hyperMILL (by XML root)
|
|
105
|
+
loobric import catalog.p21 # STEP P21
|
|
106
|
+
loobric import package.zip # GTC package (ISO 13399) + 3D models & images
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Re-importing the same catalog is detected by natural key and reported as
|
|
110
|
+
*skipped*, never duplicated.
|
|
111
|
+
|
|
112
|
+
## License
|
|
113
|
+
|
|
114
|
+
MIT. (The server, Loobric Core, is AGPL-3.0; this client is MIT so it can be
|
|
115
|
+
freely vendored and reused.)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# MIT License
|
|
2
|
+
# Copyright (c) 2025 sliptonic
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
"""Loobric client — importable Python library for the Loobric Core API.
|
|
5
|
+
|
|
6
|
+
Speaks only the public REST API and depends on nothing from the server, so a
|
|
7
|
+
client (FreeCAD, future Fusion, scripts) can `pip install loobric-cli` and
|
|
8
|
+
reuse this rather than writing its own HTTP layer.
|
|
9
|
+
"""
|
|
10
|
+
from loobric.client import Client
|
|
11
|
+
from loobric.errors import (
|
|
12
|
+
AuthRequired,
|
|
13
|
+
ConnectionFailed,
|
|
14
|
+
HTTPError,
|
|
15
|
+
NotFound,
|
|
16
|
+
LoobricClientError,
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
__all__ = [
|
|
20
|
+
"Client",
|
|
21
|
+
"LoobricClientError",
|
|
22
|
+
"ConnectionFailed",
|
|
23
|
+
"HTTPError",
|
|
24
|
+
"NotFound",
|
|
25
|
+
"AuthRequired",
|
|
26
|
+
]
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# MIT License
|
|
2
|
+
# Copyright (c) 2025 sliptonic
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
"""Loobric client CLI package. Entry point: ``loobric.cli.main:main``.
|
|
5
|
+
|
|
6
|
+
Intentionally does not import ``main`` here — that would shadow the ``main``
|
|
7
|
+
submodule (a function and a module sharing the name on the package).
|
|
8
|
+
"""
|