virtualshell 1.1.5__tar.gz → 1.2.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.
Files changed (94) hide show
  1. virtualshell-1.2.0/.github/workflows/test_build-only.yml +257 -0
  2. {virtualshell-1.1.5 → virtualshell-1.2.0}/.github/workflows/workflow.yml +49 -42
  3. {virtualshell-1.1.5 → virtualshell-1.2.0}/.gitignore +5 -1
  4. virtualshell-1.2.0/CMakeLists.txt +110 -0
  5. virtualshell-1.2.0/CMakeSettings.json +15 -0
  6. {virtualshell-1.1.5 → virtualshell-1.2.0}/PKG-INFO +153 -159
  7. virtualshell-1.2.0/README.md +248 -0
  8. virtualshell-1.2.0/bench/bench.csv +4 -0
  9. virtualshell-1.2.0/bench/bench.json +440 -0
  10. {virtualshell-1.1.5 → virtualshell-1.2.0}/bench/vs_bench.py +3 -6
  11. virtualshell-1.2.0/bench/zcb_bench.json +69 -0
  12. virtualshell-1.2.0/bench/zcb_bench.py +153 -0
  13. {virtualshell-1.1.5 → virtualshell-1.2.0}/cpp/include/cmd_state.hpp +1 -0
  14. {virtualshell-1.1.5 → virtualshell-1.2.0}/cpp/include/helpers.hpp +34 -6
  15. {virtualshell-1.1.5 → virtualshell-1.2.0}/cpp/include/virtual_shell.hpp +4 -4
  16. {virtualshell-1.1.5 → virtualshell-1.2.0}/cpp/src/binder.cpp +103 -115
  17. {virtualshell-1.1.5 → virtualshell-1.2.0}/cpp/src/powershell_process.cpp +64 -2
  18. {virtualshell-1.1.5 → virtualshell-1.2.0}/cpp/src/virtual_shell.cpp +44 -23
  19. virtualshell-1.2.0/cpp/tests/CMakeLists.txt +26 -0
  20. virtualshell-1.2.0/cpp/tests/test_framework.hpp +116 -0
  21. virtualshell-1.2.0/cpp/tests/test_helpers.cpp +126 -0
  22. virtualshell-1.2.0/cpp/tests/test_main.cpp +5 -0
  23. virtualshell-1.2.0/cpp/tests/test_virtual_shell.cpp +271 -0
  24. {virtualshell-1.1.5 → virtualshell-1.2.0}/pyproject.toml +15 -6
  25. {virtualshell-1.1.5 → virtualshell-1.2.0}/src/virtualshell/__init__.py +44 -44
  26. virtualshell-1.2.0/src/virtualshell/_bootstrap.py +23 -0
  27. virtualshell-1.2.0/src/virtualshell/_module.py +27 -0
  28. virtualshell-1.2.0/src/virtualshell/_protocols.py +214 -0
  29. virtualshell-1.2.0/src/virtualshell/_version.py +1 -0
  30. {virtualshell-1.1.5 → virtualshell-1.2.0}/src/virtualshell/generate_psobject.py +212 -153
  31. virtualshell-1.2.0/src/virtualshell/ps_object.py +543 -0
  32. virtualshell-1.2.0/src/virtualshell/ps_proxy.py +784 -0
  33. {virtualshell-1.1.5 → virtualshell-1.2.0}/src/virtualshell/shell.py +91 -71
  34. virtualshell-1.2.0/src/virtualshell/zero_copy_bridge.ps1 +259 -0
  35. virtualshell-1.2.0/src/virtualshell/zero_copy_bridge_shell.py +495 -0
  36. virtualshell-1.2.0/tests/conftest.py +231 -0
  37. virtualshell-1.2.0/tests/test_generate_psobject.py +369 -0
  38. virtualshell-1.2.0/tests/test_integration.py +175 -0
  39. virtualshell-1.2.0/tests/test_ps_proxy_integration.py +307 -0
  40. virtualshell-1.2.0/tests/test_ps_proxy_unit.py +160 -0
  41. virtualshell-1.2.0/tests/test_psobject_unit.py +155 -0
  42. virtualshell-1.2.0/tests/test_shell_unit.py +342 -0
  43. virtualshell-1.2.0/tests/test_utils_unit.py +113 -0
  44. virtualshell-1.2.0/tests/test_zcb_channel_unit.py +206 -0
  45. virtualshell-1.2.0/tests/test_zcb_integration.py +170 -0
  46. virtualshell-1.2.0/wiki/Project/Benchmarks.md +83 -0
  47. {virtualshell-1.1.5 → virtualshell-1.2.0}/wiki/Usage/API Overview.md +2 -1
  48. {virtualshell-1.1.5 → virtualshell-1.2.0}/wiki/Usage/Zero-Copy Bridge.md +23 -9
  49. {virtualshell-1.1.5 → virtualshell-1.2.0}/wiki/Usage/generate_psobject.md +9 -5
  50. virtualshell-1.2.0/wiki/Usage/make_proxy.md +163 -0
  51. virtualshell-1.1.5/CMakeLists.txt +0 -76
  52. virtualshell-1.1.5/README.md +0 -259
  53. virtualshell-1.1.5/bench/bench.csv +0 -4
  54. virtualshell-1.1.5/bench/bench.json +0 -435
  55. virtualshell-1.1.5/cpp/include/py_proxy.hpp +0 -76
  56. virtualshell-1.1.5/cpp/src/py_proxy.cpp +0 -1288
  57. virtualshell-1.1.5/src/virtualshell/_version.py +0 -1
  58. virtualshell-1.1.5/src/virtualshell/win_pwsh.dll +0 -0
  59. virtualshell-1.1.5/src/virtualshell/zero_copy_bridge.ps1 +0 -584
  60. virtualshell-1.1.5/src/virtualshell/zero_copy_bridge_shell.py +0 -1083
  61. virtualshell-1.1.5/wiki/Project/Benchmarks.md +0 -65
  62. virtualshell-1.1.5/wiki/Usage/make_proxy.md +0 -124
  63. virtualshell-1.1.5/win_pwsh_dll/CMakeLists.txt +0 -79
  64. virtualshell-1.1.5/win_pwsh_dll/include/vs_shm.h +0 -237
  65. virtualshell-1.1.5/win_pwsh_dll/src/object_serializer.cpp +0 -213
  66. virtualshell-1.1.5/win_pwsh_dll/src/vs_shm.cpp +0 -514
  67. {virtualshell-1.1.5 → virtualshell-1.2.0}/LICENSE +0 -0
  68. {virtualshell-1.1.5 → virtualshell-1.2.0}/cpp/include/config.hpp +0 -0
  69. {virtualshell-1.1.5 → virtualshell-1.2.0}/cpp/include/dev_debug.hpp +0 -0
  70. {virtualshell-1.1.5 → virtualshell-1.2.0}/cpp/include/execution_result.hpp +0 -0
  71. {virtualshell-1.1.5 → virtualshell-1.2.0}/cpp/include/io_pump.hpp +0 -0
  72. {virtualshell-1.1.5 → virtualshell-1.2.0}/cpp/include/powershell_process.hpp +0 -0
  73. {virtualshell-1.1.5 → virtualshell-1.2.0}/cpp/include/process.hpp +0 -0
  74. {virtualshell-1.1.5 → virtualshell-1.2.0}/cpp/include/py_bridge.hpp +0 -0
  75. {virtualshell-1.1.5 → virtualshell-1.2.0}/cpp/include/timeout_watcher.hpp +0 -0
  76. {virtualshell-1.1.5 → virtualshell-1.2.0}/cpp/src/io_pump.cpp +0 -0
  77. {virtualshell-1.1.5 → virtualshell-1.2.0}/src/virtualshell/errors.py +0 -0
  78. {virtualshell-1.1.5 → virtualshell-1.2.0}/src/virtualshell/get-session.ps1 +0 -0
  79. {virtualshell-1.1.5 → virtualshell-1.2.0}/src/virtualshell/save-session.ps1 +0 -0
  80. {virtualshell-1.1.5 → virtualshell-1.2.0}/wiki/Getting started/Getting started.md +0 -0
  81. {virtualshell-1.1.5 → virtualshell-1.2.0}/wiki/Getting started/Installation.md +0 -0
  82. {virtualshell-1.1.5 → virtualshell-1.2.0}/wiki/Getting started/Quickstart.md +0 -0
  83. {virtualshell-1.1.5 → virtualshell-1.2.0}/wiki/Help/FAQ.md +0 -0
  84. {virtualshell-1.1.5 → virtualshell-1.2.0}/wiki/Help/Troubleshooting.md +0 -0
  85. {virtualshell-1.1.5 → virtualshell-1.2.0}/wiki/Home.md +0 -0
  86. {virtualshell-1.1.5 → virtualshell-1.2.0}/wiki/Project/Changelog.md +0 -0
  87. {virtualshell-1.1.5 → virtualshell-1.2.0}/wiki/Project/Design & Architecture.md +0 -0
  88. {virtualshell-1.1.5 → virtualshell-1.2.0}/wiki/Usage/Asynchronous Execution.md +0 -0
  89. {virtualshell-1.1.5 → virtualshell-1.2.0}/wiki/Usage/Configuration.md +0 -0
  90. {virtualshell-1.1.5 → virtualshell-1.2.0}/wiki/Usage/Error Handling.md +0 -0
  91. {virtualshell-1.1.5 → virtualshell-1.2.0}/wiki/Usage/Performance Tips.md +0 -0
  92. {virtualshell-1.1.5 → virtualshell-1.2.0}/wiki/Usage/Running Scripts.md +0 -0
  93. {virtualshell-1.1.5 → virtualshell-1.2.0}/wiki/Usage/Security Notes.md +0 -0
  94. {virtualshell-1.1.5 → virtualshell-1.2.0}/wiki/Usage/Synchronous Execution.md +0 -0
@@ -0,0 +1,257 @@
1
+ name: Test Build-Only
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ target:
7
+ description: "Test build"
8
+ required: true
9
+ default: "*"
10
+ type: choice
11
+ options: ["*","linux-x86_64", "linux-aarch64", "macos", "windows"]
12
+
13
+ concurrency:
14
+ group: test-build-${{ github.ref }}
15
+ cancel-in-progress: true
16
+
17
+ jobs:
18
+ wheels-linux-x86_64:
19
+ if: inputs.target == '*' || inputs.target == 'linux-x86_64'
20
+ name: Wheels (Linux x86_64)
21
+ runs-on: ubuntu-latest
22
+ strategy:
23
+ fail-fast: false
24
+ matrix:
25
+ include:
26
+ - python: "cp312-*"
27
+ label: "cp312"
28
+ steps:
29
+ - uses: actions/checkout@v4
30
+ with:
31
+ fetch-depth: 0
32
+
33
+ - name: Set up Python (host)
34
+ uses: actions/setup-python@v5
35
+ with:
36
+ python-version: "3.12"
37
+
38
+ - name: Install cibuildwheel
39
+ run: |
40
+ python -m pip install -U pip
41
+ python -m pip install cibuildwheel
42
+
43
+ - name: Build wheels with cibuildwheel (manylinux x86_64)
44
+ env:
45
+ CIBW_BUILD: ${{ matrix.python }}
46
+ CIBW_ARCHS_LINUX: "x86_64"
47
+ CIBW_SKIP: "*-musllinux_* *-manylinux_i686"
48
+ CIBW_TEST_COMMAND: python -c "import virtualshell; print('ok')"
49
+ CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
50
+
51
+ CMAKE_GENERATOR: Ninja
52
+ PYBIND11_FINDPYTHON: "ON"
53
+ CIBW_BEFORE_BUILD_LINUX: "python -m pip install ninja"
54
+ run: |
55
+ python -m cibuildwheel --platform linux --output-dir wheelhouse .
56
+
57
+ - name: Upload wheels (Linux x86_64)
58
+ uses: actions/upload-artifact@v4
59
+ with:
60
+ name: wheels-linux-x86_64-${{ matrix.label }}-attempt${{ github.run_attempt }}
61
+ path: wheelhouse/*.whl
62
+ overwrite: true
63
+
64
+ wheels-linux-aarch64:
65
+ if: inputs.target == '*' || inputs.target == 'linux-aarch64'
66
+ name: Wheels (Linux aarch64)
67
+ runs-on: ubuntu-latest
68
+ strategy:
69
+ fail-fast: false
70
+ matrix:
71
+ include:
72
+ - python: "cp312-*"
73
+ label: "cp312"
74
+ steps:
75
+ - uses: actions/checkout@v4
76
+ with:
77
+ fetch-depth: 0
78
+
79
+ - name: Set up QEMU for cross-arch Docker
80
+ uses: docker/setup-qemu-action@v3
81
+ with:
82
+ platforms: arm64
83
+
84
+ - name: Set up Python (host)
85
+ uses: actions/setup-python@v5
86
+ with:
87
+ python-version: "3.12"
88
+
89
+ - name: Install cibuildwheel
90
+ run: |
91
+ python -m pip install -U pip
92
+ python -m pip install cibuildwheel
93
+
94
+ - name: Build wheels with cibuildwheel (manylinux aarch64 via QEMU)
95
+ env:
96
+ CIBW_BUILD: ${{ matrix.python }}
97
+ CIBW_ARCHS_LINUX: "aarch64"
98
+ CIBW_SKIP: "*-musllinux_*"
99
+ CIBW_TEST_COMMAND: python -c "import virtualshell; print('ok')"
100
+ CIBW_MANYLINUX_AARCH64_IMAGE: manylinux_2_28
101
+ CMAKE_GENERATOR: Ninja
102
+ PYBIND11_FINDPYTHON: "ON"
103
+ CIBW_BEFORE_BUILD_LINUX: "python -m pip install ninja"
104
+ run: |
105
+ python -m cibuildwheel --platform linux --output-dir wheelhouse .
106
+
107
+ - name: Upload wheels (Linux aarch64)
108
+ uses: actions/upload-artifact@v4
109
+ with:
110
+ name: wheels-linux-aarch64-${{ matrix.label }}-attempt${{ github.run_attempt }}
111
+ path: wheelhouse/*.whl
112
+ overwrite: true
113
+
114
+ wheels-macos:
115
+ if: inputs.target == '*' || inputs.target == 'macos'
116
+ name: Wheels (universal2 macOS)
117
+ runs-on: macos-latest
118
+ strategy:
119
+ fail-fast: false
120
+ matrix:
121
+ include:
122
+ - python: "cp312-*"
123
+ label: "cp312"
124
+
125
+ steps:
126
+ - uses: actions/checkout@v4
127
+ with:
128
+ fetch-depth: 0
129
+
130
+ - name: Set up Python (host)
131
+ uses: actions/setup-python@v5
132
+ with:
133
+ python-version: "3.12"
134
+
135
+ - name: Install cibuildwheel
136
+ run: |
137
+ python -m pip install -U pip
138
+ python -m pip install cibuildwheel
139
+
140
+ - name: Build wheels with cibuildwheel (universal2)
141
+ env:
142
+ CIBW_BUILD: ${{ matrix.python }}
143
+ CIBW_ARCHS_MACOS: "universal2"
144
+ CIBW_MACOSX_DEPLOYMENT_TARGET: "11.0"
145
+ CIBW_TEST_COMMAND: python -c "import virtualshell; print('ok')"
146
+ CIBW_BUILD_VERBOSITY: "1"
147
+ CIBW_BEFORE_BUILD_MACOS: "python -m pip install ninja"
148
+
149
+ CMAKE_ARGS: >-
150
+ -G Ninja
151
+ -DCMAKE_OSX_ARCHITECTURES=arm64;x86_64
152
+ -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0
153
+
154
+ PYBIND11_FINDPYTHON: "ON"
155
+ CMAKE_GENERATOR: "Ninja"
156
+ CMAKE_OSX_ARCHITECTURES: "arm64;x86_64"
157
+ CMAKE_OSX_DEPLOYMENT_TARGET: "11.0"
158
+ MACOSX_DEPLOYMENT_TARGET: "11.0"
159
+
160
+ run: |
161
+ python -m cibuildwheel --platform macos --output-dir wheelhouse .
162
+
163
+ - name: Upload wheels (macOS)
164
+ uses: actions/upload-artifact@v4
165
+ with:
166
+ name: wheels-macos-${{ matrix.label }}-attempt${{ github.run_attempt }}
167
+ path: wheelhouse/*.whl
168
+ overwrite: true
169
+
170
+ wheels-windows:
171
+ if: inputs.target == '*' || inputs.target == 'windows'
172
+ name: Wheels (Windows x64)
173
+ runs-on: windows-latest
174
+ strategy:
175
+ fail-fast: false
176
+ matrix:
177
+ python: ["cp312-win_amd64"]
178
+
179
+ steps:
180
+ - uses: actions/checkout@v4
181
+ with:
182
+ fetch-depth: 0
183
+
184
+ - name: Set up Python (host)
185
+ uses: actions/setup-python@v5
186
+ with:
187
+ python-version: "3.12"
188
+
189
+ - name: Install cibuildwheel
190
+ shell: pwsh
191
+ run: |
192
+ py -3 -m pip install -U pip
193
+ py -3 -m pip install -U cibuildwheel
194
+
195
+ - name: Build wheels with cibuildwheel (MSVC)
196
+ shell: cmd
197
+ env:
198
+ CIBW_BUILD: ${{ matrix.python }}
199
+ CIBW_SKIP: "*-win32"
200
+ CIBW_TEST_COMMAND: python -c "import virtualshell; print('ok')"
201
+ CIBW_BUILD_VERBOSITY: "1"
202
+ # Ninja is forced by pyproject (cmake.args); the compiler comes from
203
+ # the VsDevCmd environment set up below, whatever VS version the
204
+ # runner image ships.
205
+ CIBW_ENVIRONMENT_WINDOWS: >
206
+ CMAKE_GENERATOR=Ninja
207
+ PYBIND11_FINDPYTHON=ON
208
+ CMAKE_BUILD_TYPE=Release
209
+ run: |
210
+ @echo on
211
+
212
+ REM Find latest VS and load MSVC environment
213
+ for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do set VSINSTALL=%%i
214
+ if not defined VSINSTALL (
215
+ echo ERROR: Visual Studio with C++ tools not found.
216
+ exit /b 1
217
+ )
218
+
219
+ call "%VSINSTALL%\Common7\Tools\VsDevCmd.bat" -arch=x64
220
+
221
+ REM Make sure stale vars don't force wrong compiler
222
+ set CC=
223
+ set CXX=
224
+ set CMAKE_C_COMPILER=
225
+ set CMAKE_CXX_COMPILER=
226
+
227
+ REM Debug: verify we are on MSVC
228
+ where cl
229
+ cl /Bv
230
+ where cmake
231
+ where ninja
232
+
233
+ py -3 -m cibuildwheel --output-dir wheelhouse .
234
+
235
+ - name: Upload wheels (Windows)
236
+ uses: actions/upload-artifact@v4
237
+ with:
238
+ name: wheels-windows-${{ matrix.python }}-attempt${{ github.run_attempt }}
239
+ path: wheelhouse\*.whl
240
+ overwrite: true
241
+
242
+ sdist:
243
+ runs-on: ubuntu-latest
244
+ steps:
245
+ - uses: actions/checkout@v4
246
+ with: { fetch-depth: 0 }
247
+ - uses: actions/setup-python@v5
248
+ with: { python-version: "3.12" }
249
+ - run: |
250
+ python -m pip install -U pip build twine
251
+ python -m build --sdist --outdir dist .
252
+ python -m twine check dist/*
253
+ - uses: actions/upload-artifact@v4
254
+ with:
255
+ name: sdist
256
+ path: dist/*.tar.gz
257
+
@@ -25,18 +25,14 @@ jobs:
25
25
  fail-fast: false
26
26
  matrix:
27
27
  include:
28
- - python: "cp38-*"
29
- label: "cp38"
30
- - python: "cp39-*"
31
- label: "cp39"
32
- - python: "cp310-*"
33
- label: "cp310"
34
28
  - python: "cp311-*"
35
29
  label: "cp311"
36
30
  - python: "cp312-*"
37
31
  label: "cp312"
38
32
  - python: "cp313-*"
39
33
  label: "cp313"
34
+ - python: "cp314-*"
35
+ label: "cp314"
40
36
  steps:
41
37
  - uses: actions/checkout@v4
42
38
  with:
@@ -80,18 +76,14 @@ jobs:
80
76
  fail-fast: false
81
77
  matrix:
82
78
  include:
83
- - python: "cp38-*"
84
- label: "cp38"
85
- - python: "cp39-*"
86
- label: "cp39"
87
- - python: "cp310-*"
88
- label: "cp310"
89
79
  - python: "cp311-*"
90
80
  label: "cp311"
91
81
  - python: "cp312-*"
92
82
  label: "cp312"
93
83
  - python: "cp313-*"
94
84
  label: "cp313"
85
+ - python: "cp314-*"
86
+ label: "cp314"
95
87
  steps:
96
88
  - uses: actions/checkout@v4
97
89
  with:
@@ -139,18 +131,14 @@ jobs:
139
131
  fail-fast: false
140
132
  matrix:
141
133
  include:
142
- - python: "cp38-*"
143
- label: "cp38"
144
- - python: "cp39-*"
145
- label: "cp39"
146
- - python: "cp310-*"
147
- label: "cp310"
148
134
  - python: "cp311-*"
149
135
  label: "cp311"
150
136
  - python: "cp312-*"
151
137
  label: "cp312"
152
138
  - python: "cp313-*"
153
139
  label: "cp313"
140
+ - python: "cp314-*"
141
+ label: "cp314"
154
142
 
155
143
  steps:
156
144
  - uses: actions/checkout@v4
@@ -171,24 +159,21 @@ jobs:
171
159
  env:
172
160
  CIBW_BUILD: ${{ matrix.python }}
173
161
  CIBW_ARCHS_MACOS: "universal2"
174
- CIBW_MACOSX_DEPLOYMENT_TARGET: "11.0" # <- styrer wheel-tag + env
162
+ CIBW_MACOSX_DEPLOYMENT_TARGET: "11.0"
175
163
  CIBW_TEST_COMMAND: python -c "import virtualshell; print('ok')"
176
164
  CIBW_BUILD_VERBOSITY: "1"
177
165
  CIBW_BEFORE_BUILD_MACOS: "python -m pip install ninja"
178
166
 
179
- # ---- Tving CMake til universal2 via både CMAKE_ARGS og env ----
180
- # skbuild-core leser CMAKE_ARGS direkte og sender videre til CMake.
181
167
  CMAKE_ARGS: >-
182
168
  -G Ninja
183
169
  -DCMAKE_OSX_ARCHITECTURES=arm64;x86_64
184
170
  -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0
185
171
 
186
- # Disse brukes i tillegg (belt and suspenders)
187
172
  PYBIND11_FINDPYTHON: "ON"
188
173
  CMAKE_GENERATOR: "Ninja"
189
174
  CMAKE_OSX_ARCHITECTURES: "arm64;x86_64"
190
175
  CMAKE_OSX_DEPLOYMENT_TARGET: "11.0"
191
- MACOSX_DEPLOYMENT_TARGET: "11.0" # påvirker clangs -mmacosx-version-min
176
+ MACOSX_DEPLOYMENT_TARGET: "11.0"
192
177
 
193
178
  run: |
194
179
  python -m cibuildwheel --platform macos --output-dir wheelhouse .
@@ -206,7 +191,8 @@ jobs:
206
191
  strategy:
207
192
  fail-fast: false
208
193
  matrix:
209
- python: ["cp38-win_amd64", "cp39-win_amd64", "cp310-win_amd64", "cp311-win_amd64", "cp312-win_amd64", "cp313-win_amd64"]
194
+ python: ["cp311-win_amd64", "cp312-win_amd64", "cp313-win_amd64", "cp314-win_amd64"]
195
+
210
196
  steps:
211
197
  - uses: actions/checkout@v4
212
198
  with:
@@ -218,20 +204,48 @@ jobs:
218
204
  python-version: "3.12"
219
205
 
220
206
  - name: Install cibuildwheel
207
+ shell: pwsh
221
208
  run: |
222
209
  py -3 -m pip install -U pip
223
- py -3 -m pip install cibuildwheel
210
+ py -3 -m pip install -U cibuildwheel
224
211
 
225
212
  - name: Build wheels with cibuildwheel (MSVC)
213
+ shell: cmd
226
214
  env:
227
215
  CIBW_BUILD: ${{ matrix.python }}
228
216
  CIBW_SKIP: "*-win32"
229
217
  CIBW_TEST_COMMAND: python -c "import virtualshell; print('ok')"
218
+ CIBW_BUILD_VERBOSITY: "1"
219
+ # Ninja is forced by pyproject (cmake.args); the compiler comes from
220
+ # the VsDevCmd environment set up below, whatever VS version the
221
+ # runner image ships.
230
222
  CIBW_ENVIRONMENT_WINDOWS: >
231
- CMAKE_GENERATOR="Visual Studio 17 2022"
232
- CMAKE_GENERATOR_PLATFORM="x64"
223
+ CMAKE_GENERATOR=Ninja
233
224
  PYBIND11_FINDPYTHON=ON
225
+ CMAKE_BUILD_TYPE=Release
234
226
  run: |
227
+ @echo on
228
+
229
+ REM Find latest VS and load MSVC environment
230
+ for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do set VSINSTALL=%%i
231
+ if not defined VSINSTALL (
232
+ echo ERROR: Visual Studio with C++ tools not found.
233
+ exit /b 1
234
+ )
235
+
236
+ call "%VSINSTALL%\Common7\Tools\VsDevCmd.bat" -arch=x64
237
+
238
+ set CC=
239
+ set CXX=
240
+ set CMAKE_C_COMPILER=
241
+ set CMAKE_CXX_COMPILER=
242
+
243
+ REM Debug: verify we are on MSVC
244
+ where cl
245
+ cl /Bv
246
+ where cmake
247
+ where ninja
248
+
235
249
  py -3 -m cibuildwheel --output-dir wheelhouse .
236
250
 
237
251
  - name: Upload wheels (Windows)
@@ -270,8 +284,14 @@ jobs:
270
284
  needs: [wheels-linux-x86_64, wheels-linux-aarch64, wheels-macos, wheels-windows, sdist]
271
285
  runs-on: ubuntu-latest
272
286
  if: github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/v')
287
+
273
288
  permissions:
274
289
  contents: read
290
+ id-token: write
291
+
292
+ environment:
293
+ name: release
294
+ url: https://pypi.org/p/virtualshell
275
295
 
276
296
  steps:
277
297
  - name: Download wheel artifacts
@@ -293,15 +313,6 @@ jobs:
293
313
  find dist_in -type f \( -name "*.whl" -o -name "*.tar.gz" \) -exec cp {} dist/ \;
294
314
  ls -l dist
295
315
 
296
- - name: Ensure dists exist
297
- run: |
298
- shopt -s nullglob
299
- files=(dist/*.whl dist/*.tar.gz)
300
- if [ ${#files[@]} -eq 0 ]; then
301
- echo "No distributions found to publish."
302
- exit 1
303
- fi
304
-
305
316
  - name: Twine check
306
317
  run: |
307
318
  python -m pip install -U twine
@@ -316,7 +327,7 @@ jobs:
316
327
  echo "repo=pypi" >> $GITHUB_OUTPUT
317
328
  fi
318
329
 
319
- - name: Publish to TestPyPI (token)
330
+ - name: Publish to TestPyPI (trusted)
320
331
  if: steps.target.outputs.repo == 'testpypi'
321
332
  uses: pypa/gh-action-pypi-publish@release/v1
322
333
  with:
@@ -324,15 +335,11 @@ jobs:
324
335
  packages-dir: dist
325
336
  skip-existing: true
326
337
  verbose: true
327
- user: __token__
328
- password: ${{ secrets.TEST_PYPI_API_TOKEN }}
329
338
 
330
- - name: Publish to PyPI (token)
339
+ - name: Publish to PyPI (trusted)
331
340
  if: steps.target.outputs.repo == 'pypi'
332
341
  uses: pypa/gh-action-pypi-publish@release/v1
333
342
  with:
334
343
  packages-dir: dist
335
344
  skip-existing: false
336
345
  verbose: true
337
- user: __token__
338
- password: ${{ secrets.PYPI_API_TOKEN }}
@@ -2,6 +2,7 @@
2
2
  __pycache__/
3
3
  *.pyc
4
4
  build/
5
+ out/
5
6
  *.egg-info/
6
7
  test/
7
8
  .pypirc
@@ -9,4 +10,7 @@ dist/
9
10
  .venv*
10
11
  test_run*
11
12
  test_performance_bridge.py
12
- ZEROCOPY_BRIDGE.md
13
+ ZEROCOPY_BRIDGE.md
14
+ .vs/
15
+ .pytest_cache/
16
+ debug/
@@ -0,0 +1,110 @@
1
+ cmake_minimum_required(VERSION 3.20)
2
+ project(virtualshell LANGUAGES CXX)
3
+
4
+ set(CMAKE_CXX_STANDARD 17)
5
+ set(CMAKE_CXX_STANDARD_REQUIRED ON)
6
+ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
7
+
8
+ # Enforce 64-bit build on Windows
9
+ if(WIN32 AND CMAKE_SIZEOF_VOID_P EQUAL 4)
10
+ message(FATAL_ERROR
11
+ "32-bit build detected (x86). virtualshell requires 64-bit (x64).\n"
12
+ "Open 'x64 Native Tools Command Prompt for VS' and retry."
13
+ )
14
+ endif()
15
+
16
+ # Find Python and pybind11
17
+ find_package(Python3 REQUIRED COMPONENTS Interpreter Development.Module)
18
+ find_package(pybind11 CONFIG QUIET)
19
+ if(NOT pybind11_FOUND)
20
+ execute_process(
21
+ COMMAND ${Python3_EXECUTABLE} -c "import pybind11; print(pybind11.get_cmake_dir())"
22
+ OUTPUT_VARIABLE pybind11_DIR
23
+ OUTPUT_STRIP_TRAILING_WHITESPACE
24
+ RESULT_VARIABLE pybind11_RESULT
25
+ )
26
+ file(TO_CMAKE_PATH "${pybind11_DIR}" pybind11_DIR)
27
+ if(pybind11_RESULT EQUAL 0)
28
+ find_package(pybind11 CONFIG REQUIRED PATHS ${pybind11_DIR} NO_DEFAULT_PATH)
29
+ else()
30
+ message(FATAL_ERROR "pybind11 not found. Install with: pip install pybind11")
31
+ endif()
32
+ endif()
33
+
34
+
35
+
36
+ # Source files
37
+ set(SRC
38
+ cpp/src/binder.cpp
39
+ cpp/src/io_pump.cpp
40
+ cpp/src/powershell_process.cpp
41
+ cpp/src/virtual_shell.cpp
42
+ )
43
+
44
+ file(GLOB_RECURSE VS_HEADERS CONFIGURE_DEPENDS
45
+ "${CMAKE_CURRENT_SOURCE_DIR}/cpp/include/*.h"
46
+ "${CMAKE_CURRENT_SOURCE_DIR}/cpp/include/*.hpp"
47
+ )
48
+
49
+ # NO_EXTRAS on MSVC: pybind11's default /GL + LTCG (whole-program optimization)
50
+ # triggers an internal compiler error (C1001) in newer MSVC toolsets
51
+ # (observed with VS 2026 / cl 19.51) on the binder's lambda templates.
52
+ # The binding layer is I/O-bound, so LTO buys nothing here anyway.
53
+ if(MSVC)
54
+ pybind11_add_module(_core MODULE NO_EXTRAS ${SRC} ${VS_HEADERS})
55
+ else()
56
+ pybind11_add_module(_core MODULE ${SRC} ${VS_HEADERS})
57
+ endif()
58
+ target_include_directories(_core PRIVATE cpp/include)
59
+
60
+ # Link platform-specific libraries
61
+ if(WIN32)
62
+ target_link_libraries(_core PRIVATE Python3::Module)
63
+ elseif(UNIX)
64
+ find_package(Threads REQUIRED)
65
+ target_link_libraries(_core PRIVATE Threads::Threads dl)
66
+ endif()
67
+
68
+ # Set output directory for the built module
69
+ if(DEFINED ENV{SKBUILD_STATE} AND "$ENV{SKBUILD_STATE}" STREQUAL "editable")
70
+ set(_VS_OUTDIR "${PROJECT_SOURCE_DIR}/src/virtualshell")
71
+ elseif(DEFINED SKBUILD_PLATLIB_DIR)
72
+ set(_VS_OUTDIR "${SKBUILD_PLATLIB_DIR}/virtualshell")
73
+ else()
74
+ set(_VS_OUTDIR "${CMAKE_CURRENT_BINARY_DIR}/virtualshell")
75
+ endif()
76
+
77
+ # Configure target properties
78
+ set_target_properties(_core PROPERTIES
79
+ OUTPUT_NAME "_core"
80
+ LIBRARY_OUTPUT_DIRECTORY "${_VS_OUTDIR}"
81
+ RUNTIME_OUTPUT_DIRECTORY "${_VS_OUTDIR}"
82
+ LIBRARY_OUTPUT_DIRECTORY_RELEASE "${_VS_OUTDIR}"
83
+ RUNTIME_OUTPUT_DIRECTORY_RELEASE "${_VS_OUTDIR}"
84
+ LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO "${_VS_OUTDIR}"
85
+ RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${_VS_OUTDIR}"
86
+ CXX_VISIBILITY_PRESET hidden
87
+ VISIBILITY_INLINES_HIDDEN ON
88
+ )
89
+
90
+ # Compiler-specific options
91
+ if(MSVC)
92
+ target_compile_options(_core PRIVATE /permissive- /Zc:__cplusplus /EHsc /utf-8 /bigobj)
93
+ else()
94
+ target_compile_options(_core PRIVATE -O3 -fvisibility=hidden)
95
+ endif()
96
+
97
+ install(TARGETS _core
98
+ LIBRARY DESTINATION virtualshell
99
+ RUNTIME DESTINATION virtualshell
100
+ ARCHIVE DESTINATION virtualshell
101
+ )
102
+
103
+ # C++ tests (opt-in; never built by pip/scikit-build)
104
+ option(VIRTUALSHELL_BUILD_TESTS "Build the C++ test suite (vs_core_tests)" OFF)
105
+ if(VIRTUALSHELL_BUILD_TESTS)
106
+ enable_testing()
107
+ add_subdirectory(cpp/tests)
108
+ endif()
109
+
110
+
@@ -0,0 +1,15 @@
1
+ {
2
+ "configurations": [
3
+ {
4
+ "name": "x64-Release",
5
+ "generator": "Ninja",
6
+ "configurationType": "Release",
7
+ "inheritEnvironments": [ "msvc_x64_x64" ],
8
+ "buildRoot": "${projectDir}\\out\\build\\${name}",
9
+ "installRoot": "${projectDir}\\out\\install\\${name}",
10
+ "cmakeCommandArgs": "",
11
+ "buildCommandArgs": "",
12
+ "ctestCommandArgs": ""
13
+ }
14
+ ]
15
+ }