nc-gcode-interpreter 0.1.9__tar.gz → 0.1.11__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 (70) hide show
  1. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/.github/workflows/build-and-release.yml +104 -73
  2. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/Cargo.lock +505 -303
  3. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/Cargo.toml +7 -7
  4. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/Development.md +6 -6
  5. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/PKG-INFO +8 -8
  6. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/TODO.md +3 -2
  7. nc_gcode_interpreter-0.1.11/examples/axis_index_assignment.csv +5 -0
  8. nc_gcode_interpreter-0.1.11/examples/axis_index_assignment.mpf +7 -0
  9. nc_gcode_interpreter-0.1.11/examples/function_calls.csv +3 -0
  10. nc_gcode_interpreter-0.1.11/examples/r_param.csv +3 -0
  11. nc_gcode_interpreter-0.1.11/examples/r_param.mpf +4 -0
  12. nc_gcode_interpreter-0.1.11/examples/repeat.csv +9 -0
  13. nc_gcode_interpreter-0.1.11/examples/repeat.mpf +6 -0
  14. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/examples/variables.csv +1 -0
  15. nc_gcode_interpreter-0.1.11/examples/variables.mpf +6 -0
  16. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/pyproject.toml +3 -3
  17. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/python/nc_gcode_interpreter/__init__.py +5 -0
  18. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/python/nc_gcode_interpreter/_internal.pyi +3 -0
  19. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/python/tests/test_expected_output.py +5 -2
  20. nc_gcode_interpreter-0.1.11/src/errors.rs +147 -0
  21. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/src/grammar.pest +37 -26
  22. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/src/interpret_rules.rs +456 -114
  23. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/src/interpreter.rs +26 -16
  24. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/src/lib.rs +3 -1
  25. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/src/main.rs +41 -10
  26. nc_gcode_interpreter-0.1.11/src/state.rs +147 -0
  27. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/uv.lock +18 -106
  28. nc_gcode_interpreter-0.1.9/examples/function_calls.csv +0 -3
  29. nc_gcode_interpreter-0.1.9/examples/variables.mpf +0 -4
  30. nc_gcode_interpreter-0.1.9/src/errors.rs +0 -59
  31. nc_gcode_interpreter-0.1.9/src/state.rs +0 -77
  32. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/.gitignore +0 -0
  33. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/CONTRIBUTING.md +0 -0
  34. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/LICENSE +0 -0
  35. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/README.md +0 -0
  36. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/examples/arrays.csv +0 -0
  37. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/examples/arrays.mpf +0 -0
  38. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/examples/basic_math.csv +0 -0
  39. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/examples/basic_math.mpf +0 -0
  40. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/examples/custom_vars.csv +0 -0
  41. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/examples/custom_vars.mpf +0 -0
  42. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/examples/defaults.csv +0 -0
  43. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/examples/defaults.mpf +0 -0
  44. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/examples/for_loop.csv +0 -0
  45. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/examples/for_loop.mpf +0 -0
  46. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/examples/function_calls.mpf +0 -0
  47. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/examples/if_statement.csv +0 -0
  48. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/examples/if_statement.mpf +0 -0
  49. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/examples/increment.csv +0 -0
  50. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/examples/increment.mpf +0 -0
  51. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/examples/loop.csv +0 -0
  52. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/examples/loop.mpf +0 -0
  53. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/examples/multiple_m_codes.csv +0 -0
  54. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/examples/multiple_m_codes.mpf +0 -0
  55. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/examples/simple.csv +0 -0
  56. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/examples/simple.mpf +0 -0
  57. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/examples/tool.csv +0 -0
  58. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/examples/tool.mpf +0 -0
  59. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/examples/trans.csv +0 -0
  60. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/examples/trans.mpf +0 -0
  61. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/ggroups/generate_modal_ggroups.py +0 -0
  62. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/ggroups/generate_pest.py +0 -0
  63. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/ggroups/ggroups.pest +0 -0
  64. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/python/example/minimal.py +0 -0
  65. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/python/nc_gcode_interpreter/ggroups.json +0 -0
  66. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/python/nc_gcode_interpreter/py.typed +0 -0
  67. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/python/tests/test_g_groups.py +0 -0
  68. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/rustfmt.toml +0 -0
  69. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/src/modal_groups.rs +0 -0
  70. {nc_gcode_interpreter-0.1.9 → nc_gcode_interpreter-0.1.11}/src/types.rs +0 -0
@@ -7,7 +7,7 @@
7
7
  # - build using binary bindings
8
8
  # - extract the binaries from the wheel
9
9
  # - upload both the wheel and the binary to the release
10
- # - disable some platforms
10
+ # - disable some platforms
11
11
 
12
12
  name: Build and Release
13
13
 
@@ -33,7 +33,7 @@ jobs:
33
33
  - uses: actions/checkout@v4
34
34
  - uses: actions/setup-python@v5
35
35
  with:
36
- python-version: 3.12
36
+ python-version: 3.13
37
37
  - name: Install Python linter
38
38
  run: pip install ruff
39
39
  - name: Lint Python code with ruff
@@ -47,11 +47,12 @@ jobs:
47
47
  platform:
48
48
  - runner: ubuntu-latest
49
49
  target: x86_64
50
+ python-version: ["3.12", "3.13"]
50
51
  steps:
51
52
  - uses: actions/checkout@v4
52
53
  - uses: actions/setup-python@v5
53
54
  with:
54
- python-version: 3.12
55
+ python-version: ${{ matrix.python-version }}
55
56
  - name: Update Cargo.toml Version
56
57
  if: startsWith(github.ref, 'refs/tags/')
57
58
  run: |
@@ -68,25 +69,40 @@ jobs:
68
69
  - name: Upload wheels
69
70
  uses: actions/upload-artifact@v4
70
71
  with:
71
- name: wheels-linux-${{ matrix.platform.target }}
72
+ name: wheels-${{ matrix.platform.runner }}-${{ matrix.platform.target }}-py${{ matrix.python-version }}-${{ github.sha }}
72
73
  path: dist
73
74
 
74
75
  test:
75
76
  needs: [linux-x64]
76
77
  runs-on: ubuntu-latest
78
+ strategy:
79
+ matrix:
80
+ python-version: ["3.12", "3.13"]
77
81
  steps:
78
82
  - uses: actions/checkout@v4
79
83
  - uses: actions/download-artifact@v4
80
84
  with:
81
- name: wheels-linux-x86_64
85
+ name: wheels-ubuntu-latest-x86_64-py${{ matrix.python-version }}-${{ github.sha }}
82
86
  path: dist
83
87
  - uses: actions/setup-python@v5
84
88
  with:
85
- python-version: 3.12
89
+ python-version: ${{ matrix.python-version }}
86
90
  - name: Install py_opw_kinematics
91
+ shell: bash
87
92
  run: |
88
- WHL_FILE=$(ls dist/*cp312*.whl)
89
- pip install "${WHL_FILE}[test]"
93
+ set -e # Exit on error
94
+ PY_VERSION="${{ matrix.python-version }}"
95
+ PY_VERSION_NO_DOT="${PY_VERSION//./}"
96
+ WHL_FILES=(dist/*cp${PY_VERSION_NO_DOT}*.whl)
97
+ if [ ${#WHL_FILES[@]} -eq 0 ]; then
98
+ echo "No matching wheel files found!"
99
+ exit 1
100
+ fi
101
+ if [ ${#WHL_FILES[@]} -gt 1 ]; then
102
+ echo "Multiple wheel files found: ${WHL_FILES[*]}"
103
+ exit 1
104
+ fi
105
+ pip install "${WHL_FILES[0]}[test]"
90
106
  - name: Run tests with pytest
91
107
  run: pytest
92
108
  - name: Type checking with mypy
@@ -102,23 +118,23 @@ jobs:
102
118
  # target: x86
103
119
  - runner: ubuntu-latest
104
120
  target: aarch64
105
- # - runner: ubuntu-latest
106
- # target: armv7
107
- # - runner: ubuntu-latest
108
- # target: s390x
109
- # - runner: ubuntu-latest
110
- # target: ppc64le
121
+ python-version: ["3.12", "3.13"]
111
122
  steps:
112
123
  - uses: actions/checkout@v4
113
124
  - uses: actions/setup-python@v5
114
125
  with:
115
- python-version: 3.12
126
+ python-version: ${{ matrix.python-version }}
116
127
  - name: Update Cargo.toml Version
117
128
  if: startsWith(github.ref, 'refs/tags/')
129
+ shell: bash
118
130
  run: |
131
+ set -e # Exit on error
119
132
  VERSION=${GITHUB_REF#refs/tags/v}
120
133
  echo "Setting version to $VERSION"
121
- sed -i "s/^version = \".*\"/version = \"$VERSION\"/" Cargo.toml
134
+ if ! sed -i "s/^version = \".*\"/version = \"$VERSION\"/" Cargo.toml; then
135
+ echo "Failed to update version in Cargo.toml"
136
+ exit 1
137
+ fi
122
138
  - name: Build wheels
123
139
  uses: PyO3/maturin-action@v1
124
140
  with:
@@ -129,42 +145,9 @@ jobs:
129
145
  - name: Upload wheels
130
146
  uses: actions/upload-artifact@v4
131
147
  with:
132
- name: wheels-linux-${{ matrix.platform.target }}
148
+ name: wheels-${{ matrix.platform.runner }}-${{ matrix.platform.target }}-py${{ matrix.python-version }}-${{ github.sha }}
133
149
  path: dist
134
150
 
135
-
136
- # musllinux:
137
- # needs: [lint, test]
138
- # runs-on: ${{ matrix.platform.runner }}
139
- # strategy:
140
- # matrix:
141
- # platform:
142
- # - runner: ubuntu-latest
143
- # target: x86_64
144
- # # - runner: ubuntu-latest
145
- # # target: x86
146
- # # - runner: ubuntu-latest
147
- # # target: aarch64
148
- # # - runner: ubuntu-latest
149
- # # target: armv7
150
- # steps:
151
- # - uses: actions/checkout@v4
152
- # - uses: actions/setup-python@v5
153
- # with:
154
- # python-version: '>=3.12'
155
- # - name: Build wheels
156
- # uses: PyO3/maturin-action@v1
157
- # with:
158
- # target: ${{ matrix.platform.target }}
159
- # args: --release --out dist --find-interpreter
160
- # sccache: 'true'
161
- # manylinux: musllinux_1_2
162
- # - name: Upload wheels
163
- # uses: actions/upload-artifact@v4
164
- # with:
165
- # name: wheels-musllinux-${{ matrix.platform.target }}
166
- # path: dist
167
-
168
151
  windows:
169
152
  if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
170
153
  needs: [lint, test]
@@ -174,21 +157,42 @@ jobs:
174
157
  platform:
175
158
  - runner: windows-latest
176
159
  target: x64
177
- # - runner: windows-latest
178
- # target: x86
160
+ python-version: ["3.12", "3.13"]
179
161
  steps:
180
162
  - uses: actions/checkout@v4
181
163
  - uses: actions/setup-python@v5
182
164
  with:
183
- python-version: 3.12
165
+ python-version: ${{ matrix.python-version }}
184
166
  architecture: ${{ matrix.platform.target }}
185
167
  - name: Update Cargo.toml Version
186
168
  if: startsWith(github.ref, 'refs/tags/')
187
169
  shell: pwsh
188
170
  run: |
189
- $VERSION = $env:GITHUB_REF -replace 'refs/tags/v',''
190
- Write-Host "Setting version to $VERSION"
191
- (Get-Content Cargo.toml) -replace '^version = ".*"', ('version = "' + $VERSION + '"') | Set-Content Cargo.toml
171
+ $ErrorActionPreference = "Stop"
172
+ try {
173
+ $VERSION = $env:GITHUB_REF -replace 'refs/tags/v',''
174
+ Write-Host "Setting version to $VERSION"
175
+
176
+ # Read Cargo.toml as UTF-8
177
+ $path = Resolve-Path Cargo.toml
178
+ $content = [System.IO.File]::ReadAllText($path, [System.Text.Encoding]::UTF8)
179
+
180
+ # Update version using multiline regex to match "version ="
181
+ $newContent = $content -replace '(?m)^\s*version\s*=\s*".*"', "version = `"$VERSION`""
182
+
183
+ if ($newContent -eq $content) {
184
+ throw "Version pattern not found in Cargo.toml"
185
+ }
186
+
187
+ # Write back with UTF-8 encoding
188
+ [System.IO.File]::WriteAllText($path, $newContent, [System.Text.Encoding]::UTF8)
189
+ Write-Host "Cargo.toml version updated successfully."
190
+ }
191
+ catch {
192
+ Write-Error "Failed to update version in Cargo.toml: $_"
193
+ exit 1
194
+ }
195
+
192
196
  - name: Build wheels
193
197
  uses: PyO3/maturin-action@v1
194
198
  with:
@@ -198,7 +202,7 @@ jobs:
198
202
  - name: Upload wheels
199
203
  uses: actions/upload-artifact@v4
200
204
  with:
201
- name: wheels-windows-${{ matrix.platform.target }}
205
+ name: wheels-${{ matrix.platform.runner }}-${{ matrix.platform.target }}-py${{ matrix.python-version }}-${{ github.sha }}
202
206
  path: dist
203
207
 
204
208
  macos:
@@ -208,20 +212,27 @@ jobs:
208
212
  strategy:
209
213
  matrix:
210
214
  platform:
211
- - runner: macos-12
215
+ - runner: macos-latest
212
216
  target: x86_64
213
- - runner: macos-14
217
+ - runner: macos-latest
214
218
  target: aarch64
219
+ python-version: ["3.12", "3.13"]
215
220
  steps:
216
221
  - uses: actions/checkout@v4
217
222
  - uses: actions/setup-python@v5
218
223
  with:
219
- python-version: 3.12
224
+ python-version: ${{ matrix.python-version }}
220
225
  - name: Update Cargo.toml Version
226
+ if: startsWith(github.ref, 'refs/tags/')
227
+ shell: bash
221
228
  run: |
229
+ set -e # Exit on error
222
230
  VERSION=${GITHUB_REF#refs/tags/v}
223
231
  echo "Setting version to $VERSION"
224
- sed -i '' "s/^version = \".*\"/version = \"$VERSION\"/" Cargo.toml
232
+ if ! sed -i '' "s/^version = \".*\"/version = \"$VERSION\"/" Cargo.toml; then
233
+ echo "Failed to update version in Cargo.toml"
234
+ exit 1
235
+ fi
225
236
  - name: Build wheels
226
237
  uses: PyO3/maturin-action@v1
227
238
  with:
@@ -231,7 +242,7 @@ jobs:
231
242
  - name: Upload wheels
232
243
  uses: actions/upload-artifact@v4
233
244
  with:
234
- name: wheels-macos-${{ matrix.platform.target }}
245
+ name: wheels-${{ matrix.platform.runner }}-${{ matrix.platform.target }}-py${{ matrix.python-version }}-${{ github.sha }}
235
246
  path: dist
236
247
 
237
248
  sdist:
@@ -245,10 +256,15 @@ jobs:
245
256
  python-version: 3.12
246
257
  - name: Update Cargo.toml Version
247
258
  if: startsWith(github.ref, 'refs/tags/')
259
+ shell: bash
248
260
  run: |
261
+ set -e # Exit on error
249
262
  VERSION=${GITHUB_REF#refs/tags/v}
250
263
  echo "Setting version to $VERSION"
251
- sed -i "s/^version = \".*\"/version = \"$VERSION\"/" Cargo.toml
264
+ if ! sed -i "s/^version = \".*\"/version = \"$VERSION\"/" Cargo.toml; then
265
+ echo "Failed to update version in Cargo.toml"
266
+ exit 1
267
+ fi
252
268
  - name: Build sdist
253
269
  uses: PyO3/maturin-action@v1
254
270
  with:
@@ -266,33 +282,48 @@ jobs:
266
282
  if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
267
283
  needs: [linux, linux-x64, windows, macos, sdist]
268
284
  permissions:
269
- # Use to sign the release artifacts
270
285
  id-token: write
271
- # Used to upload release artifacts
272
286
  contents: write
273
- # Used to generate artifact attestation
274
287
  attestations: write
275
288
  steps:
276
289
  - uses: actions/download-artifact@v4
290
+ with:
291
+ merge-multiple: true
292
+ path: dist
277
293
  - uses: actions/setup-python@v5
278
294
  with:
279
295
  python-version: 3.12
280
296
  - name: Generate artifact attestation
281
297
  uses: actions/attest-build-provenance@v1
282
298
  with:
283
- subject-path: 'wheels-*/*'
299
+ subject-path: 'dist/*'
284
300
  - name: Publish to PyPI
285
301
  if: startsWith(github.ref, 'refs/tags/')
286
302
  uses: PyO3/maturin-action@v1
287
303
  with:
288
304
  command: upload
289
- args: --non-interactive --skip-existing wheels-*/*
305
+ args: --non-interactive --skip-existing dist/*
306
+ - name: Prepare release assets
307
+ run: |
308
+ mkdir release-assets
309
+ cp dist/*.tar.gz release-assets/
310
+ cp dist/*.whl release-assets/
311
+ # Remove any duplicate files based on their content
312
+ cd release-assets
313
+ for f in *.whl; do
314
+ if [ -f "$f" ]; then
315
+ # Keep only one copy of each unique file
316
+ sha256sum "$f" | sort -u | while read -r sum file; do
317
+ others=$(sha256sum * | grep "$sum" | cut -d' ' -f2- | grep -v "^$file$" || true)
318
+ for other in $others; do
319
+ rm -f "$other"
320
+ done
321
+ done
322
+ fi
323
+ done
290
324
  - name: Upload to GitHub Release
291
325
  uses: softprops/action-gh-release@v2
292
326
  with:
293
- files: |
294
- wheels-sdist/*.tar.gz
295
- wheels-windows-*/*.whl
296
- wheels-linux-*/*.whl
297
- wheels-macos-*/*.whl
327
+ files: release-assets/*
328
+ fail_on_unmatched_files: false
298
329
  prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') }}