virtualshell 1.0.0__tar.gz → 1.0.2__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.
- {virtualshell-1.0.0 → virtualshell-1.0.2}/PKG-INFO +23 -15
- {virtualshell-1.0.0 → virtualshell-1.0.2}/README.md +22 -14
- {virtualshell-1.0.0 → virtualshell-1.0.2}/cpp/include/virtual_shell.hpp +1 -1
- {virtualshell-1.0.0 → virtualshell-1.0.2}/cpp/src/binder.cpp +1 -1
- {virtualshell-1.0.0 → virtualshell-1.0.2}/demo.py +9 -11
- {virtualshell-1.0.0 → virtualshell-1.0.2}/pyproject.toml +1 -1
- {virtualshell-1.0.0 → virtualshell-1.0.2}/src/virtualshell/__init__.py +1 -1
- virtualshell-1.0.2/src/virtualshell/_version.py +1 -0
- {virtualshell-1.0.0 → virtualshell-1.0.2}/src/virtualshell/shell.py +3 -3
- virtualshell-1.0.0/src/virtualshell/_version.py +0 -1
- {virtualshell-1.0.0 → virtualshell-1.0.2}/.github/workflows/workflow.yml +0 -0
- {virtualshell-1.0.0 → virtualshell-1.0.2}/.gitignore +0 -0
- {virtualshell-1.0.0 → virtualshell-1.0.2}/CMakeLists.txt +0 -0
- {virtualshell-1.0.0 → virtualshell-1.0.2}/LICENSE +0 -0
- {virtualshell-1.0.0 → virtualshell-1.0.2}/cpp/src/virtual_shell.cpp +0 -0
- {virtualshell-1.0.0 → virtualshell-1.0.2}/src/virtualshell/errors.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: virtualshell
|
3
|
-
Version: 1.0.
|
3
|
+
Version: 1.0.2
|
4
4
|
Summary: High-performance PowerShell bridge (C++ pybind11 backend)
|
5
5
|
Keywords: powershell,automation,shell,cpp,pybind11
|
6
6
|
Author: Kim-Andre Myrvold
|
@@ -217,7 +217,6 @@ Project-URL: Issues, https://github.com/Chamoswor/virtualshell/issues
|
|
217
217
|
Requires-Python: >=3.8
|
218
218
|
Description-Content-Type: text/markdown
|
219
219
|
|
220
|
-
````markdown
|
221
220
|
# virtualshell
|
222
221
|
|
223
222
|
High-performance Python façade over a **C++ PowerShell runner**.
|
@@ -241,12 +240,22 @@ A single long-lived PowerShell process is managed in C++, handling pipes, thread
|
|
241
240
|
pip install virtualshell
|
242
241
|
````
|
243
242
|
|
244
|
-
|
243
|
+
## Platform & Python Support
|
244
|
+
|
245
|
+
Prebuilt wheels are provided via PyPI for common platforms and Python versions.
|
246
|
+
This means you can usually `pip install virtualshell` without needing a compiler.
|
247
|
+
|
248
|
+
**Supported Python versions:**
|
249
|
+
- 3.8, 3.9, 3.10, 3.11, 3.12, 3.13
|
250
|
+
|
251
|
+
**Supported platforms:**
|
252
|
+
- **Windows** (x86_64, MSVC build)
|
253
|
+
- **Linux** (x86_64, aarch64, manylinux2014/2.28)
|
254
|
+
- **macOS** (universal2: x86_64 + arm64)
|
255
|
+
|
256
|
+
If your platform is not listed above, pip will fall back to building from source.
|
257
|
+
See [Building from source](#building-from-source-advanced) for details.
|
245
258
|
|
246
|
-
* **Windows 10/11 x64**
|
247
|
-
* **Linux**: x86_64 and aarch64 (manylinux_2_28 / glibc ≥ 2.28)
|
248
|
-
* **macOS**: 12+ (x86_64 and arm64)
|
249
|
-
* **Python**: 3.8 – 3.13
|
250
259
|
|
251
260
|
> Requires PowerShell on `PATH` (`pwsh` preferred, `powershell` also supported).
|
252
261
|
|
@@ -334,8 +343,8 @@ By default you get a Python dataclass:
|
|
334
343
|
```python
|
335
344
|
@dataclass(frozen=True)
|
336
345
|
class ExecutionResult:
|
337
|
-
|
338
|
-
|
346
|
+
out: str
|
347
|
+
err: str
|
339
348
|
exit_code: int
|
340
349
|
success: bool
|
341
350
|
execution_time: float
|
@@ -346,7 +355,7 @@ Pass `as_dataclass=False` to receive the raw C++ result object.
|
|
346
355
|
### Timeouts
|
347
356
|
|
348
357
|
* Every method accepts a `timeout` (or `per_command_timeout`) in seconds.
|
349
|
-
* On timeout: `success=False`, `exit_code=-1`, `
|
358
|
+
* On timeout: `success=False`, `exit_code=-1`, `err` contains `"timeout"`.
|
350
359
|
* Async futures resolve with the timeout result; late output is dropped in C++.
|
351
360
|
|
352
361
|
---
|
@@ -419,9 +428,8 @@ Shell(initial_commands=[
|
|
419
428
|
|
420
429
|
---
|
421
430
|
|
422
|
-
|
423
|
-
|
424
|
-
You normally won’t need this when using wheels.
|
431
|
+
# Building from source (advanced)
|
432
|
+
Source builds require a C++ toolchain and CMake.
|
425
433
|
|
426
434
|
**Prereqs:** Python ≥3.8, C++17, CMake ≥3.20, `scikit-build-core`, `pybind11`.
|
427
435
|
|
@@ -439,7 +447,7 @@ python -m pip install -e .
|
|
439
447
|
```
|
440
448
|
|
441
449
|
* Linux wheels target **manylinux_2_28** (x86_64/aarch64).
|
442
|
-
* macOS builds target **
|
450
|
+
* macOS builds target **universal2** (x86_64 + arm64).
|
443
451
|
|
444
452
|
---
|
445
453
|
|
@@ -458,4 +466,4 @@ Apache 2.0 — see [LICENSE](LICENSE).
|
|
458
466
|
|
459
467
|
---
|
460
468
|
|
461
|
-
*Issues & feedback are welcome. Please include Python version, OS, your PowerShell path (`pwsh`/`powershell`), and a minimal repro.*
|
469
|
+
*Issues & feedback are welcome. Please include Python version, OS, your PowerShell path (`pwsh`/`powershell`), and a minimal repro.*
|
@@ -1,4 +1,3 @@
|
|
1
|
-
````markdown
|
2
1
|
# virtualshell
|
3
2
|
|
4
3
|
High-performance Python façade over a **C++ PowerShell runner**.
|
@@ -22,12 +21,22 @@ A single long-lived PowerShell process is managed in C++, handling pipes, thread
|
|
22
21
|
pip install virtualshell
|
23
22
|
````
|
24
23
|
|
25
|
-
|
24
|
+
## Platform & Python Support
|
25
|
+
|
26
|
+
Prebuilt wheels are provided via PyPI for common platforms and Python versions.
|
27
|
+
This means you can usually `pip install virtualshell` without needing a compiler.
|
28
|
+
|
29
|
+
**Supported Python versions:**
|
30
|
+
- 3.8, 3.9, 3.10, 3.11, 3.12, 3.13
|
31
|
+
|
32
|
+
**Supported platforms:**
|
33
|
+
- **Windows** (x86_64, MSVC build)
|
34
|
+
- **Linux** (x86_64, aarch64, manylinux2014/2.28)
|
35
|
+
- **macOS** (universal2: x86_64 + arm64)
|
36
|
+
|
37
|
+
If your platform is not listed above, pip will fall back to building from source.
|
38
|
+
See [Building from source](#building-from-source-advanced) for details.
|
26
39
|
|
27
|
-
* **Windows 10/11 x64**
|
28
|
-
* **Linux**: x86_64 and aarch64 (manylinux_2_28 / glibc ≥ 2.28)
|
29
|
-
* **macOS**: 12+ (x86_64 and arm64)
|
30
|
-
* **Python**: 3.8 – 3.13
|
31
40
|
|
32
41
|
> Requires PowerShell on `PATH` (`pwsh` preferred, `powershell` also supported).
|
33
42
|
|
@@ -115,8 +124,8 @@ By default you get a Python dataclass:
|
|
115
124
|
```python
|
116
125
|
@dataclass(frozen=True)
|
117
126
|
class ExecutionResult:
|
118
|
-
|
119
|
-
|
127
|
+
out: str
|
128
|
+
err: str
|
120
129
|
exit_code: int
|
121
130
|
success: bool
|
122
131
|
execution_time: float
|
@@ -127,7 +136,7 @@ Pass `as_dataclass=False` to receive the raw C++ result object.
|
|
127
136
|
### Timeouts
|
128
137
|
|
129
138
|
* Every method accepts a `timeout` (or `per_command_timeout`) in seconds.
|
130
|
-
* On timeout: `success=False`, `exit_code=-1`, `
|
139
|
+
* On timeout: `success=False`, `exit_code=-1`, `err` contains `"timeout"`.
|
131
140
|
* Async futures resolve with the timeout result; late output is dropped in C++.
|
132
141
|
|
133
142
|
---
|
@@ -200,9 +209,8 @@ Shell(initial_commands=[
|
|
200
209
|
|
201
210
|
---
|
202
211
|
|
203
|
-
|
204
|
-
|
205
|
-
You normally won’t need this when using wheels.
|
212
|
+
# Building from source (advanced)
|
213
|
+
Source builds require a C++ toolchain and CMake.
|
206
214
|
|
207
215
|
**Prereqs:** Python ≥3.8, C++17, CMake ≥3.20, `scikit-build-core`, `pybind11`.
|
208
216
|
|
@@ -220,7 +228,7 @@ python -m pip install -e .
|
|
220
228
|
```
|
221
229
|
|
222
230
|
* Linux wheels target **manylinux_2_28** (x86_64/aarch64).
|
223
|
-
* macOS builds target **
|
231
|
+
* macOS builds target **universal2** (x86_64 + arm64).
|
224
232
|
|
225
233
|
---
|
226
234
|
|
@@ -239,4 +247,4 @@ Apache 2.0 — see [LICENSE](LICENSE).
|
|
239
247
|
|
240
248
|
---
|
241
249
|
|
242
|
-
*Issues & feedback are welcome. Please include Python version, OS, your PowerShell path (`pwsh`/`powershell`), and a minimal repro.*
|
250
|
+
*Issues & feedback are welcome. Please include Python version, OS, your PowerShell path (`pwsh`/`powershell`), and a minimal repro.*
|
@@ -94,7 +94,7 @@ public:
|
|
94
94
|
* @brief Configuration for the PowerShell process.
|
95
95
|
*/
|
96
96
|
struct Config {
|
97
|
-
std::string powershellPath = "pwsh
|
97
|
+
std::string powershellPath = "pwsh"; ///< Path to the PowerShell executable
|
98
98
|
std::string workingDirectory = ""; ///< Working directory (empty = current directory)
|
99
99
|
bool captureOutput = true; ///< Capture stdout
|
100
100
|
bool captureError = true; ///< Capture stderr
|
@@ -10,11 +10,10 @@ def example_concurrent_work():
|
|
10
10
|
"""
|
11
11
|
print("=== Concurrent Work Example ===")
|
12
12
|
|
13
|
-
with Shell() as sh:
|
14
|
-
|
15
|
-
print("Setting up PowerShell function
|
16
|
-
sh.run("function
|
17
|
-
sh.run("$global:i = 0")
|
13
|
+
with Shell(timeout_seconds=30) as sh:
|
14
|
+
|
15
|
+
print("Setting up PowerShell function...")
|
16
|
+
sh.run("function SayHey { Start-Sleep -Milliseconds 10000; echo 'Hey from PowerShell!' }")
|
18
17
|
|
19
18
|
# Results storage
|
20
19
|
async_results = []
|
@@ -26,9 +25,8 @@ def example_concurrent_work():
|
|
26
25
|
async_results.append(r.out.strip())
|
27
26
|
|
28
27
|
# Start a long-running PowerShell command asynchronously
|
29
|
-
print("Starting async PowerShell execution
|
30
|
-
|
31
|
-
future = sh.run_async(to_run, callback=async_callback)
|
28
|
+
print("Starting async PowerShell execution")
|
29
|
+
future = sh.run_async("SayHey", callback=async_callback)
|
32
30
|
|
33
31
|
print("Now doing other work while PowerShell runs in background..., max 50 iterations")
|
34
32
|
|
@@ -53,8 +51,8 @@ def example_concurrent_work():
|
|
53
51
|
# Wait for async to complete if it hasn't already
|
54
52
|
if not future.done():
|
55
53
|
print("Waiting for PowerShell to finish...")
|
56
|
-
future.result()
|
57
|
-
|
54
|
+
future.result() # This will block until poweshell finnishes the Job
|
55
|
+
|
58
56
|
elapsed = time.time() - start_time
|
59
57
|
|
60
58
|
print(f"\n=== Results ===")
|
@@ -144,7 +142,7 @@ def example_progress_monitoring():
|
|
144
142
|
- isComplete: True when the batch has finished
|
145
143
|
- allResults: List of all ExecutionResults (filled at completion)
|
146
144
|
"""
|
147
|
-
msg = f"Progress: {progress.currentCommand}/{progress.totalCommands} - Last: {progress.lastResult.
|
145
|
+
msg = f"Progress: {progress.currentCommand}/{progress.totalCommands} - Last: {progress.lastResult.out.strip()}"
|
148
146
|
progress_updates.append(msg)
|
149
147
|
print(f" {msg}")
|
150
148
|
|
@@ -9,7 +9,7 @@ build-backend = "scikit_build_core.build"
|
|
9
9
|
[project]
|
10
10
|
name = "virtualshell"
|
11
11
|
description = "High-performance PowerShell bridge (C++ pybind11 backend)"
|
12
|
-
version = "1.0.
|
12
|
+
version = "1.0.2"
|
13
13
|
readme = "README.md"
|
14
14
|
license = { file = "LICENSE" }
|
15
15
|
authors = [{ name = "Kim-Andre Myrvold" }]
|
@@ -0,0 +1 @@
|
|
1
|
+
version = "1.0.2"
|
@@ -116,7 +116,7 @@ def _raise_on_failure(
|
|
116
116
|
"""
|
117
117
|
if res.success:
|
118
118
|
return
|
119
|
-
err = (res.
|
119
|
+
err = (res.err or "")
|
120
120
|
if res.exit_code == -1 and "timeout" in err.lower():
|
121
121
|
raise ExecutionTimeoutError(f"{label} timed out after {timeout_used}s")
|
122
122
|
if raise_on_error:
|
@@ -168,8 +168,8 @@ class ExecutionResult:
|
|
168
168
|
def from_cpp(cls, r: _CPP_ExecResult) -> "ExecutionResult":
|
169
169
|
# Attribute access is defensive to tolerate ABI field name differences.
|
170
170
|
return cls(
|
171
|
-
out=getattr(r, "
|
172
|
-
err=getattr(r, "
|
171
|
+
out=getattr(r, "out", ""),
|
172
|
+
err=getattr(r, "err", ""),
|
173
173
|
exit_code=int(getattr(r, "exit_code", getattr(r, "exitCode", -1))),
|
174
174
|
success=bool(getattr(r, "success", False)),
|
175
175
|
execution_time=float(getattr(r, "execution_time", getattr(r, "executionTime", 0.0))),
|
@@ -1 +0,0 @@
|
|
1
|
-
version = "0.1.2"
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|