nc-gcode-interpreter 0.1.5__tar.gz → 0.1.7__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.
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/.github/workflows/build-and-release.yml +148 -127
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/Cargo.lock +1 -1
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/Cargo.toml +1 -1
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/PKG-INFO +6 -2
- nc_gcode_interpreter-0.1.7/examples/tool.csv +2 -0
- nc_gcode_interpreter-0.1.7/examples/tool.mpf +1 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/pyproject.toml +10 -2
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/python/tests/test_expected_output.py +1 -2
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/src/grammar.pest +8 -6
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/src/interpret_rules.rs +34 -3
- nc_gcode_interpreter-0.1.7/uv.lock +1540 -0
- nc_gcode_interpreter-0.1.5/uv.lock +0 -33
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/.gitignore +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/CONTRIBUTING.md +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/Development.md +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/Example.MPF +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/LICENSE +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/README.md +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/TODO.md +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/examples/arrays.csv +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/examples/arrays.mpf +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/examples/basic_math.csv +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/examples/basic_math.mpf +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/examples/custom_vars.csv +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/examples/custom_vars.mpf +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/examples/defaults.csv +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/examples/defaults.mpf +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/examples/for_loop.csv +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/examples/for_loop.mpf +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/examples/if_statement.csv +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/examples/if_statement.mpf +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/examples/increment.csv +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/examples/increment.mpf +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/examples/loop.csv +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/examples/loop.mpf +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/examples/multiple_m_codes.csv +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/examples/multiple_m_codes.mpf +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/examples/simple.csv +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/examples/simple.mpf +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/examples/trans.csv +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/examples/trans.mpf +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/examples/variables.csv +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/examples/variables.mpf +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/ggroups/generate_modal_ggroups.py +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/ggroups/generate_pest.py +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/ggroups/ggroups.json +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/ggroups/ggroups.pest +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/ggroups/modal_groups.rs +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/python/example/minimal.py +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/python/nc_gcode_interpreter/__init__.py +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/rustfmt.toml +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/src/errors.rs +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/src/interpreter.rs +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/src/lib.rs +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/src/main.rs +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/src/modal_groups.rs +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/src/state.rs +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/src/types.rs +0 -0
{nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/.github/workflows/build-and-release.yml
RENAMED
|
@@ -13,44 +13,115 @@ name: Build and Release
|
|
|
13
13
|
|
|
14
14
|
on:
|
|
15
15
|
push:
|
|
16
|
+
branches:
|
|
17
|
+
- main
|
|
16
18
|
tags:
|
|
17
19
|
- 'v*'
|
|
20
|
+
pull_request:
|
|
18
21
|
workflow_dispatch:
|
|
19
22
|
|
|
23
|
+
|
|
20
24
|
permissions:
|
|
21
25
|
contents: write
|
|
22
26
|
|
|
23
27
|
env:
|
|
24
28
|
PROJECT_NAME: "nc-gcode-interpreter"
|
|
25
|
-
|
|
26
29
|
jobs:
|
|
27
|
-
|
|
30
|
+
lint:
|
|
31
|
+
runs-on: ubuntu-latest
|
|
32
|
+
steps:
|
|
33
|
+
- uses: actions/checkout@v4
|
|
34
|
+
- uses: actions/setup-python@v5
|
|
35
|
+
with:
|
|
36
|
+
python-version: 3.12
|
|
37
|
+
- name: Install Python linter
|
|
38
|
+
run: pip install ruff
|
|
39
|
+
- name: Lint Python code with ruff
|
|
40
|
+
run: ruff check .
|
|
41
|
+
|
|
42
|
+
linux-x64:
|
|
43
|
+
needs: [lint]
|
|
28
44
|
runs-on: ${{ matrix.platform.runner }}
|
|
29
45
|
strategy:
|
|
30
46
|
matrix:
|
|
31
47
|
platform:
|
|
32
48
|
- runner: ubuntu-latest
|
|
33
49
|
target: x86_64
|
|
34
|
-
|
|
35
|
-
|
|
50
|
+
steps:
|
|
51
|
+
- uses: actions/checkout@v4
|
|
52
|
+
- uses: actions/setup-python@v5
|
|
53
|
+
with:
|
|
54
|
+
python-version: 3.12
|
|
55
|
+
- name: Update Cargo.toml Version
|
|
56
|
+
if: startsWith(github.ref, 'refs/tags/')
|
|
57
|
+
run: |
|
|
58
|
+
VERSION=${GITHUB_REF#refs/tags/v}
|
|
59
|
+
echo "Setting version to $VERSION"
|
|
60
|
+
sed -i "s/^version = \".*\"/version = \"$VERSION\"/" Cargo.toml
|
|
61
|
+
- name: Build wheels
|
|
62
|
+
uses: PyO3/maturin-action@v1
|
|
63
|
+
with:
|
|
64
|
+
target: ${{ matrix.platform.target }}
|
|
65
|
+
args: --release --out dist --find-interpreter
|
|
66
|
+
sccache: 'true'
|
|
67
|
+
manylinux: auto
|
|
68
|
+
- name: Upload wheels
|
|
69
|
+
uses: actions/upload-artifact@v4
|
|
70
|
+
with:
|
|
71
|
+
name: wheels-linux-${{ matrix.platform.target }}
|
|
72
|
+
path: dist
|
|
73
|
+
|
|
74
|
+
test:
|
|
75
|
+
needs: [linux-x64]
|
|
76
|
+
runs-on: ubuntu-latest
|
|
77
|
+
steps:
|
|
78
|
+
- uses: actions/checkout@v4
|
|
79
|
+
- uses: actions/download-artifact@v4
|
|
80
|
+
with:
|
|
81
|
+
name: wheels-linux-x86_64
|
|
82
|
+
path: dist
|
|
83
|
+
- uses: actions/setup-python@v5
|
|
84
|
+
with:
|
|
85
|
+
python-version: 3.12
|
|
86
|
+
- name: Install py_opw_kinematics
|
|
87
|
+
run: |
|
|
88
|
+
WHL_FILE=$(ls dist/*cp312*.whl)
|
|
89
|
+
pip install "${WHL_FILE}[test]"
|
|
90
|
+
- name: Run tests with pytest
|
|
91
|
+
run: pytest
|
|
92
|
+
|
|
93
|
+
linux:
|
|
94
|
+
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
|
|
95
|
+
needs: [lint, test]
|
|
96
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
97
|
+
strategy:
|
|
98
|
+
matrix:
|
|
99
|
+
platform:
|
|
100
|
+
# - runner: ubuntu-latest
|
|
101
|
+
# target: x86
|
|
36
102
|
- runner: ubuntu-latest
|
|
37
103
|
target: aarch64
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
104
|
+
# - runner: ubuntu-latest
|
|
105
|
+
# target: armv7
|
|
106
|
+
# - runner: ubuntu-latest
|
|
107
|
+
# target: s390x
|
|
108
|
+
# - runner: ubuntu-latest
|
|
109
|
+
# target: ppc64le
|
|
44
110
|
steps:
|
|
45
111
|
- uses: actions/checkout@v4
|
|
46
112
|
- uses: actions/setup-python@v5
|
|
47
113
|
with:
|
|
48
114
|
python-version: 3.12
|
|
115
|
+
- name: Update Cargo.toml Version
|
|
116
|
+
if: startsWith(github.ref, 'refs/tags/')
|
|
117
|
+
run: |
|
|
118
|
+
VERSION=${GITHUB_REF#refs/tags/v}
|
|
119
|
+
echo "Setting version to $VERSION"
|
|
120
|
+
sed -i "s/^version = \".*\"/version = \"$VERSION\"/" Cargo.toml
|
|
49
121
|
- name: Build wheels
|
|
50
122
|
uses: PyO3/maturin-action@v1
|
|
51
123
|
with:
|
|
52
124
|
target: ${{ matrix.platform.target }}
|
|
53
|
-
# args: --release --out dist --find-interpreter -b bin
|
|
54
125
|
args: --release --out dist --find-interpreter
|
|
55
126
|
sccache: 'true'
|
|
56
127
|
manylinux: auto
|
|
@@ -60,58 +131,67 @@ jobs:
|
|
|
60
131
|
name: wheels-linux-${{ matrix.platform.target }}
|
|
61
132
|
path: dist
|
|
62
133
|
|
|
63
|
-
|
|
64
|
-
#
|
|
65
|
-
#
|
|
66
|
-
#
|
|
67
|
-
#
|
|
68
|
-
#
|
|
69
|
-
#
|
|
70
|
-
#
|
|
71
|
-
#
|
|
72
|
-
#
|
|
73
|
-
#
|
|
74
|
-
#
|
|
75
|
-
#
|
|
76
|
-
#
|
|
77
|
-
#
|
|
78
|
-
#
|
|
79
|
-
#
|
|
80
|
-
#
|
|
81
|
-
#
|
|
82
|
-
#
|
|
83
|
-
#
|
|
84
|
-
#
|
|
85
|
-
#
|
|
86
|
-
#
|
|
87
|
-
#
|
|
88
|
-
#
|
|
89
|
-
#
|
|
90
|
-
#
|
|
91
|
-
#
|
|
92
|
-
#
|
|
93
|
-
#
|
|
134
|
+
|
|
135
|
+
# musllinux:
|
|
136
|
+
# needs: [lint, test]
|
|
137
|
+
# runs-on: ${{ matrix.platform.runner }}
|
|
138
|
+
# strategy:
|
|
139
|
+
# matrix:
|
|
140
|
+
# platform:
|
|
141
|
+
# - runner: ubuntu-latest
|
|
142
|
+
# target: x86_64
|
|
143
|
+
# # - runner: ubuntu-latest
|
|
144
|
+
# # target: x86
|
|
145
|
+
# # - runner: ubuntu-latest
|
|
146
|
+
# # target: aarch64
|
|
147
|
+
# # - runner: ubuntu-latest
|
|
148
|
+
# # target: armv7
|
|
149
|
+
# steps:
|
|
150
|
+
# - uses: actions/checkout@v4
|
|
151
|
+
# - uses: actions/setup-python@v5
|
|
152
|
+
# with:
|
|
153
|
+
# python-version: '>=3.12'
|
|
154
|
+
# - name: Build wheels
|
|
155
|
+
# uses: PyO3/maturin-action@v1
|
|
156
|
+
# with:
|
|
157
|
+
# target: ${{ matrix.platform.target }}
|
|
158
|
+
# args: --release --out dist --find-interpreter
|
|
159
|
+
# sccache: 'true'
|
|
160
|
+
# manylinux: musllinux_1_2
|
|
161
|
+
# - name: Upload wheels
|
|
162
|
+
# uses: actions/upload-artifact@v4
|
|
163
|
+
# with:
|
|
164
|
+
# name: wheels-musllinux-${{ matrix.platform.target }}
|
|
165
|
+
# path: dist
|
|
94
166
|
|
|
95
167
|
windows:
|
|
168
|
+
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
|
|
169
|
+
needs: [lint, test]
|
|
96
170
|
runs-on: ${{ matrix.platform.runner }}
|
|
97
171
|
strategy:
|
|
98
172
|
matrix:
|
|
99
173
|
platform:
|
|
100
174
|
- runner: windows-latest
|
|
101
175
|
target: x64
|
|
102
|
-
|
|
103
|
-
|
|
176
|
+
# - runner: windows-latest
|
|
177
|
+
# target: x86
|
|
104
178
|
steps:
|
|
105
179
|
- uses: actions/checkout@v4
|
|
106
180
|
- uses: actions/setup-python@v5
|
|
107
181
|
with:
|
|
108
182
|
python-version: 3.12
|
|
109
183
|
architecture: ${{ matrix.platform.target }}
|
|
184
|
+
- name: Update Cargo.toml Version
|
|
185
|
+
if: startsWith(github.ref, 'refs/tags/')
|
|
186
|
+
shell: pwsh
|
|
187
|
+
run: |
|
|
188
|
+
$VERSION = $env:GITHUB_REF -replace 'refs/tags/v',''
|
|
189
|
+
Write-Host "Setting version to $VERSION"
|
|
190
|
+
(Get-Content Cargo.toml) -replace '^version = ".*"', ('version = "' + $VERSION + '"') | Set-Content Cargo.toml
|
|
110
191
|
- name: Build wheels
|
|
111
192
|
uses: PyO3/maturin-action@v1
|
|
112
193
|
with:
|
|
113
194
|
target: ${{ matrix.platform.target }}
|
|
114
|
-
# args: --release --out dist --find-interpreter -b bin
|
|
115
195
|
args: --release --out dist --find-interpreter
|
|
116
196
|
sccache: 'true'
|
|
117
197
|
- name: Upload wheels
|
|
@@ -121,6 +201,8 @@ jobs:
|
|
|
121
201
|
path: dist
|
|
122
202
|
|
|
123
203
|
macos:
|
|
204
|
+
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
|
|
205
|
+
needs: [lint, test]
|
|
124
206
|
runs-on: ${{ matrix.platform.runner }}
|
|
125
207
|
strategy:
|
|
126
208
|
matrix:
|
|
@@ -134,11 +216,15 @@ jobs:
|
|
|
134
216
|
- uses: actions/setup-python@v5
|
|
135
217
|
with:
|
|
136
218
|
python-version: 3.12
|
|
219
|
+
- name: Update Cargo.toml Version
|
|
220
|
+
run: |
|
|
221
|
+
VERSION=${GITHUB_REF#refs/tags/v}
|
|
222
|
+
echo "Setting version to $VERSION"
|
|
223
|
+
sed -i '' "s/^version = \".*\"/version = \"$VERSION\"/" Cargo.toml
|
|
137
224
|
- name: Build wheels
|
|
138
225
|
uses: PyO3/maturin-action@v1
|
|
139
226
|
with:
|
|
140
227
|
target: ${{ matrix.platform.target }}
|
|
141
|
-
# args: --release --out dist --find-interpreter -b bin
|
|
142
228
|
args: --release --out dist --find-interpreter
|
|
143
229
|
sccache: 'true'
|
|
144
230
|
- name: Upload wheels
|
|
@@ -147,51 +233,21 @@ jobs:
|
|
|
147
233
|
name: wheels-macos-${{ matrix.platform.target }}
|
|
148
234
|
path: dist
|
|
149
235
|
|
|
150
|
-
# emscripten:
|
|
151
|
-
# runs-on: ${{ matrix.platform.runner }}
|
|
152
|
-
# strategy:
|
|
153
|
-
# matrix:
|
|
154
|
-
# platform:
|
|
155
|
-
# - runner: ubuntu-latest
|
|
156
|
-
# target: wasm32-unknown-emscripten
|
|
157
|
-
# steps:
|
|
158
|
-
# - uses: actions/checkout@v4
|
|
159
|
-
# - uses: actions/setup-python@v5
|
|
160
|
-
# with:
|
|
161
|
-
# python-version: 3.12
|
|
162
|
-
# - run: pip install pyodide-build
|
|
163
|
-
# - name: Get Emscripten and Python version info
|
|
164
|
-
# shell: bash
|
|
165
|
-
# run: |
|
|
166
|
-
# echo EMSCRIPTEN_VERSION=$(pyodide config get emscripten_version) >> $GITHUB_ENV
|
|
167
|
-
# echo PYTHON_VERSION=$(pyodide config get python_version | cut -d '.' -f 1-2) >> $GITHUB_ENV
|
|
168
|
-
# pip uninstall -y pyodide-build
|
|
169
|
-
# - uses: mymindstorm/setup-emsdk@v12
|
|
170
|
-
# with:
|
|
171
|
-
# version: ${{ env.EMSCRIPTEN_VERSION }}
|
|
172
|
-
# actions-cache-folder: emsdk-cache
|
|
173
|
-
# - uses: actions/setup-python@v5
|
|
174
|
-
# with:
|
|
175
|
-
# python-version: ${{ env.PYTHON_VERSION }}
|
|
176
|
-
# - run: pip install pyodide-build
|
|
177
|
-
# - name: Build wheels
|
|
178
|
-
# uses: PyO3/maturin-action@v1
|
|
179
|
-
# with:
|
|
180
|
-
# target: ${{ matrix.platform.target }}
|
|
181
|
-
# # args: --release --out dist -i ${{ env.PYTHON_VERSION }} -b bin
|
|
182
|
-
# args: --release --out dist -i ${{ env.PYTHON_VERSION }}
|
|
183
|
-
# sccache: 'true'
|
|
184
|
-
# rust-toolchain: nightly
|
|
185
|
-
# - name: Upload wheels
|
|
186
|
-
# uses: actions/upload-artifact@v4
|
|
187
|
-
# with:
|
|
188
|
-
# name: wheels-wasm
|
|
189
|
-
# path: dist
|
|
190
|
-
|
|
191
236
|
sdist:
|
|
237
|
+
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
|
|
238
|
+
needs: [lint, test]
|
|
192
239
|
runs-on: ubuntu-latest
|
|
193
240
|
steps:
|
|
194
241
|
- uses: actions/checkout@v4
|
|
242
|
+
- uses: actions/setup-python@v5
|
|
243
|
+
with:
|
|
244
|
+
python-version: 3.12
|
|
245
|
+
- name: Update Cargo.toml Version
|
|
246
|
+
if: startsWith(github.ref, 'refs/tags/')
|
|
247
|
+
run: |
|
|
248
|
+
VERSION=${GITHUB_REF#refs/tags/v}
|
|
249
|
+
echo "Setting version to $VERSION"
|
|
250
|
+
sed -i "s/^version = \".*\"/version = \"$VERSION\"/" Cargo.toml
|
|
195
251
|
- name: Build sdist
|
|
196
252
|
uses: PyO3/maturin-action@v1
|
|
197
253
|
with:
|
|
@@ -206,10 +262,8 @@ jobs:
|
|
|
206
262
|
release:
|
|
207
263
|
name: Release
|
|
208
264
|
runs-on: ubuntu-latest
|
|
209
|
-
environment: release
|
|
210
265
|
if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
|
|
211
|
-
|
|
212
|
-
needs: [linux, windows, macos, sdist]
|
|
266
|
+
needs: [linux, linux-x64, windows, macos, sdist]
|
|
213
267
|
permissions:
|
|
214
268
|
# Use to sign the release artifacts
|
|
215
269
|
id-token: write
|
|
@@ -219,12 +273,15 @@ jobs:
|
|
|
219
273
|
attestations: write
|
|
220
274
|
steps:
|
|
221
275
|
- uses: actions/download-artifact@v4
|
|
276
|
+
- uses: actions/setup-python@v5
|
|
277
|
+
with:
|
|
278
|
+
python-version: 3.12
|
|
222
279
|
- name: Generate artifact attestation
|
|
223
280
|
uses: actions/attest-build-provenance@v1
|
|
224
281
|
with:
|
|
225
282
|
subject-path: 'wheels-*/*'
|
|
226
283
|
- name: Publish to PyPI
|
|
227
|
-
if:
|
|
284
|
+
if: startsWith(github.ref, 'refs/tags/')
|
|
228
285
|
uses: PyO3/maturin-action@v1
|
|
229
286
|
with:
|
|
230
287
|
command: upload
|
|
@@ -238,39 +295,3 @@ jobs:
|
|
|
238
295
|
wheels-linux-*/*.whl
|
|
239
296
|
wheels-macos-*/*.whl
|
|
240
297
|
prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') }}
|
|
241
|
-
# - name: Extract binary and rename
|
|
242
|
-
# env:
|
|
243
|
-
# PROJECT_NAME: ${{ env.PROJECT_NAME }}
|
|
244
|
-
# run: |
|
|
245
|
-
# for wheel_dir in wheels-windows-* wheels-linux-* wheels-macos-*; do
|
|
246
|
-
# arch=$(echo $wheel_dir | cut -d'-' -f3)
|
|
247
|
-
# os=$(echo $wheel_dir | cut -d'-' -f2)
|
|
248
|
-
# find ./$wheel_dir -name "*.whl" -exec sh -c '
|
|
249
|
-
# wheel_name=$(basename "$1")
|
|
250
|
-
# version=$(echo $wheel_name | sed -E "s/.*-([0-9]+\.[0-9]+\.[0-9]+)-.*/\1/")
|
|
251
|
-
# unzip -d "$(dirname "$1")" "$1"
|
|
252
|
-
# if [ "$2" = "windows" ]; then
|
|
253
|
-
# binary_path=$(find "$(dirname "$1")" -name "*.exe")
|
|
254
|
-
# if [ -n "$binary_path" ]; then
|
|
255
|
-
# mv "$binary_path" "$(dirname "$binary_path")/${PROJECT_NAME}_${version}_${2}_${3}.exe"
|
|
256
|
-
# fi
|
|
257
|
-
# else
|
|
258
|
-
# binary_path=$(find "$(dirname "$1")" -type f -executable)
|
|
259
|
-
# if [ -n "$binary_path" ]; then
|
|
260
|
-
# mv "$binary_path" "$(dirname "$binary_path")/${PROJECT_NAME}_${version}_${2}_${3}"
|
|
261
|
-
# fi
|
|
262
|
-
# fi
|
|
263
|
-
# ' _ {} "$os" "$arch" \;
|
|
264
|
-
# done
|
|
265
|
-
# - name: Upload to GitHub Release
|
|
266
|
-
# uses: softprops/action-gh-release@v2
|
|
267
|
-
# with:
|
|
268
|
-
# files: |
|
|
269
|
-
# wheels-sdist/*.tar.gz
|
|
270
|
-
# wheels-windows-*/*.whl
|
|
271
|
-
# wheels-windows-*/*.data/scripts/${{ env.PROJECT_NAME }}_*_windows_*.exe
|
|
272
|
-
# wheels-linux-*/*.whl
|
|
273
|
-
# wheels-linux-*/*.data/scripts/${{ env.PROJECT_NAME }}_*_linux_*
|
|
274
|
-
# wheels-macos-*/*.whl
|
|
275
|
-
# wheels-macos-*/*.data/scripts/${{ env.PROJECT_NAME }}_*_macos_*
|
|
276
|
-
# prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') }}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: nc-gcode-interpreter
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.7
|
|
4
4
|
Classifier: Programming Language :: Rust
|
|
5
5
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
6
6
|
Classifier: Programming Language :: Python :: 3.12
|
|
@@ -9,10 +9,14 @@ Classifier: Operating System :: OS Independent
|
|
|
9
9
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
10
10
|
Requires-Dist: maturin >=1.7.4
|
|
11
11
|
Requires-Dist: polars >=1.9.0
|
|
12
|
+
Requires-Dist: jupyter >=1.1.1 ; extra == 'dev'
|
|
13
|
+
Requires-Dist: pytest >=8.3.3 ; extra == 'test'
|
|
14
|
+
Provides-Extra: dev
|
|
15
|
+
Provides-Extra: test
|
|
12
16
|
License-File: LICENSE
|
|
13
17
|
Summary: A interpreter for NC (Numerical Control) code
|
|
14
18
|
Author-email: CEAD Group <software@ceadgroup.com>
|
|
15
|
-
Requires-Python: >=3.
|
|
19
|
+
Requires-Python: >=3.11
|
|
16
20
|
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
17
21
|
Project-URL: Homepage, https://github.com/CEAD-group/nc-gcode-interpreter
|
|
18
22
|
Project-URL: Repository, https://github.com/CEAD-group/nc-gcode-interpreter.git
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
T="BALL_MILL_8MM_SHORT" M6
|
|
@@ -4,10 +4,10 @@ build-backend = "maturin"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "nc-gcode-interpreter"
|
|
7
|
-
|
|
7
|
+
dynamic = ["version"]
|
|
8
8
|
description = "A interpreter for NC (Numerical Control) code"
|
|
9
9
|
authors = [{ name = "CEAD Group", email = "software@ceadgroup.com" }]
|
|
10
|
-
requires-python = ">=3.
|
|
10
|
+
requires-python = ">=3.11"
|
|
11
11
|
classifiers = [
|
|
12
12
|
"Programming Language :: Rust",
|
|
13
13
|
"Programming Language :: Python :: Implementation :: CPython",
|
|
@@ -21,6 +21,14 @@ dependencies = [
|
|
|
21
21
|
"polars>=1.9.0"
|
|
22
22
|
]
|
|
23
23
|
|
|
24
|
+
[project.optional-dependencies]
|
|
25
|
+
dev = [
|
|
26
|
+
"jupyter>=1.1.1"
|
|
27
|
+
]
|
|
28
|
+
test = [
|
|
29
|
+
"pytest>=8.3.3"
|
|
30
|
+
]
|
|
31
|
+
|
|
24
32
|
[project.urls]
|
|
25
33
|
Homepage = "https://github.com/CEAD-group/nc-gcode-interpreter"
|
|
26
34
|
Repository = "https://github.com/CEAD-group/nc-gcode-interpreter.git"
|
{nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.7}/python/tests/test_expected_output.py
RENAMED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import pathlib
|
|
2
2
|
import pytest
|
|
3
3
|
from nc_gcode_interpreter import nc_to_dataframe
|
|
4
|
-
from polars import DataFrame
|
|
5
4
|
|
|
6
5
|
|
|
7
6
|
@pytest.fixture(
|
|
@@ -33,7 +32,7 @@ def test_mpf_file_to_csv(mpf_file, initial_state):
|
|
|
33
32
|
"""
|
|
34
33
|
Test the nc_to_dataframe function with each .mpf file, using the default initial state.
|
|
35
34
|
"""
|
|
36
|
-
|
|
35
|
+
nc_to_dataframe(
|
|
37
36
|
mpf_file.read_text(),
|
|
38
37
|
initial_state=initial_state,
|
|
39
38
|
iteration_limit=10000,
|
|
@@ -2,6 +2,7 @@ file = { SOI ~ blocks ~ newline? ~ EOI }
|
|
|
2
2
|
blocks = { block ~ (newline ~ block)* }
|
|
3
3
|
newline = _{ "\n" | "\r\n" }
|
|
4
4
|
WHITESPACE = _{ " " | "\t" }
|
|
5
|
+
QUOTE = _{ "\"" }
|
|
5
6
|
comment = { ";" ~ (!newline ~ ANY)* }
|
|
6
7
|
block = { block_number_set? ~ (definition | frame_op | control | statement*) ~ comment? }
|
|
7
8
|
block_number_set = _{ "N" ~ block_number }
|
|
@@ -33,11 +34,11 @@ relational_operator = { "<=" | ">=" | "<" | ">" | "==" | "<>" }
|
|
|
33
34
|
statement = {
|
|
34
35
|
g_command_numbered
|
|
35
36
|
| m_command
|
|
37
|
+
| tool_selection
|
|
36
38
|
| assignment_multi
|
|
37
39
|
| assignment
|
|
38
40
|
| g_command
|
|
39
41
|
| function_call
|
|
40
|
-
| tool_selection
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
// local variable definitions
|
|
@@ -103,7 +104,7 @@ primary = { value | variable_array | variable | "(" ~ expression ~ ")"
|
|
|
103
104
|
float = @{ "-"? ~ ASCII_DIGIT+ ~ "." ~ ASCII_DIGIT* }
|
|
104
105
|
integer = @{ "-"? ~ ASCII_DIGIT+ }
|
|
105
106
|
|
|
106
|
-
tool_selection = { "T" ~ "=" ~
|
|
107
|
+
tool_selection = { ^"T" ~ "=" ~ quoted_string }
|
|
107
108
|
|
|
108
109
|
// frame instructions
|
|
109
110
|
frame_op = { frame_trans | frame_scale | frame_atrans | frame_ascale }
|
|
@@ -113,14 +114,15 @@ frame_atrans = { ^"ATRANS" ~ assignment+ }
|
|
|
113
114
|
frame_ascale = { ^"ASCALE" ~ assignment+ }
|
|
114
115
|
|
|
115
116
|
// function call parser
|
|
116
|
-
function_call =
|
|
117
|
-
function_arguments =
|
|
118
|
-
|
|
117
|
+
function_call = { identifier ~ ("(" ~ function_arguments? ~ ")")? }
|
|
118
|
+
function_arguments = { ((expression | quoted_string)? ~ ",")* ~ (expression | quoted_string) }
|
|
119
|
+
quoted_string = _{ QUOTE ~ (string)* ~ QUOTE }
|
|
120
|
+
string = { (!"\"" ~ ANY)+ }
|
|
119
121
|
|
|
120
122
|
// builtins, globally available names
|
|
121
123
|
nc_variable = { "$" ~ identifier }
|
|
122
124
|
|
|
123
|
-
m_command = { "M" ~ ASCII_DIGIT+ }
|
|
125
|
+
m_command = { ^"M" ~ ASCII_DIGIT+ }
|
|
124
126
|
|
|
125
127
|
// G-Code ggroups
|
|
126
128
|
// This Pest grammar file is auto-generated from G-Code definitions.
|
|
@@ -116,6 +116,39 @@ fn interpret_m_command(m_command: Pair<Rule>) -> (String, String) {
|
|
|
116
116
|
// Return the tuple with the rule name as the column header and the specific M command as the value
|
|
117
117
|
("M".to_string(), command_str)
|
|
118
118
|
}
|
|
119
|
+
fn interpret_tool_selection(
|
|
120
|
+
tool_selection: Pair<Rule>,
|
|
121
|
+
output: &mut Output,
|
|
122
|
+
_state: &mut State,
|
|
123
|
+
) -> Result<(), ParsingError> {
|
|
124
|
+
// Get the last HashMap from the output vector to insert the tool selection.
|
|
125
|
+
let last = output.last_mut().expect("Output vector should not be empty");
|
|
126
|
+
|
|
127
|
+
// Since `tool_selection` = { ^"T" ~ "=" ~ quoted_string }
|
|
128
|
+
// and `quoted_string` is silent, the `tool_selection` pair will directly contain the `string` pairs.
|
|
129
|
+
let mut tool_name = String::new();
|
|
130
|
+
|
|
131
|
+
// Iterate over the inner pairs to collect the strings.
|
|
132
|
+
for pair in tool_selection.into_inner() {
|
|
133
|
+
match pair.as_rule() {
|
|
134
|
+
Rule::string => {
|
|
135
|
+
tool_name.push_str(pair.as_str());
|
|
136
|
+
}
|
|
137
|
+
_ => {
|
|
138
|
+
// Handle unexpected rules.
|
|
139
|
+
return Err(ParsingError::UnexpectedRule {
|
|
140
|
+
rule: pair.as_rule(),
|
|
141
|
+
context: "interpret_tool_selection".to_string(),
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// Insert the tool name into the output.
|
|
148
|
+
last.insert("T".to_string(), Value::Str(tool_name));
|
|
149
|
+
|
|
150
|
+
Ok(())
|
|
151
|
+
}
|
|
119
152
|
fn interpret_function_call(function_call: Pair<Rule>) -> (String, String) {
|
|
120
153
|
// Log the interpretd function call for debugging
|
|
121
154
|
//println!("Parsed function call: {:?}", function_call);
|
|
@@ -489,7 +522,6 @@ fn interpret_control(element: Pair<Rule>, output: &mut Output, state: &mut State
|
|
|
489
522
|
_ => panic!("Unexpected rule: {:?}", pair.as_rule()),
|
|
490
523
|
}
|
|
491
524
|
}
|
|
492
|
-
|
|
493
525
|
fn insert_m_key(last: &mut HashMap<String, Value>, value: &str) -> Result<(), ParsingError> {
|
|
494
526
|
let m_key = "M";
|
|
495
527
|
for _i in 1..=5 {
|
|
@@ -509,7 +541,6 @@ fn insert_m_key(last: &mut HashMap<String, Value>, value: &str) -> Result<(), Pa
|
|
|
509
541
|
}
|
|
510
542
|
Err(ParsingError::TooManyMCommands) // Return error if all keys are full
|
|
511
543
|
}
|
|
512
|
-
|
|
513
544
|
fn interpret_statement(element: Pair<Rule>, output: &mut Output, state: &mut State) -> Result<(), ParsingError> {
|
|
514
545
|
// Grammar:
|
|
515
546
|
// statement = {
|
|
@@ -550,7 +581,7 @@ fn interpret_statement(element: Pair<Rule>, output: &mut Output, state: &mut Sta
|
|
|
550
581
|
last.insert(key, Value::Float(_updated_value));
|
|
551
582
|
}
|
|
552
583
|
}
|
|
553
|
-
Rule::tool_selection =>
|
|
584
|
+
Rule::tool_selection => interpret_tool_selection(statement, output, state)?,
|
|
554
585
|
_ => Err(ParsingError::UnexpectedRule {
|
|
555
586
|
rule: statement.as_rule(),
|
|
556
587
|
context: "interpret_statement".to_string(),
|