clapshim 0.1.0__py3-none-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
Binary file
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: clapshim
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Classifier: Development Status :: 4 - Beta
|
|
5
|
+
Classifier: Intended Audience :: Developers
|
|
6
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
7
|
+
Classifier: Programming Language :: Rust
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
11
|
+
Classifier: Topic :: Utilities
|
|
12
|
+
Requires-Dist: clinspector>=2.2.0
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Summary: Instant native Rust clap frontend & shell-completion shim for any Python CLI (powered by clinspector)
|
|
15
|
+
Keywords: cli,clap,python,shim,completions,clinspector
|
|
16
|
+
Author-email: Philipp Temminghoff <philipptemminghoff@gmail.com>
|
|
17
|
+
License: MIT
|
|
18
|
+
Requires-Python: >=3.14
|
|
19
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
20
|
+
Project-URL: Homepage, https://github.com/phil65/clapshim
|
|
21
|
+
Project-URL: Issues, https://github.com/phil65/clapshim/issues
|
|
22
|
+
Project-URL: Repository, https://github.com/phil65/clapshim
|
|
23
|
+
|
|
24
|
+
# `clapshim`
|
|
25
|
+
|
|
26
|
+
Instant native Rust [`clap`](https://docs.rs/clap) frontend, argument validator, and shell-completion
|
|
27
|
+
shim for **any Python CLI** (Typer, Click, Cleo, Cappa, Cyclopts, argparse), powered by
|
|
28
|
+
[`clinspector`](https://github.com/phil65/clinspector).
|
|
29
|
+
|
|
30
|
+
## Why?
|
|
31
|
+
|
|
32
|
+
Python CLIs often take **300–800 ms** just to print `--help`, reject a typo'd flag, or answer a
|
|
33
|
+
`<Tab>` shell completion — because the entrypoint eagerly imports the whole app before parsing args.
|
|
34
|
+
|
|
35
|
+
`clapshim` introspects an installed Python CLI once via `clinspector` into a tiny JSON manifest and
|
|
36
|
+
installs a BusyBox-style multicall symlink to a single prebuilt native Rust binary:
|
|
37
|
+
|
|
38
|
+
- **`--help`, `--version`, validation errors, and shell completions**: served natively by Rust `clap`
|
|
39
|
+
in **~2–4 ms** — Python never starts.
|
|
40
|
+
- **Hybrid command dispatch**:
|
|
41
|
+
- **Direct lazy dispatch**: eligible leaf commands (`str`/`int`/`float`/`bool`/`Path`/`Enum`) call
|
|
42
|
+
`module.func(**kwargs)` directly, skipping Click/Typer/Rich entirely.
|
|
43
|
+
- **Lossless pass-through**: commands with Click `Context`, group callbacks, option callbacks, or
|
|
44
|
+
custom `ParamType`s automatically `execvp()` the original Python entrypoint verbatim.
|
|
45
|
+
- **Zero stale-help bugs in dev**: checks `mtime` of watched CLI source files (~50 µs) and falls
|
|
46
|
+
back to Python automatically if you edited a command.
|
|
47
|
+
- **Optional standalone Rust codegen**: `clapshim compile` emits a single-binary Cargo crate with
|
|
48
|
+
the manifest embedded via `include_str!`.
|
|
49
|
+
|
|
50
|
+
## Usage
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
# Wrap any installed Python CLI in your current venv / PATH (falls back to --help parsing if opaque)
|
|
54
|
+
clapshim wrap mknodes
|
|
55
|
+
clapshim wrap my-opaque-script --from-help
|
|
56
|
+
|
|
57
|
+
# Instant native --help (~2 ms, zero Python!)
|
|
58
|
+
mknodes --help
|
|
59
|
+
mknodes build --help
|
|
60
|
+
|
|
61
|
+
# Native static or ~2 ms dynamic shell completions (bash, zsh, fish, powershell, elvish)
|
|
62
|
+
clapshim completions mknodes zsh --install
|
|
63
|
+
clapshim completions mknodes zsh --dynamic
|
|
64
|
+
|
|
65
|
+
# Inspect wrapped commands, dispatch reasons, health, and live speedup
|
|
66
|
+
clapshim list --verbose
|
|
67
|
+
clapshim doctor
|
|
68
|
+
clapshim bench mknodes
|
|
69
|
+
|
|
70
|
+
# Refresh manifests after upgrading or editing a CLI
|
|
71
|
+
clapshim refresh --all
|
|
72
|
+
|
|
73
|
+
# Restore the original Python console script cleanly
|
|
74
|
+
clapshim unwrap mknodes
|
|
75
|
+
|
|
76
|
+
# Emit (and optionally build) a standalone single-binary Rust shim
|
|
77
|
+
clapshim compile mknodes --out ./mknodes-shim --build
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Environment Variables
|
|
81
|
+
|
|
82
|
+
- `CLAPSHIM_AUTO_REFRESH=1`: asynchronously refresh stale manifests in the background after falling back to Python.
|
|
83
|
+
- `CLAPSHIM_PASSTHROUGH=1`: force pass-through to the original Python entrypoint.
|
|
84
|
+
- `CLAPSHIM_NO_STALE_CHECK=1`: skip watched-file `mtime` checks.
|
|
85
|
+
- `CLAPSHIM_DEBUG=1`: log fallback reasons to stderr.
|
|
86
|
+
|
|
87
|
+
## Development
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
mbx fmt --all --check
|
|
91
|
+
mbx clippy --all-targets -- -D warnings
|
|
92
|
+
mbx test
|
|
93
|
+
```
|
|
94
|
+
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
clapshim-0.1.0.data/scripts/clapshim.exe,sha256=trrDJe-4dLgbfukSWz_tbGrGbBzIwtDCoZm5gMIYo0k,1813504
|
|
2
|
+
clapshim-0.1.0.dist-info/METADATA,sha256=dsQSz1plXgua3vi8pXol3CcX6XkXHmXnAX_BOdjMeq8,3857
|
|
3
|
+
clapshim-0.1.0.dist-info/WHEEL,sha256=Uvw7WSmy7Kj2FBk8Va4L_dq4MDW8X5Ynby-pOX3ZNS0,94
|
|
4
|
+
clapshim-0.1.0.dist-info/licenses/LICENSE,sha256=Phxi44UILiQqri4oJe8Wr7S0ulLaVhtJLk-KONLjSLQ,1097
|
|
5
|
+
clapshim-0.1.0.dist-info/sboms/clapshim.cyclonedx.json,sha256=QOlFkeBOH0ZRq7sKawM8OWvJuO3avhm0JeeGnwtVfvU,40237
|
|
6
|
+
clapshim-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Philipp Temminghoff
|
|
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.
|