nc-gcode-interpreter 0.1.5__tar.gz → 0.1.8__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.8}/.github/workflows/build-and-release.yml +149 -127
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.8}/Cargo.lock +1 -1
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.8}/Cargo.toml +1 -1
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.8}/Development.md +1 -1
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.8}/PKG-INFO +9 -3
- nc_gcode_interpreter-0.1.8/examples/function_calls.csv +3 -0
- nc_gcode_interpreter-0.1.8/examples/function_calls.mpf +2 -0
- nc_gcode_interpreter-0.1.8/examples/tool.csv +2 -0
- nc_gcode_interpreter-0.1.8/examples/tool.mpf +1 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.8}/ggroups/generate_pest.py +1 -1
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.8}/pyproject.toml +20 -8
- nc_gcode_interpreter-0.1.8/python/nc_gcode_interpreter/__init__.py +127 -0
- nc_gcode_interpreter-0.1.8/python/nc_gcode_interpreter/_internal.pyi +41 -0
- nc_gcode_interpreter-0.1.8/python/nc_gcode_interpreter/py.typed +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.8}/python/tests/test_expected_output.py +1 -2
- nc_gcode_interpreter-0.1.8/python/tests/test_g_groups.py +23 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.8}/src/grammar.pest +8 -6
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.8}/src/interpret_rules.rs +34 -3
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.8}/src/lib.rs +1 -1
- nc_gcode_interpreter-0.1.8/uv.lock +1580 -0
- nc_gcode_interpreter-0.1.5/Example.MPF +0 -14
- nc_gcode_interpreter-0.1.5/python/nc_gcode_interpreter/__init__.py +0 -33
- nc_gcode_interpreter-0.1.5/uv.lock +0 -33
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.8}/.gitignore +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.8}/CONTRIBUTING.md +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.8}/LICENSE +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.8}/README.md +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.8}/TODO.md +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.8}/examples/arrays.csv +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.8}/examples/arrays.mpf +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.8}/examples/basic_math.csv +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.8}/examples/basic_math.mpf +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.8}/examples/custom_vars.csv +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.8}/examples/custom_vars.mpf +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.8}/examples/defaults.csv +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.8}/examples/defaults.mpf +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.8}/examples/for_loop.csv +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.8}/examples/for_loop.mpf +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.8}/examples/if_statement.csv +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.8}/examples/if_statement.mpf +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.8}/examples/increment.csv +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.8}/examples/increment.mpf +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.8}/examples/loop.csv +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.8}/examples/loop.mpf +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.8}/examples/multiple_m_codes.csv +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.8}/examples/multiple_m_codes.mpf +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.8}/examples/simple.csv +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.8}/examples/simple.mpf +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.8}/examples/trans.csv +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.8}/examples/trans.mpf +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.8}/examples/variables.csv +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.8}/examples/variables.mpf +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.8}/ggroups/generate_modal_ggroups.py +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.8}/ggroups/ggroups.pest +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.8}/ggroups/modal_groups.rs +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.8}/python/example/minimal.py +0 -0
- {nc_gcode_interpreter-0.1.5/ggroups → nc_gcode_interpreter-0.1.8/python/nc_gcode_interpreter}/ggroups.json +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.8}/rustfmt.toml +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.8}/src/errors.rs +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.8}/src/interpreter.rs +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.8}/src/main.rs +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.8}/src/modal_groups.rs +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.8}/src/state.rs +0 -0
- {nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.8}/src/types.rs +0 -0
{nc_gcode_interpreter-0.1.5 → nc_gcode_interpreter-0.1.8}/.github/workflows/build-and-release.yml
RENAMED
|
@@ -13,44 +13,116 @@ 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
|
+
- name: Type checking with mypy
|
|
93
|
+
run: mypy python
|
|
94
|
+
linux:
|
|
95
|
+
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
|
|
96
|
+
needs: [lint, test]
|
|
97
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
98
|
+
strategy:
|
|
99
|
+
matrix:
|
|
100
|
+
platform:
|
|
101
|
+
# - runner: ubuntu-latest
|
|
102
|
+
# target: x86
|
|
36
103
|
- runner: ubuntu-latest
|
|
37
104
|
target: aarch64
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
105
|
+
# - runner: ubuntu-latest
|
|
106
|
+
# target: armv7
|
|
107
|
+
# - runner: ubuntu-latest
|
|
108
|
+
# target: s390x
|
|
109
|
+
# - runner: ubuntu-latest
|
|
110
|
+
# target: ppc64le
|
|
44
111
|
steps:
|
|
45
112
|
- uses: actions/checkout@v4
|
|
46
113
|
- uses: actions/setup-python@v5
|
|
47
114
|
with:
|
|
48
115
|
python-version: 3.12
|
|
116
|
+
- name: Update Cargo.toml Version
|
|
117
|
+
if: startsWith(github.ref, 'refs/tags/')
|
|
118
|
+
run: |
|
|
119
|
+
VERSION=${GITHUB_REF#refs/tags/v}
|
|
120
|
+
echo "Setting version to $VERSION"
|
|
121
|
+
sed -i "s/^version = \".*\"/version = \"$VERSION\"/" Cargo.toml
|
|
49
122
|
- name: Build wheels
|
|
50
123
|
uses: PyO3/maturin-action@v1
|
|
51
124
|
with:
|
|
52
125
|
target: ${{ matrix.platform.target }}
|
|
53
|
-
# args: --release --out dist --find-interpreter -b bin
|
|
54
126
|
args: --release --out dist --find-interpreter
|
|
55
127
|
sccache: 'true'
|
|
56
128
|
manylinux: auto
|
|
@@ -60,58 +132,67 @@ jobs:
|
|
|
60
132
|
name: wheels-linux-${{ matrix.platform.target }}
|
|
61
133
|
path: dist
|
|
62
134
|
|
|
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
|
-
#
|
|
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
|
|
94
167
|
|
|
95
168
|
windows:
|
|
169
|
+
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
|
|
170
|
+
needs: [lint, test]
|
|
96
171
|
runs-on: ${{ matrix.platform.runner }}
|
|
97
172
|
strategy:
|
|
98
173
|
matrix:
|
|
99
174
|
platform:
|
|
100
175
|
- runner: windows-latest
|
|
101
176
|
target: x64
|
|
102
|
-
|
|
103
|
-
|
|
177
|
+
# - runner: windows-latest
|
|
178
|
+
# target: x86
|
|
104
179
|
steps:
|
|
105
180
|
- uses: actions/checkout@v4
|
|
106
181
|
- uses: actions/setup-python@v5
|
|
107
182
|
with:
|
|
108
183
|
python-version: 3.12
|
|
109
184
|
architecture: ${{ matrix.platform.target }}
|
|
185
|
+
- name: Update Cargo.toml Version
|
|
186
|
+
if: startsWith(github.ref, 'refs/tags/')
|
|
187
|
+
shell: pwsh
|
|
188
|
+
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
|
|
110
192
|
- name: Build wheels
|
|
111
193
|
uses: PyO3/maturin-action@v1
|
|
112
194
|
with:
|
|
113
195
|
target: ${{ matrix.platform.target }}
|
|
114
|
-
# args: --release --out dist --find-interpreter -b bin
|
|
115
196
|
args: --release --out dist --find-interpreter
|
|
116
197
|
sccache: 'true'
|
|
117
198
|
- name: Upload wheels
|
|
@@ -121,6 +202,8 @@ jobs:
|
|
|
121
202
|
path: dist
|
|
122
203
|
|
|
123
204
|
macos:
|
|
205
|
+
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
|
|
206
|
+
needs: [lint, test]
|
|
124
207
|
runs-on: ${{ matrix.platform.runner }}
|
|
125
208
|
strategy:
|
|
126
209
|
matrix:
|
|
@@ -134,11 +217,15 @@ jobs:
|
|
|
134
217
|
- uses: actions/setup-python@v5
|
|
135
218
|
with:
|
|
136
219
|
python-version: 3.12
|
|
220
|
+
- name: Update Cargo.toml Version
|
|
221
|
+
run: |
|
|
222
|
+
VERSION=${GITHUB_REF#refs/tags/v}
|
|
223
|
+
echo "Setting version to $VERSION"
|
|
224
|
+
sed -i '' "s/^version = \".*\"/version = \"$VERSION\"/" Cargo.toml
|
|
137
225
|
- name: Build wheels
|
|
138
226
|
uses: PyO3/maturin-action@v1
|
|
139
227
|
with:
|
|
140
228
|
target: ${{ matrix.platform.target }}
|
|
141
|
-
# args: --release --out dist --find-interpreter -b bin
|
|
142
229
|
args: --release --out dist --find-interpreter
|
|
143
230
|
sccache: 'true'
|
|
144
231
|
- name: Upload wheels
|
|
@@ -147,51 +234,21 @@ jobs:
|
|
|
147
234
|
name: wheels-macos-${{ matrix.platform.target }}
|
|
148
235
|
path: dist
|
|
149
236
|
|
|
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
237
|
sdist:
|
|
238
|
+
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
|
|
239
|
+
needs: [lint, test]
|
|
192
240
|
runs-on: ubuntu-latest
|
|
193
241
|
steps:
|
|
194
242
|
- uses: actions/checkout@v4
|
|
243
|
+
- uses: actions/setup-python@v5
|
|
244
|
+
with:
|
|
245
|
+
python-version: 3.12
|
|
246
|
+
- name: Update Cargo.toml Version
|
|
247
|
+
if: startsWith(github.ref, 'refs/tags/')
|
|
248
|
+
run: |
|
|
249
|
+
VERSION=${GITHUB_REF#refs/tags/v}
|
|
250
|
+
echo "Setting version to $VERSION"
|
|
251
|
+
sed -i "s/^version = \".*\"/version = \"$VERSION\"/" Cargo.toml
|
|
195
252
|
- name: Build sdist
|
|
196
253
|
uses: PyO3/maturin-action@v1
|
|
197
254
|
with:
|
|
@@ -206,10 +263,8 @@ jobs:
|
|
|
206
263
|
release:
|
|
207
264
|
name: Release
|
|
208
265
|
runs-on: ubuntu-latest
|
|
209
|
-
environment: release
|
|
210
266
|
if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
|
|
211
|
-
|
|
212
|
-
needs: [linux, windows, macos, sdist]
|
|
267
|
+
needs: [linux, linux-x64, windows, macos, sdist]
|
|
213
268
|
permissions:
|
|
214
269
|
# Use to sign the release artifacts
|
|
215
270
|
id-token: write
|
|
@@ -219,12 +274,15 @@ jobs:
|
|
|
219
274
|
attestations: write
|
|
220
275
|
steps:
|
|
221
276
|
- uses: actions/download-artifact@v4
|
|
277
|
+
- uses: actions/setup-python@v5
|
|
278
|
+
with:
|
|
279
|
+
python-version: 3.12
|
|
222
280
|
- name: Generate artifact attestation
|
|
223
281
|
uses: actions/attest-build-provenance@v1
|
|
224
282
|
with:
|
|
225
283
|
subject-path: 'wheels-*/*'
|
|
226
284
|
- name: Publish to PyPI
|
|
227
|
-
if:
|
|
285
|
+
if: startsWith(github.ref, 'refs/tags/')
|
|
228
286
|
uses: PyO3/maturin-action@v1
|
|
229
287
|
with:
|
|
230
288
|
command: upload
|
|
@@ -238,39 +296,3 @@ jobs:
|
|
|
238
296
|
wheels-linux-*/*.whl
|
|
239
297
|
wheels-macos-*/*.whl
|
|
240
298
|
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,18 +1,24 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: nc-gcode-interpreter
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.8
|
|
4
4
|
Classifier: Programming Language :: Rust
|
|
5
5
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
6
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
6
7
|
Classifier: Programming Language :: Python :: 3.12
|
|
7
8
|
Classifier: License :: OSI Approved :: MIT License
|
|
8
9
|
Classifier: Operating System :: OS Independent
|
|
9
10
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
10
11
|
Requires-Dist: maturin >=1.7.4
|
|
11
12
|
Requires-Dist: polars >=1.9.0
|
|
13
|
+
Requires-Dist: jupyter >=1.1.1 ; extra == 'dev'
|
|
14
|
+
Requires-Dist: pytest >=8.3.3 ; extra == 'test'
|
|
15
|
+
Requires-Dist: mypy ; extra == 'test'
|
|
16
|
+
Provides-Extra: dev
|
|
17
|
+
Provides-Extra: test
|
|
12
18
|
License-File: LICENSE
|
|
13
|
-
Summary: A interpreter for NC (Numerical Control)
|
|
19
|
+
Summary: A interpreter for NC (Numerical Control) GCode
|
|
14
20
|
Author-email: CEAD Group <software@ceadgroup.com>
|
|
15
|
-
Requires-Python: >=3.
|
|
21
|
+
Requires-Python: >=3.11
|
|
16
22
|
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
17
23
|
Project-URL: Homepage, https://github.com/CEAD-group/nc-gcode-interpreter
|
|
18
24
|
Project-URL: Repository, https://github.com/CEAD-group/nc-gcode-interpreter.git
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
T="BALL_MILL_8MM_SHORT" M6
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
[build-system]
|
|
2
|
-
requires = ["maturin>=1.
|
|
2
|
+
requires = ["maturin>=1.7,<2.0"]
|
|
3
3
|
build-backend = "maturin"
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "nc-gcode-interpreter"
|
|
7
|
-
|
|
8
|
-
description = "A interpreter for NC (Numerical Control)
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "A interpreter for NC (Numerical Control) GCode"
|
|
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",
|
|
14
|
+
"Programming Language :: Python :: 3.11",
|
|
14
15
|
"Programming Language :: Python :: 3.12",
|
|
15
16
|
"License :: OSI Approved :: MIT License",
|
|
16
17
|
"Operating System :: OS Independent",
|
|
@@ -21,11 +22,22 @@ dependencies = [
|
|
|
21
22
|
"polars>=1.9.0"
|
|
22
23
|
]
|
|
23
24
|
|
|
24
|
-
[project.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
[project.optional-dependencies]
|
|
26
|
+
dev = [
|
|
27
|
+
"jupyter>=1.1.1"
|
|
28
|
+
]
|
|
29
|
+
test = [
|
|
30
|
+
"pytest>=8.3.3",
|
|
31
|
+
"mypy"
|
|
32
|
+
]
|
|
28
33
|
|
|
29
34
|
[tool.maturin]
|
|
30
35
|
features = ["pyo3/extension-module"]
|
|
36
|
+
module-name = "nc_gcode_interpreter._internal"
|
|
31
37
|
python-source = "python"
|
|
38
|
+
include = ["python/nc_gcode_interpreter/py.typed", "python/nc_gcode_interpreter/ggroups.json"]
|
|
39
|
+
|
|
40
|
+
[project.urls]
|
|
41
|
+
Homepage = "https://github.com/CEAD-group/nc-gcode-interpreter"
|
|
42
|
+
Repository = "https://github.com/CEAD-group/nc-gcode-interpreter.git"
|
|
43
|
+
Documentation = "https://github.com/CEAD-group/nc-gcode-interpreter/blob/main/README.md"
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
from typing import Protocol
|
|
2
|
+
import polars as pl
|
|
3
|
+
from ._internal import nc_to_dataframe as _nc_to_dataframe
|
|
4
|
+
from ._internal import __doc__ # noqa: F401
|
|
5
|
+
import json
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from typing import TypedDict, TypeVar, Any, Type, Callable, Generic
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# Define TextFileLike Protocol
|
|
11
|
+
class TextFileLike(Protocol):
|
|
12
|
+
def read(self) -> str: ...
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
__all__ = ["nc_to_dataframe"]
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def nc_to_dataframe(
|
|
19
|
+
input: "TextFileLike | str",
|
|
20
|
+
initial_state: "TextFileLike | str | None" = None,
|
|
21
|
+
axis_identifiers: "list[str] | None" = None,
|
|
22
|
+
extra_axes: "list[str] | None" = None,
|
|
23
|
+
iteration_limit: int = 10000,
|
|
24
|
+
disable_forward_fill: bool = False,
|
|
25
|
+
) -> tuple[pl.DataFrame, dict]:
|
|
26
|
+
"""
|
|
27
|
+
Convert G-code to a DataFrame representation along with the state information.
|
|
28
|
+
|
|
29
|
+
Parameters:
|
|
30
|
+
-----------
|
|
31
|
+
input: TextFileLike | str
|
|
32
|
+
The G-code input as a string or a file-like object.
|
|
33
|
+
initial_state: TextFileLike | str | None
|
|
34
|
+
An optional initial state string or a file-like object.
|
|
35
|
+
axis_identifiers: list[str] | None
|
|
36
|
+
A list of axis identifiers.
|
|
37
|
+
extra_axes: list[str] | None
|
|
38
|
+
A list of extra axes to be included.
|
|
39
|
+
iteration_limit: int
|
|
40
|
+
The maximum number of iterations to process.
|
|
41
|
+
disable_forward_fill: bool
|
|
42
|
+
Whether to disable forward-filling of values.
|
|
43
|
+
|
|
44
|
+
Returns:
|
|
45
|
+
--------
|
|
46
|
+
tuple[pl.DataFrame, dict]
|
|
47
|
+
A tuple containing the resulting DataFrame and a nested dictionary representing the state.
|
|
48
|
+
"""
|
|
49
|
+
if input is None:
|
|
50
|
+
raise ValueError("input cannot be None")
|
|
51
|
+
if not isinstance(input, str):
|
|
52
|
+
input = input.read()
|
|
53
|
+
if initial_state is not None and not isinstance(initial_state, str):
|
|
54
|
+
initial_state = initial_state.read()
|
|
55
|
+
|
|
56
|
+
df, state = _nc_to_dataframe(
|
|
57
|
+
input,
|
|
58
|
+
initial_state,
|
|
59
|
+
axis_identifiers,
|
|
60
|
+
extra_axes,
|
|
61
|
+
iteration_limit,
|
|
62
|
+
disable_forward_fill,
|
|
63
|
+
)
|
|
64
|
+
return df, state
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
_T = TypeVar("_T")
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
class _classproperty(Generic[_T]):
|
|
71
|
+
def __init__(self, fget: Callable[[Any], _T]) -> None:
|
|
72
|
+
self.fget = fget
|
|
73
|
+
|
|
74
|
+
def __get__(self, instance: Any, owner: Type[Any]) -> _T:
|
|
75
|
+
return self.fget(owner)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
class _GGroupEntry(TypedDict):
|
|
79
|
+
id: str
|
|
80
|
+
nr: int
|
|
81
|
+
description: str
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
class _GGroup(TypedDict):
|
|
85
|
+
nr: int
|
|
86
|
+
title: str
|
|
87
|
+
effectiveness: str
|
|
88
|
+
short_name: str
|
|
89
|
+
entries: list[_GGroupEntry]
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
class GGroups:
|
|
93
|
+
_g_groups: list[_GGroup] | None = None
|
|
94
|
+
_g_group_short_names: set[str] | None = None
|
|
95
|
+
_g_groups_by_short_name: dict[str, _GGroup] | None = None
|
|
96
|
+
|
|
97
|
+
@_classproperty
|
|
98
|
+
def g_groups(cls) -> list[_GGroup]:
|
|
99
|
+
if cls._g_groups is None:
|
|
100
|
+
cls._load_data()
|
|
101
|
+
assert cls._g_groups is not None
|
|
102
|
+
return cls._g_groups
|
|
103
|
+
|
|
104
|
+
@classmethod
|
|
105
|
+
def _load_data(cls) -> None:
|
|
106
|
+
json_file = Path(__file__).parent / "ggroups.json"
|
|
107
|
+
with open(json_file, "r") as file:
|
|
108
|
+
g_groups = json.load(file)
|
|
109
|
+
cls._g_groups = g_groups
|
|
110
|
+
cls._g_group_short_names = {group["short_name"] for group in g_groups}
|
|
111
|
+
cls._g_groups_by_short_name = {
|
|
112
|
+
group["short_name"]: group for group in g_groups
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
@classmethod
|
|
116
|
+
def is_g_group(cls, name: str) -> bool:
|
|
117
|
+
if cls._g_group_short_names is None:
|
|
118
|
+
cls._load_data()
|
|
119
|
+
assert cls._g_group_short_names is not None
|
|
120
|
+
return name in cls._g_group_short_names
|
|
121
|
+
|
|
122
|
+
@classmethod
|
|
123
|
+
def is_modal_g_group(cls, name: str) -> bool:
|
|
124
|
+
if cls._g_groups_by_short_name is None:
|
|
125
|
+
cls._load_data()
|
|
126
|
+
assert cls._g_groups_by_short_name is not None
|
|
127
|
+
return cls._g_groups_by_short_name[name]["effectiveness"] == "modal"
|