nc-gcode-interpreter 0.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- nc_gcode_interpreter-0.1.2/.github/workflows/build-and-release.yml +263 -0
- nc_gcode_interpreter-0.1.2/.gitignore +28 -0
- nc_gcode_interpreter-0.1.2/CONTRIBUTING.md +39 -0
- nc_gcode_interpreter-0.1.2/Cargo.lock +2153 -0
- nc_gcode_interpreter-0.1.2/Cargo.toml +19 -0
- nc_gcode_interpreter-0.1.2/Development.md +46 -0
- nc_gcode_interpreter-0.1.2/Example.MPF +14 -0
- nc_gcode_interpreter-0.1.2/LICENSE +21 -0
- nc_gcode_interpreter-0.1.2/PKG-INFO +169 -0
- nc_gcode_interpreter-0.1.2/README.md +149 -0
- nc_gcode_interpreter-0.1.2/TODO.md +40 -0
- nc_gcode_interpreter-0.1.2/examples/arrays.csv +30 -0
- nc_gcode_interpreter-0.1.2/examples/arrays.mpf +15 -0
- nc_gcode_interpreter-0.1.2/examples/basic_math.csv +7 -0
- nc_gcode_interpreter-0.1.2/examples/basic_math.mpf +6 -0
- nc_gcode_interpreter-0.1.2/examples/custom_vars.csv +2 -0
- nc_gcode_interpreter-0.1.2/examples/custom_vars.mpf +1 -0
- nc_gcode_interpreter-0.1.2/examples/defaults.csv +3 -0
- nc_gcode_interpreter-0.1.2/examples/defaults.mpf +6 -0
- nc_gcode_interpreter-0.1.2/examples/for_loop.csv +18 -0
- nc_gcode_interpreter-0.1.2/examples/for_loop.mpf +5 -0
- nc_gcode_interpreter-0.1.2/examples/if_statement.csv +2 -0
- nc_gcode_interpreter-0.1.2/examples/if_statement.mpf +13 -0
- nc_gcode_interpreter-0.1.2/examples/increment.csv +4 -0
- nc_gcode_interpreter-0.1.2/examples/increment.mpf +4 -0
- nc_gcode_interpreter-0.1.2/examples/loop.csv +321 -0
- nc_gcode_interpreter-0.1.2/examples/loop.mpf +48 -0
- nc_gcode_interpreter-0.1.2/examples/multiple_m_codes.csv +10 -0
- nc_gcode_interpreter-0.1.2/examples/multiple_m_codes.mpf +5 -0
- nc_gcode_interpreter-0.1.2/examples/simple.csv +6 -0
- nc_gcode_interpreter-0.1.2/examples/simple.mpf +6 -0
- nc_gcode_interpreter-0.1.2/examples/trans.csv +4 -0
- nc_gcode_interpreter-0.1.2/examples/trans.mpf +7 -0
- nc_gcode_interpreter-0.1.2/examples/variables.csv +3 -0
- nc_gcode_interpreter-0.1.2/examples/variables.mpf +4 -0
- nc_gcode_interpreter-0.1.2/ggroups/generate_modal_ggroups.py +21 -0
- nc_gcode_interpreter-0.1.2/ggroups/generate_pest.py +45 -0
- nc_gcode_interpreter-0.1.2/ggroups/ggroups.json +2922 -0
- nc_gcode_interpreter-0.1.2/ggroups/ggroups.pest +63 -0
- nc_gcode_interpreter-0.1.2/ggroups/modal_groups.rs +57 -0
- nc_gcode_interpreter-0.1.2/pyproject.toml +31 -0
- nc_gcode_interpreter-0.1.2/python/example/minimal.py +17 -0
- nc_gcode_interpreter-0.1.2/python/nc_gcode_interpreter/__init__.py +33 -0
- nc_gcode_interpreter-0.1.2/python/tests/test_expected_output.py +41 -0
- nc_gcode_interpreter-0.1.2/rustfmt.toml +1 -0
- nc_gcode_interpreter-0.1.2/src/errors.rs +59 -0
- nc_gcode_interpreter-0.1.2/src/grammar.pest +249 -0
- nc_gcode_interpreter-0.1.2/src/interpret_rules.rs +645 -0
- nc_gcode_interpreter-0.1.2/src/interpreter.rs +230 -0
- nc_gcode_interpreter-0.1.2/src/lib.rs +43 -0
- nc_gcode_interpreter-0.1.2/src/main.rs +116 -0
- nc_gcode_interpreter-0.1.2/src/modal_groups.rs +57 -0
- nc_gcode_interpreter-0.1.2/src/state.rs +77 -0
- nc_gcode_interpreter-0.1.2/src/types.rs +27 -0
- nc_gcode_interpreter-0.1.2/uv.lock +33 -0
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
# This file is autogenerated by maturin v1.7.4
|
|
2
|
+
# To update, run
|
|
3
|
+
#
|
|
4
|
+
# maturin generate-ci github --platform all
|
|
5
|
+
#
|
|
6
|
+
# Edited to:
|
|
7
|
+
# - build using binary bindings
|
|
8
|
+
# - extract the binaries from the wheel
|
|
9
|
+
# - upload both the wheel and the binary to the release
|
|
10
|
+
# - disable some platforms
|
|
11
|
+
|
|
12
|
+
name: Build and Release
|
|
13
|
+
|
|
14
|
+
on:
|
|
15
|
+
push:
|
|
16
|
+
tags:
|
|
17
|
+
- 'v*'
|
|
18
|
+
workflow_dispatch:
|
|
19
|
+
|
|
20
|
+
permissions:
|
|
21
|
+
contents: write
|
|
22
|
+
|
|
23
|
+
env:
|
|
24
|
+
PROJECT_NAME: "nc-gcode-interpreter"
|
|
25
|
+
|
|
26
|
+
jobs:
|
|
27
|
+
linux:
|
|
28
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
29
|
+
strategy:
|
|
30
|
+
matrix:
|
|
31
|
+
platform:
|
|
32
|
+
- runner: ubuntu-latest
|
|
33
|
+
target: x86_64
|
|
34
|
+
# - runner: ubuntu-latest
|
|
35
|
+
# target: x86
|
|
36
|
+
- runner: ubuntu-latest
|
|
37
|
+
target: aarch64
|
|
38
|
+
# - runner: ubuntu-latest
|
|
39
|
+
# target: armv7
|
|
40
|
+
# - runner: ubuntu-latest
|
|
41
|
+
# target: s390x
|
|
42
|
+
# - runner: ubuntu-latest
|
|
43
|
+
# target: ppc64le
|
|
44
|
+
steps:
|
|
45
|
+
- uses: actions/checkout@v4
|
|
46
|
+
- uses: actions/setup-python@v5
|
|
47
|
+
with:
|
|
48
|
+
python-version: 3.12
|
|
49
|
+
- name: Build wheels
|
|
50
|
+
uses: PyO3/maturin-action@v1
|
|
51
|
+
with:
|
|
52
|
+
target: ${{ matrix.platform.target }}
|
|
53
|
+
args: --release --out dist --find-interpreter -b bin
|
|
54
|
+
sccache: 'true'
|
|
55
|
+
manylinux: auto
|
|
56
|
+
- name: Upload wheels
|
|
57
|
+
uses: actions/upload-artifact@v4
|
|
58
|
+
with:
|
|
59
|
+
name: wheels-linux-${{ matrix.platform.target }}
|
|
60
|
+
path: dist
|
|
61
|
+
|
|
62
|
+
# musllinux:
|
|
63
|
+
# runs-on: ${{ matrix.platform.runner }}
|
|
64
|
+
# strategy:
|
|
65
|
+
# matrix:
|
|
66
|
+
# platform:
|
|
67
|
+
# - runner: ubuntu-latest
|
|
68
|
+
# target: x86_64
|
|
69
|
+
# - runner: ubuntu-latest
|
|
70
|
+
# target: x86
|
|
71
|
+
# - runner: ubuntu-latest
|
|
72
|
+
# target: aarch64
|
|
73
|
+
# - runner: ubuntu-latest
|
|
74
|
+
# target: armv7
|
|
75
|
+
# steps:
|
|
76
|
+
# - uses: actions/checkout@v4
|
|
77
|
+
# - uses: actions/setup-python@v5
|
|
78
|
+
# with:
|
|
79
|
+
# python-version: 3.12
|
|
80
|
+
# - name: Build wheels
|
|
81
|
+
# uses: PyO3/maturin-action@v1
|
|
82
|
+
# with:
|
|
83
|
+
# target: ${{ matrix.platform.target }}
|
|
84
|
+
# args: --release --out dist --find-interpreter -b bin
|
|
85
|
+
# sccache: 'true'
|
|
86
|
+
# manylinux: musllinux_1_2
|
|
87
|
+
# - name: Upload wheels
|
|
88
|
+
# uses: actions/upload-artifact@v4
|
|
89
|
+
# with:
|
|
90
|
+
# name: wheels-musllinux-${{ matrix.platform.target }}
|
|
91
|
+
# path: dist
|
|
92
|
+
|
|
93
|
+
windows:
|
|
94
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
95
|
+
strategy:
|
|
96
|
+
matrix:
|
|
97
|
+
platform:
|
|
98
|
+
- runner: windows-latest
|
|
99
|
+
target: x64
|
|
100
|
+
# - runner: windows-latest
|
|
101
|
+
# target: x86
|
|
102
|
+
steps:
|
|
103
|
+
- uses: actions/checkout@v4
|
|
104
|
+
- uses: actions/setup-python@v5
|
|
105
|
+
with:
|
|
106
|
+
python-version: 3.12
|
|
107
|
+
architecture: ${{ matrix.platform.target }}
|
|
108
|
+
- name: Build wheels
|
|
109
|
+
uses: PyO3/maturin-action@v1
|
|
110
|
+
with:
|
|
111
|
+
target: ${{ matrix.platform.target }}
|
|
112
|
+
args: --release --out dist --find-interpreter -b bin
|
|
113
|
+
sccache: 'true'
|
|
114
|
+
- name: Upload wheels
|
|
115
|
+
uses: actions/upload-artifact@v4
|
|
116
|
+
with:
|
|
117
|
+
name: wheels-windows-${{ matrix.platform.target }}
|
|
118
|
+
path: dist
|
|
119
|
+
|
|
120
|
+
macos:
|
|
121
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
122
|
+
strategy:
|
|
123
|
+
matrix:
|
|
124
|
+
platform:
|
|
125
|
+
- runner: macos-12
|
|
126
|
+
target: x86_64
|
|
127
|
+
- runner: macos-14
|
|
128
|
+
target: aarch64
|
|
129
|
+
steps:
|
|
130
|
+
- uses: actions/checkout@v4
|
|
131
|
+
- uses: actions/setup-python@v5
|
|
132
|
+
with:
|
|
133
|
+
python-version: 3.12
|
|
134
|
+
- name: Build wheels
|
|
135
|
+
uses: PyO3/maturin-action@v1
|
|
136
|
+
with:
|
|
137
|
+
target: ${{ matrix.platform.target }}
|
|
138
|
+
args: --release --out dist --find-interpreter -b bin
|
|
139
|
+
sccache: 'true'
|
|
140
|
+
- name: Upload wheels
|
|
141
|
+
uses: actions/upload-artifact@v4
|
|
142
|
+
with:
|
|
143
|
+
name: wheels-macos-${{ matrix.platform.target }}
|
|
144
|
+
path: dist
|
|
145
|
+
|
|
146
|
+
emscripten:
|
|
147
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
148
|
+
strategy:
|
|
149
|
+
matrix:
|
|
150
|
+
platform:
|
|
151
|
+
- runner: ubuntu-latest
|
|
152
|
+
target: wasm32-unknown-emscripten
|
|
153
|
+
steps:
|
|
154
|
+
- uses: actions/checkout@v4
|
|
155
|
+
- uses: actions/setup-python@v5
|
|
156
|
+
with:
|
|
157
|
+
python-version: 3.12
|
|
158
|
+
- run: pip install pyodide-build
|
|
159
|
+
- name: Get Emscripten and Python version info
|
|
160
|
+
shell: bash
|
|
161
|
+
run: |
|
|
162
|
+
echo EMSCRIPTEN_VERSION=$(pyodide config get emscripten_version) >> $GITHUB_ENV
|
|
163
|
+
echo PYTHON_VERSION=$(pyodide config get python_version | cut -d '.' -f 1-2) >> $GITHUB_ENV
|
|
164
|
+
pip uninstall -y pyodide-build
|
|
165
|
+
- uses: mymindstorm/setup-emsdk@v12
|
|
166
|
+
with:
|
|
167
|
+
version: ${{ env.EMSCRIPTEN_VERSION }}
|
|
168
|
+
actions-cache-folder: emsdk-cache
|
|
169
|
+
- uses: actions/setup-python@v5
|
|
170
|
+
with:
|
|
171
|
+
python-version: ${{ env.PYTHON_VERSION }}
|
|
172
|
+
- run: pip install pyodide-build
|
|
173
|
+
- name: Build wheels
|
|
174
|
+
uses: PyO3/maturin-action@v1
|
|
175
|
+
with:
|
|
176
|
+
target: ${{ matrix.platform.target }}
|
|
177
|
+
args: --release --out dist -i ${{ env.PYTHON_VERSION }} -b bin
|
|
178
|
+
sccache: 'true'
|
|
179
|
+
rust-toolchain: nightly
|
|
180
|
+
- name: Upload wheels
|
|
181
|
+
uses: actions/upload-artifact@v4
|
|
182
|
+
with:
|
|
183
|
+
name: wheels-wasm
|
|
184
|
+
path: dist
|
|
185
|
+
|
|
186
|
+
sdist:
|
|
187
|
+
runs-on: ubuntu-latest
|
|
188
|
+
steps:
|
|
189
|
+
- uses: actions/checkout@v4
|
|
190
|
+
- name: Build sdist
|
|
191
|
+
uses: PyO3/maturin-action@v1
|
|
192
|
+
with:
|
|
193
|
+
command: sdist
|
|
194
|
+
args: --out dist
|
|
195
|
+
- name: Upload sdist
|
|
196
|
+
uses: actions/upload-artifact@v4
|
|
197
|
+
with:
|
|
198
|
+
name: wheels-sdist
|
|
199
|
+
path: dist
|
|
200
|
+
|
|
201
|
+
release:
|
|
202
|
+
name: Release
|
|
203
|
+
runs-on: ubuntu-latest
|
|
204
|
+
environment: release
|
|
205
|
+
if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
|
|
206
|
+
# needs: [linux, musllinux, windows, macos, emscripten, sdist]
|
|
207
|
+
needs: [linux, windows, macos, emscripten, sdist]
|
|
208
|
+
permissions:
|
|
209
|
+
# Use to sign the release artifacts
|
|
210
|
+
id-token: write
|
|
211
|
+
# Used to upload release artifacts
|
|
212
|
+
contents: write
|
|
213
|
+
# Used to generate artifact attestation
|
|
214
|
+
attestations: write
|
|
215
|
+
steps:
|
|
216
|
+
- uses: actions/download-artifact@v4
|
|
217
|
+
- name: Generate artifact attestation
|
|
218
|
+
uses: actions/attest-build-provenance@v1
|
|
219
|
+
with:
|
|
220
|
+
subject-path: 'wheels-*/*'
|
|
221
|
+
- name: Publish to PyPI
|
|
222
|
+
if: "startsWith(github.ref, 'refs/tags/')"
|
|
223
|
+
uses: PyO3/maturin-action@v1
|
|
224
|
+
with:
|
|
225
|
+
command: upload
|
|
226
|
+
args: --non-interactive --skip-existing wheels-*/*
|
|
227
|
+
- name: Extract binary and rename
|
|
228
|
+
env:
|
|
229
|
+
PROJECT_NAME: ${{ env.PROJECT_NAME }}
|
|
230
|
+
run: |
|
|
231
|
+
for wheel_dir in wheels-windows-* wheels-linux-* wheels-macos-*; do
|
|
232
|
+
arch=$(echo $wheel_dir | cut -d'-' -f3)
|
|
233
|
+
os=$(echo $wheel_dir | cut -d'-' -f2)
|
|
234
|
+
find ./$wheel_dir -name "*.whl" -exec sh -c '
|
|
235
|
+
wheel_name=$(basename "$1")
|
|
236
|
+
version=$(echo $wheel_name | sed -E "s/.*-([0-9]+\.[0-9]+\.[0-9]+)-.*/\1/")
|
|
237
|
+
unzip -d "$(dirname "$1")" "$1"
|
|
238
|
+
if [ "$2" = "windows" ]; then
|
|
239
|
+
binary_path=$(find "$(dirname "$1")" -name "*.exe")
|
|
240
|
+
if [ -n "$binary_path" ]; then
|
|
241
|
+
mv "$binary_path" "$(dirname "$binary_path")/${PROJECT_NAME}_${version}_${2}_${3}.exe"
|
|
242
|
+
fi
|
|
243
|
+
else
|
|
244
|
+
binary_path=$(find "$(dirname "$1")" -type f -executable)
|
|
245
|
+
if [ -n "$binary_path" ]; then
|
|
246
|
+
mv "$binary_path" "$(dirname "$binary_path")/${PROJECT_NAME}_${version}_${2}_${3}"
|
|
247
|
+
fi
|
|
248
|
+
fi
|
|
249
|
+
' _ {} "$os" "$arch" \;
|
|
250
|
+
done
|
|
251
|
+
- name: Upload to GitHub Release
|
|
252
|
+
uses: softprops/action-gh-release@v2
|
|
253
|
+
with:
|
|
254
|
+
files: |
|
|
255
|
+
wheels-wasm/*.whl
|
|
256
|
+
wheels-sdist/*.tar.gz
|
|
257
|
+
wheels-windows-*/*.whl
|
|
258
|
+
wheels-windows-*/*.data/scripts/${{ env.PROJECT_NAME }}_*_windows_*.exe
|
|
259
|
+
wheels-linux-*/*.whl
|
|
260
|
+
wheels-linux-*/*.data/scripts/${{ env.PROJECT_NAME }}_*_linux_*
|
|
261
|
+
wheels-macos-*/*.whl
|
|
262
|
+
wheels-macos-*/*.data/scripts/${{ env.PROJECT_NAME }}_*_macos_*
|
|
263
|
+
prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') }}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Generated by Cargo
|
|
2
|
+
# will have compiled files and executables
|
|
3
|
+
debug/
|
|
4
|
+
target/
|
|
5
|
+
dist/
|
|
6
|
+
|
|
7
|
+
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
|
|
8
|
+
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
|
|
9
|
+
#Cargo.lock
|
|
10
|
+
|
|
11
|
+
# These are backup files generated by rustfmt
|
|
12
|
+
**/*.rs.bk
|
|
13
|
+
|
|
14
|
+
# MSVC Windows builds of rustc generate these, which store debugging information
|
|
15
|
+
*.pdb
|
|
16
|
+
|
|
17
|
+
# RustRover
|
|
18
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
19
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
20
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
21
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
22
|
+
#.idea/
|
|
23
|
+
|
|
24
|
+
# python
|
|
25
|
+
.venv
|
|
26
|
+
__pycache__
|
|
27
|
+
python/**/*.so
|
|
28
|
+
python/**/*.pyc
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Contributing to NC-GCode-Interpreter
|
|
2
|
+
|
|
3
|
+
We welcome contributions to the NC-GCode-Interpreter project! This document provides guidelines for contributing to the project.
|
|
4
|
+
|
|
5
|
+
## Submitting Changes
|
|
6
|
+
|
|
7
|
+
1. Open a pull request against the main repository.
|
|
8
|
+
2. Describe your changes in the pull request description.
|
|
9
|
+
|
|
10
|
+
## Code Style
|
|
11
|
+
|
|
12
|
+
- Follow the Rust style guide for Rust code.
|
|
13
|
+
- Use PEP 8 style guide for Python code.
|
|
14
|
+
- Use meaningful variable and function names.
|
|
15
|
+
- Comment your code where necessary.
|
|
16
|
+
|
|
17
|
+
## Reporting Bugs
|
|
18
|
+
|
|
19
|
+
- Use the GitHub Issues page to report bugs.
|
|
20
|
+
- Describe the bug in detail, including steps to reproduce.
|
|
21
|
+
- Include the version of NC-GCode-Interpreter you're using.
|
|
22
|
+
- Include the platform you are using NC-GCode-Interpreter on. (e.g. Windows x64, macOS ARM)
|
|
23
|
+
- Include whether the bug occurred in the Python package or the CLI.
|
|
24
|
+
|
|
25
|
+
## Feature Requests
|
|
26
|
+
We appreciate your interest in improving NC-GCode-Interpreter! Please note:
|
|
27
|
+
|
|
28
|
+
- Our primary focus is on features that align with our specific business use case.
|
|
29
|
+
- We encourage you to implement new features yourself if they fall outside our current scope.
|
|
30
|
+
- If you believe a feature would benefit our business use case:
|
|
31
|
+
1. Open an issue on the GitHub Issues page to discuss the feature.
|
|
32
|
+
2. Clearly describe the feature and its potential benefits, especially how it relates to NC code interpretation and our use case.
|
|
33
|
+
3. Be prepared to (partially) implement the feature yourself if approved.
|
|
34
|
+
|
|
35
|
+
## Questions
|
|
36
|
+
|
|
37
|
+
If you have any questions about contributing, please open an issue or reach out to the maintainers.
|
|
38
|
+
|
|
39
|
+
Thank you for contributing to NC-GCode-Interpreter!
|