glrmask 0.1.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 (225) hide show
  1. glrmask-0.1.0/.github/workflows/python-wheels.yml +187 -0
  2. glrmask-0.1.0/.gitignore +344 -0
  3. glrmask-0.1.0/CHANGELOG.md +18 -0
  4. glrmask-0.1.0/Cargo.lock +1370 -0
  5. glrmask-0.1.0/Cargo.toml +100 -0
  6. glrmask-0.1.0/LICENSE-APACHE +202 -0
  7. glrmask-0.1.0/LICENSE-MIT +9 -0
  8. glrmask-0.1.0/Makefile +22 -0
  9. glrmask-0.1.0/PKG-INFO +62 -0
  10. glrmask-0.1.0/README.md +296 -0
  11. glrmask-0.1.0/benches/bounded_string_array_close.rs +288 -0
  12. glrmask-0.1.0/benches/cfa_sweep_schema_build_multithreaded.rs +22 -0
  13. glrmask-0.1.0/benches/cfa_sweep_schema_build_single_threaded.rs +28 -0
  14. glrmask-0.1.0/benches/data/github_ultra_o62058.schema.json +1311 -0
  15. glrmask-0.1.0/benches/data/kubernetes_kb_543_normalized.schema.json +326 -0
  16. glrmask-0.1.0/benches/data/o9838_problem_schema.json +1 -0
  17. glrmask-0.1.0/benches/support/cfa_sweep.rs +266 -0
  18. glrmask-0.1.0/docs/benchmark-0.1.md +98 -0
  19. glrmask-0.1.0/docs/env-vars.md +89 -0
  20. glrmask-0.1.0/docs/json-schema-semantic-deviations.md +50 -0
  21. glrmask-0.1.0/docs/ordered_object_grammar_optimization.md +312 -0
  22. glrmask-0.1.0/examples/context_free.rs +37 -0
  23. glrmask-0.1.0/examples/ebnf.rs +33 -0
  24. glrmask-0.1.0/examples/json_schema.rs +24 -0
  25. glrmask-0.1.0/examples/json_schema_bounded_string.rs +32 -0
  26. glrmask-0.1.0/examples/profile_glr.rs +56 -0
  27. glrmask-0.1.0/examples/python_quickstart.py +26 -0
  28. glrmask-0.1.0/glrmask-runtime/Cargo.toml +33 -0
  29. glrmask-0.1.0/glrmask-runtime/README.md +54 -0
  30. glrmask-0.1.0/glrmask-runtime/examples/roundtrip.rs +25 -0
  31. glrmask-0.1.0/glrmask-runtime/src/compiler.rs +34 -0
  32. glrmask-0.1.0/glrmask-runtime/src/grammar.rs +2 -0
  33. glrmask-0.1.0/glrmask-runtime/src/lib.rs +198 -0
  34. glrmask-0.1.0/glrmask-runtime/tests/artifact_envelope.rs +31 -0
  35. glrmask-0.1.0/glrmask-runtime/tests/runtime_session.rs +148 -0
  36. glrmask-0.1.0/licenses/LICENSE-APACHE +202 -0
  37. glrmask-0.1.0/licenses/LICENSE-MIT +9 -0
  38. glrmask-0.1.0/pyproject.toml +22 -0
  39. glrmask-0.1.0/python/Cargo.toml +17 -0
  40. glrmask-0.1.0/python/README.md +49 -0
  41. glrmask-0.1.0/python/glrmask/__init__.py +3 -0
  42. glrmask-0.1.0/python/licenses/LICENSE-APACHE +202 -0
  43. glrmask-0.1.0/python/licenses/LICENSE-MIT +9 -0
  44. glrmask-0.1.0/python/src/lib.rs +1224 -0
  45. glrmask-0.1.0/rustfmt.toml +3 -0
  46. glrmask-0.1.0/src/automata/lexer/ast.rs +290 -0
  47. glrmask-0.1.0/src/automata/lexer/compile.rs +4502 -0
  48. glrmask-0.1.0/src/automata/lexer/determinize.rs +637 -0
  49. glrmask-0.1.0/src/automata/lexer/dfa.rs +921 -0
  50. glrmask-0.1.0/src/automata/lexer/lightweight/mod.rs +1 -0
  51. glrmask-0.1.0/src/automata/lexer/lightweight/nfa.rs +444 -0
  52. glrmask-0.1.0/src/automata/lexer/minimize.rs +865 -0
  53. glrmask-0.1.0/src/automata/lexer/mod.rs +13 -0
  54. glrmask-0.1.0/src/automata/lexer/nfa.rs +272 -0
  55. glrmask-0.1.0/src/automata/lexer/regex.rs +422 -0
  56. glrmask-0.1.0/src/automata/lexer/tokenizer.rs +744 -0
  57. glrmask-0.1.0/src/automata/mod.rs +6 -0
  58. glrmask-0.1.0/src/automata/unweighted_u32/determinize.rs +114 -0
  59. glrmask-0.1.0/src/automata/unweighted_u32/dfa.rs +113 -0
  60. glrmask-0.1.0/src/automata/unweighted_u32/minimize_acyclic.rs +284 -0
  61. glrmask-0.1.0/src/automata/unweighted_u32/minimize_cyclic.rs +216 -0
  62. glrmask-0.1.0/src/automata/unweighted_u32/mod.rs +6 -0
  63. glrmask-0.1.0/src/automata/unweighted_u32/nfa.rs +164 -0
  64. glrmask-0.1.0/src/automata/unweighted_u32/subtract.rs +80 -0
  65. glrmask-0.1.0/src/automata/weighted_u32/determinize.rs +1427 -0
  66. glrmask-0.1.0/src/automata/weighted_u32/dwa.rs +487 -0
  67. glrmask-0.1.0/src/automata/weighted_u32/equivalence.rs +161 -0
  68. glrmask-0.1.0/src/automata/weighted_u32/minimize.rs +48 -0
  69. glrmask-0.1.0/src/automata/weighted_u32/minimize_acyclic.rs +4604 -0
  70. glrmask-0.1.0/src/automata/weighted_u32/minimize_token_deterministic_nwa.rs +748 -0
  71. glrmask-0.1.0/src/automata/weighted_u32/mod.rs +9 -0
  72. glrmask-0.1.0/src/automata/weighted_u32/nwa.rs +333 -0
  73. glrmask-0.1.0/src/automata/weighted_u32/source_nwa.rs +263 -0
  74. glrmask-0.1.0/src/automata/weighted_u32/terminal_automaton.rs +87 -0
  75. glrmask-0.1.0/src/compiler/compile.rs +12 -0
  76. glrmask-0.1.0/src/compiler/constraint_possible_matches/collector.rs +1334 -0
  77. glrmask-0.1.0/src/compiler/constraint_possible_matches/mod.rs +2685 -0
  78. glrmask-0.1.0/src/compiler/glr/accumulator.rs +97 -0
  79. glrmask-0.1.0/src/compiler/glr/analysis.rs +3352 -0
  80. glrmask-0.1.0/src/compiler/glr/labels.rs +17 -0
  81. glrmask-0.1.0/src/compiler/glr/mod.rs +5 -0
  82. glrmask-0.1.0/src/compiler/glr/parser/mod.rs +4164 -0
  83. glrmask-0.1.0/src/compiler/glr/parser/profile.rs +70 -0
  84. glrmask-0.1.0/src/compiler/glr/table/action.rs +139 -0
  85. glrmask-0.1.0/src/compiler/glr/table/build.rs +2017 -0
  86. glrmask-0.1.0/src/compiler/glr/table/mod.rs +939 -0
  87. glrmask-0.1.0/src/compiler/glr/table/optimize.rs +5968 -0
  88. glrmask-0.1.0/src/compiler/glr/table/row.rs +804 -0
  89. glrmask-0.1.0/src/compiler/grammar/mod.rs +2 -0
  90. glrmask-0.1.0/src/compiler/grammar/transforms.rs +1273 -0
  91. glrmask-0.1.0/src/compiler/mod.rs +10 -0
  92. glrmask-0.1.0/src/compiler/pipeline.rs +2212 -0
  93. glrmask-0.1.0/src/compiler/pm_profile.rs +44 -0
  94. glrmask-0.1.0/src/compiler/possible_matches.rs +192 -0
  95. glrmask-0.1.0/src/compiler/stages/equiv_types.rs +290 -0
  96. glrmask-0.1.0/src/compiler/stages/id_map_and_terminal_dwa/classify.rs +3992 -0
  97. glrmask-0.1.0/src/compiler/stages/id_map_and_terminal_dwa/grammar_helpers.rs +290 -0
  98. glrmask-0.1.0/src/compiler/stages/id_map_and_terminal_dwa/l1/max_length.rs +434 -0
  99. glrmask-0.1.0/src/compiler/stages/id_map_and_terminal_dwa/l1/mod.rs +6006 -0
  100. glrmask-0.1.0/src/compiler/stages/id_map_and_terminal_dwa/l2p/equivalence_analysis/combined.rs +2755 -0
  101. glrmask-0.1.0/src/compiler/stages/id_map_and_terminal_dwa/l2p/equivalence_analysis/compat.rs +858 -0
  102. glrmask-0.1.0/src/compiler/stages/id_map_and_terminal_dwa/l2p/equivalence_analysis/disallowed_follows.rs +60 -0
  103. glrmask-0.1.0/src/compiler/stages/id_map_and_terminal_dwa/l2p/equivalence_analysis/mod.rs +9 -0
  104. glrmask-0.1.0/src/compiler/stages/id_map_and_terminal_dwa/l2p/equivalence_analysis/shared.rs +75 -0
  105. glrmask-0.1.0/src/compiler/stages/id_map_and_terminal_dwa/l2p/equivalence_analysis/state/fast.rs +1626 -0
  106. glrmask-0.1.0/src/compiler/stages/id_map_and_terminal_dwa/l2p/equivalence_analysis/state/max_length.rs +714 -0
  107. glrmask-0.1.0/src/compiler/stages/id_map_and_terminal_dwa/l2p/equivalence_analysis/state/mod.rs +7 -0
  108. glrmask-0.1.0/src/compiler/stages/id_map_and_terminal_dwa/l2p/equivalence_analysis/state_equivalence/global_token_position.rs +2153 -0
  109. glrmask-0.1.0/src/compiler/stages/id_map_and_terminal_dwa/l2p/equivalence_analysis/state_equivalence/max_length.rs +579 -0
  110. glrmask-0.1.0/src/compiler/stages/id_map_and_terminal_dwa/l2p/equivalence_analysis/state_equivalence/mod.rs +99 -0
  111. glrmask-0.1.0/src/compiler/stages/id_map_and_terminal_dwa/l2p/equivalence_analysis/state_equivalence/nfa.rs +2709 -0
  112. glrmask-0.1.0/src/compiler/stages/id_map_and_terminal_dwa/l2p/equivalence_analysis/state_equivalence/pipeline.rs +299 -0
  113. glrmask-0.1.0/src/compiler/stages/id_map_and_terminal_dwa/l2p/equivalence_analysis/state_equivalence/restricted_observation.rs +1005 -0
  114. glrmask-0.1.0/src/compiler/stages/id_map_and_terminal_dwa/l2p/equivalence_analysis/vocab/common_atom.rs +889 -0
  115. glrmask-0.1.0/src/compiler/stages/id_map_and_terminal_dwa/l2p/equivalence_analysis/vocab/fast.rs +4035 -0
  116. glrmask-0.1.0/src/compiler/stages/id_map_and_terminal_dwa/l2p/equivalence_analysis/vocab/mod.rs +7 -0
  117. glrmask-0.1.0/src/compiler/stages/id_map_and_terminal_dwa/l2p/mod.rs +1578 -0
  118. glrmask-0.1.0/src/compiler/stages/id_map_and_terminal_dwa/l2p/nwa_builder.rs +3032 -0
  119. glrmask-0.1.0/src/compiler/stages/id_map_and_terminal_dwa/l2p/postprocess.rs +776 -0
  120. glrmask-0.1.0/src/compiler/stages/id_map_and_terminal_dwa/l2p/terminal_dwa_equivalence.rs +846 -0
  121. glrmask-0.1.0/src/compiler/stages/id_map_and_terminal_dwa/l2p/terminal_interchangeability.rs +11916 -0
  122. glrmask-0.1.0/src/compiler/stages/id_map_and_terminal_dwa/merge.rs +2849 -0
  123. glrmask-0.1.0/src/compiler/stages/id_map_and_terminal_dwa/mod.rs +896 -0
  124. glrmask-0.1.0/src/compiler/stages/id_map_and_terminal_dwa/partition.rs +379 -0
  125. glrmask-0.1.0/src/compiler/stages/id_map_and_terminal_dwa/types.rs +196 -0
  126. glrmask-0.1.0/src/compiler/stages/mapped_artifact/compaction/almost_optimal_layout.rs +682 -0
  127. glrmask-0.1.0/src/compiler/stages/mapped_artifact/compaction/default_layout.rs +432 -0
  128. glrmask-0.1.0/src/compiler/stages/mapped_artifact/compaction/exact_layout.rs +627 -0
  129. glrmask-0.1.0/src/compiler/stages/mapped_artifact/compaction/mod.rs +2037 -0
  130. glrmask-0.1.0/src/compiler/stages/mapped_artifact/mod.rs +499 -0
  131. glrmask-0.1.0/src/compiler/stages/mapped_artifact/reconcile.rs +1220 -0
  132. glrmask-0.1.0/src/compiler/stages/mod.rs +6 -0
  133. glrmask-0.1.0/src/compiler/stages/parser_dwa.rs +2766 -0
  134. glrmask-0.1.0/src/compiler/stages/resolve_negatives.rs +1413 -0
  135. glrmask-0.1.0/src/compiler/stages/templates/characterize.rs +1077 -0
  136. glrmask-0.1.0/src/compiler/stages/templates/compile_bundle.rs +957 -0
  137. glrmask-0.1.0/src/compiler/stages/templates/compile_dfa.rs +1046 -0
  138. glrmask-0.1.0/src/compiler/stages/templates/mod.rs +5 -0
  139. glrmask-0.1.0/src/ds/bitset.rs +252 -0
  140. glrmask-0.1.0/src/ds/char_transitions.rs +163 -0
  141. glrmask-0.1.0/src/ds/compressed_state_set.rs +166 -0
  142. glrmask-0.1.0/src/ds/leveled_gss.rs +5091 -0
  143. glrmask-0.1.0/src/ds/mod.rs +10 -0
  144. glrmask-0.1.0/src/ds/stack_vecs/arc_array_vec.rs +191 -0
  145. glrmask-0.1.0/src/ds/stack_vecs/dispatch.rs +197 -0
  146. glrmask-0.1.0/src/ds/stack_vecs/mod.rs +7 -0
  147. glrmask-0.1.0/src/ds/stack_vecs/stack_vec.rs +66 -0
  148. glrmask-0.1.0/src/ds/stack_vecs/vec_stack_vec.rs +93 -0
  149. glrmask-0.1.0/src/ds/u8set.rs +259 -0
  150. glrmask-0.1.0/src/ds/vocab_prefix_tree.rs +405 -0
  151. glrmask-0.1.0/src/ds/weight.rs +3335 -0
  152. glrmask-0.1.0/src/error.rs +17 -0
  153. glrmask-0.1.0/src/grammar/ast.rs +3421 -0
  154. glrmask-0.1.0/src/grammar/exact_subtraction_lowering.rs +940 -0
  155. glrmask-0.1.0/src/grammar/expr_nfa.rs +537 -0
  156. glrmask-0.1.0/src/grammar/factoring.rs +574 -0
  157. glrmask-0.1.0/src/grammar/flat.rs +128 -0
  158. glrmask-0.1.0/src/grammar/glrm.rs +1845 -0
  159. glrmask-0.1.0/src/grammar/mod.rs +8 -0
  160. glrmask-0.1.0/src/grammar/named_simplify.rs +630 -0
  161. glrmask-0.1.0/src/grammar/terminal_choice_promotion.rs +668 -0
  162. glrmask-0.1.0/src/import/ebnf.rs +427 -0
  163. glrmask-0.1.0/src/import/json_schema/array.rs +392 -0
  164. glrmask-0.1.0/src/import/json_schema/ast.rs +208 -0
  165. glrmask-0.1.0/src/import/json_schema/combinators.rs +3572 -0
  166. glrmask-0.1.0/src/import/json_schema/config.rs +170 -0
  167. glrmask-0.1.0/src/import/json_schema/error.rs +28 -0
  168. glrmask-0.1.0/src/import/json_schema/load.rs +1110 -0
  169. glrmask-0.1.0/src/import/json_schema/lower.rs +2065 -0
  170. glrmask-0.1.0/src/import/json_schema/mod.rs +482 -0
  171. glrmask-0.1.0/src/import/json_schema/number.rs +303 -0
  172. glrmask-0.1.0/src/import/json_schema/object.rs +4502 -0
  173. glrmask-0.1.0/src/import/json_schema/preflight.rs +278 -0
  174. glrmask-0.1.0/src/import/json_schema/string.rs +3648 -0
  175. glrmask-0.1.0/src/import/json_schema/tests.rs +8782 -0
  176. glrmask-0.1.0/src/import/lark.rs +1131 -0
  177. glrmask-0.1.0/src/import/mod.rs +306 -0
  178. glrmask-0.1.0/src/import/numeric_range.rs +687 -0
  179. glrmask-0.1.0/src/lib.rs +308 -0
  180. glrmask-0.1.0/src/runtime/artifact.rs +1177 -0
  181. glrmask-0.1.0/src/runtime/commit/mod.rs +4345 -0
  182. glrmask-0.1.0/src/runtime/commit/profile.rs +142 -0
  183. glrmask-0.1.0/src/runtime/commit/template_advance.rs +362 -0
  184. glrmask-0.1.0/src/runtime/commit/tokenizer_scan.rs +69 -0
  185. glrmask-0.1.0/src/runtime/constraint.rs +3439 -0
  186. glrmask-0.1.0/src/runtime/dynamic_constraint.rs +320 -0
  187. glrmask-0.1.0/src/runtime/dynamic_mask.rs +1325 -0
  188. glrmask-0.1.0/src/runtime/finalize.rs +7 -0
  189. glrmask-0.1.0/src/runtime/mask/mod.rs +2145 -0
  190. glrmask-0.1.0/src/runtime/mask/profile.rs +335 -0
  191. glrmask-0.1.0/src/runtime/mask/queue.rs +301 -0
  192. glrmask-0.1.0/src/runtime/mask_mapping.rs +1733 -0
  193. glrmask-0.1.0/src/runtime/mod.rs +19 -0
  194. glrmask-0.1.0/src/runtime/serde.rs +499 -0
  195. glrmask-0.1.0/src/runtime/state.rs +353 -0
  196. glrmask-0.1.0/src/runtime/token_space.rs +128 -0
  197. glrmask-0.1.0/src/vocab.rs +102 -0
  198. glrmask-0.1.0/tests/byte_restricted_state_equivalence_mre.rs +40 -0
  199. glrmask-0.1.0/tests/data/kb143_gpt2_prefix.json +1 -0
  200. glrmask-0.1.0/tests/data/kb814_normalized_schema.json +2825 -0
  201. glrmask-0.1.0/tests/data/kb814_prepared_terminals.json +1 -0
  202. glrmask-0.1.0/tests/data/o62060_minimized_empty_object_bridge_grammar.json +1 -0
  203. glrmask-0.1.0/tests/direct_glrm_ordered_suffix_ambiguity.rs +181 -0
  204. glrmask-0.1.0/tests/direct_glrm_ordered_suffix_fixed_n5.rs +97 -0
  205. glrmask-0.1.0/tests/fixtures/github_hard_o56012_split_quotes.lark +103 -0
  206. glrmask-0.1.0/tests/integration.rs +2256 -0
  207. glrmask-0.1.0/tests/json_schema_unicode_class_pattern.rs +353 -0
  208. glrmask-0.1.0/tests/json_schema_unicode_escape_characterization.rs +150 -0
  209. glrmask-0.1.0/tests/mre.rs +574 -0
  210. glrmask-0.1.0/tests/o13029_unit_inlining_false_negative.rs +45 -0
  211. glrmask-0.1.0/tests/o15627_schema_gss_split_mre.rs +73 -0
  212. glrmask-0.1.0/tests/o17408_repro.rs +263 -0
  213. glrmask-0.1.0/tests/o25804_mask_commit_mismatch.rs +73 -0
  214. glrmask-0.1.0/tests/o35155_tokenizer_scaling.rs +592 -0
  215. glrmask-0.1.0/tests/o4836_unicode_escape_key.rs +129 -0
  216. glrmask-0.1.0/tests/o6363_required_anyof.rs +111 -0
  217. glrmask-0.1.0/tests/o67291_recursive_anyof_ref.rs +67 -0
  218. glrmask-0.1.0/tests/o82710_repro.rs +121 -0
  219. glrmask-0.1.0/tests/ordered_anyof_ambiguity.rs +420 -0
  220. glrmask-0.1.0/tests/resjson_repro.rs +49 -0
  221. glrmask-0.1.0/tests/snowplow_hostname_fixture.rsinc +166 -0
  222. glrmask-0.1.0/tests/snowplow_hostname_replay_mre.rs +43 -0
  223. glrmask-0.1.0/tests/ti_mre_final.rs +26 -0
  224. glrmask-0.1.0/tests/ti_separator_transport_mre.rs +21 -0
  225. glrmask-0.1.0/tests/unicode_escape_progression_glrm_mre.rs +105 -0
@@ -0,0 +1,187 @@
1
+ name: Python wheels
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ pull_request:
6
+ paths:
7
+ - ".github/workflows/python-wheels.yml"
8
+ - "Cargo.lock"
9
+ - "Cargo.toml"
10
+ - "glrmask-runtime/**"
11
+ - "python/**"
12
+ - "scripts/check-python-wheel-set.py"
13
+ - "scripts/python-artifact-smoke.py"
14
+ - "scripts/python-wheel-smoke.py"
15
+ - "src/**"
16
+ push:
17
+ tags:
18
+ - "v*"
19
+
20
+ permissions:
21
+ contents: read
22
+
23
+ concurrency:
24
+ group: python-wheels-${{ github.workflow }}-${{ github.ref }}
25
+ cancel-in-progress: ${{ github.event_name == 'pull_request' }}
26
+
27
+ jobs:
28
+ wheels:
29
+ name: ${{ matrix.platform.id }} / Python ${{ matrix.python-version }}
30
+ runs-on: ${{ matrix.platform.runner }}
31
+ strategy:
32
+ fail-fast: false
33
+ matrix:
34
+ python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
35
+ platform:
36
+ - id: manylinux-x86_64
37
+ runner: ubuntu-24.04
38
+ target: x86_64
39
+ python-arch: x64
40
+ linux: true
41
+ container: quay.io/pypa/manylinux2014_x86_64:latest
42
+ - id: manylinux-aarch64
43
+ runner: ubuntu-24.04-arm
44
+ target: aarch64
45
+ python-arch: arm64
46
+ linux: true
47
+ container: quay.io/pypa/manylinux2014_aarch64:latest
48
+ - id: macos-x86_64
49
+ runner: macos-15-intel
50
+ target: x86_64
51
+ python-arch: x64
52
+ linux: false
53
+ - id: macos-arm64
54
+ runner: macos-15
55
+ target: aarch64
56
+ python-arch: arm64
57
+ linux: false
58
+ - id: windows-x86_64
59
+ runner: windows-latest
60
+ target: x64
61
+ python-arch: x64
62
+ linux: false
63
+
64
+ steps:
65
+ - uses: actions/checkout@v6
66
+
67
+ - uses: actions/setup-python@v6
68
+ with:
69
+ python-version: ${{ matrix.python-version }}
70
+ architecture: ${{ matrix.platform.python-arch }}
71
+
72
+ - name: Build manylinux wheel
73
+ if: ${{ matrix.platform.linux }}
74
+ uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
75
+ with:
76
+ maturin-version: v1.14.1
77
+ target: ${{ matrix.platform.target }}
78
+ manylinux: "2014"
79
+ container: ${{ matrix.platform.container }}
80
+ args: >-
81
+ --release
82
+ --locked
83
+ --out dist
84
+ -i python${{ matrix.python-version }}
85
+ --compatibility pypi
86
+ --manifest-path python/Cargo.toml
87
+
88
+ - name: Build native wheel
89
+ if: ${{ !matrix.platform.linux }}
90
+ uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
91
+ with:
92
+ maturin-version: v1.14.1
93
+ target: ${{ matrix.platform.target }}
94
+ args: >-
95
+ --release
96
+ --locked
97
+ --compatibility pypi
98
+ --out dist
99
+ --interpreter python
100
+ --manifest-path python/Cargo.toml
101
+
102
+ - name: Validate wheel metadata
103
+ run: |
104
+ python -m pip install --upgrade pip twine
105
+ python -m twine check dist/*
106
+
107
+ - name: Clean-install and smoke-test wheel
108
+ run: python scripts/python-artifact-smoke.py dist --kind wheel
109
+
110
+ - name: Upload wheel artifact
111
+ uses: actions/upload-artifact@v6
112
+ with:
113
+ name: wheel-${{ matrix.platform.id }}-py${{ matrix.python-version }}
114
+ path: dist/*.whl
115
+ if-no-files-found: error
116
+ retention-days: 14
117
+
118
+ sdist:
119
+ name: Source distribution
120
+ runs-on: ubuntu-24.04
121
+ steps:
122
+ - uses: actions/checkout@v6
123
+
124
+ - uses: actions/setup-python@v6
125
+ with:
126
+ python-version: "3.13"
127
+
128
+ - name: Build sdist
129
+ uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
130
+ with:
131
+ maturin-version: v1.14.1
132
+ command: sdist
133
+ args: --out dist --manifest-path python/Cargo.toml
134
+
135
+ - name: Validate sdist metadata
136
+ run: |
137
+ python -m pip install --upgrade pip twine
138
+ python -m twine check dist/*
139
+
140
+ - name: Clean-install and smoke-test sdist
141
+ run: python scripts/python-artifact-smoke.py dist --kind sdist
142
+
143
+ - name: Upload sdist artifact
144
+ uses: actions/upload-artifact@v6
145
+ with:
146
+ name: python-sdist
147
+ path: dist/*.tar.gz
148
+ if-no-files-found: error
149
+ retention-days: 14
150
+
151
+ validate-artifact-set:
152
+ name: Validate complete artifact set
153
+ runs-on: ubuntu-24.04
154
+ needs: [wheels, sdist]
155
+ steps:
156
+ - uses: actions/checkout@v6
157
+
158
+ - uses: actions/setup-python@v6
159
+ with:
160
+ python-version: "3.13"
161
+
162
+ - name: Download wheel artifacts
163
+ uses: actions/download-artifact@v7
164
+ with:
165
+ pattern: wheel-*
166
+ path: dist
167
+ merge-multiple: true
168
+
169
+ - name: Download sdist artifact
170
+ uses: actions/download-artifact@v7
171
+ with:
172
+ name: python-sdist
173
+ path: dist
174
+
175
+ - name: Validate complete release-shaped artifact set
176
+ run: |
177
+ python -m pip install --upgrade pip twine packaging
178
+ python -m twine check dist/*
179
+ python scripts/check-python-wheel-set.py dist
180
+
181
+ - name: Upload combined validated artifact set
182
+ uses: actions/upload-artifact@v6
183
+ with:
184
+ name: python-release-artifacts
185
+ path: dist/*
186
+ if-no-files-found: error
187
+ retention-days: 14
@@ -0,0 +1,344 @@
1
+ tmp/
2
+ /target
3
+ /python/target
4
+ *.DS_Store
5
+ # Created by https://www.toptal.com/developers/gitignore/api/macos,jetbrains,rust,python
6
+ # Edit at https://www.toptal.com/developers/gitignore?templates=macos,jetbrains,rust,python
7
+
8
+ ### JetBrains ###
9
+ # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
10
+ # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
11
+
12
+ # User-specific stuff
13
+ .idea/**/workspace.xml
14
+ .idea/**/tasks.xml
15
+ .idea/**/usage.statistics.xml
16
+ .idea/**/dictionaries
17
+ .idea/**/shelf
18
+
19
+ # AWS User-specific
20
+ .idea/**/aws.xml
21
+
22
+ # Generated files
23
+ .idea/**/contentModel.xml
24
+
25
+ # Sensitive or high-churn files
26
+ .idea/**/dataSources/
27
+ .idea/**/dataSources.ids
28
+ .idea/**/dataSources.local.xml
29
+ .idea/**/sqlDataSources.xml
30
+ .idea/**/dynamic.xml
31
+ .idea/**/uiDesigner.xml
32
+ .idea/**/dbnavigator.xml
33
+
34
+ # Gradle
35
+ .idea/**/gradle.xml
36
+ .idea/**/libraries
37
+
38
+ # Gradle and Maven with auto-import
39
+ # When using Gradle or Maven with auto-import, you should exclude module files,
40
+ # since they will be recreated, and may cause churn. Uncomment if using
41
+ # auto-import.
42
+ # .idea/artifacts
43
+ # .idea/compiler.xml
44
+ # .idea/jarRepositories.xml
45
+ # .idea/modules.xml
46
+ # .idea/*.iml
47
+ # .idea/modules
48
+ # *.iml
49
+ # *.ipr
50
+
51
+ # CMake
52
+ cmake-build-*/
53
+
54
+ # Mongo Explorer plugin
55
+ .idea/**/mongoSettings.xml
56
+
57
+ # File-based project format
58
+ *.iws
59
+
60
+ # IntelliJ
61
+ out/
62
+
63
+ # mpeltonen/sbt-idea plugin
64
+ .idea_modules/
65
+
66
+ # JIRA plugin
67
+ atlassian-ide-plugin.xml
68
+
69
+ # Cursive Clojure plugin
70
+ .idea/replstate.xml
71
+
72
+ # SonarLint plugin
73
+ .idea/sonarlint/
74
+
75
+ # Crashlytics plugin (for Android Studio and IntelliJ)
76
+ com_crashlytics_export_strings.xml
77
+ crashlytics.properties
78
+ crashlytics-build.properties
79
+ fabric.properties
80
+
81
+ # Editor-based Rest Client
82
+ .idea/httpRequests
83
+
84
+ # Android studio 3.1+ serialized cache file
85
+ .idea/caches/build_file_checksums.ser
86
+
87
+ ### JetBrains Patch ###
88
+ # Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
89
+
90
+ # *.iml
91
+ # modules.xml
92
+ # .idea/misc.xml
93
+ # *.ipr
94
+
95
+ # Sonarlint plugin
96
+ # https://plugins.jetbrains.com/plugin/7973-sonarlint
97
+ .idea/**/sonarlint/
98
+
99
+ # SonarQube Plugin
100
+ # https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin
101
+ .idea/**/sonarIssues.xml
102
+
103
+ # Markdown Navigator plugin
104
+ # https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced
105
+ .idea/**/markdown-navigator.xml
106
+ .idea/**/markdown-navigator-enh.xml
107
+ .idea/**/markdown-navigator/
108
+
109
+ # Cache file creation bug
110
+ # See https://youtrack.jetbrains.com/issue/JBR-2257
111
+ .idea/$CACHE_FILE$
112
+
113
+ # CodeStream plugin
114
+ # https://plugins.jetbrains.com/plugin/12206-codestream
115
+ .idea/codestream.xml
116
+
117
+ # Azure Toolkit for IntelliJ plugin
118
+ # https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij
119
+ .idea/**/azureSettings.xml
120
+
121
+ ### macOS ###
122
+ # General
123
+ .DS_Store
124
+ .AppleDouble
125
+ .LSOverride
126
+
127
+ # Icon must end with two \r
128
+ Icon
129
+
130
+
131
+ # Thumbnails
132
+ ._*
133
+
134
+ # Files that might appear in the root of a volume
135
+ .DocumentRevisions-V100
136
+ .fseventsd
137
+ .Spotlight-V100
138
+ .TemporaryItems
139
+ .Trashes
140
+ .VolumeIcon.icns
141
+ .com.apple.timemachine.donotpresent
142
+
143
+ # Directories potentially created on remote AFP share
144
+ .AppleDB
145
+ .AppleDesktop
146
+ Network Trash Folder
147
+ Temporary Items
148
+ .apdisk
149
+
150
+ ### macOS Patch ###
151
+ # iCloud generated files
152
+ *.icloud
153
+
154
+ ### Python ###
155
+ # Byte-compiled / optimized / DLL files
156
+ __pycache__/
157
+ *.py[cod]
158
+ *$py.class
159
+
160
+ # C extensions
161
+ *.so
162
+
163
+ # Distribution / packaging
164
+ .Python
165
+ build/
166
+ develop-eggs/
167
+ dist/
168
+ downloads/
169
+ eggs/
170
+ .eggs/
171
+ lib/
172
+ lib64/
173
+ parts/
174
+ sdist/
175
+ var/
176
+ wheels/
177
+ share/python-wheels/
178
+ *.egg-info/
179
+ .installed.cfg
180
+ *.egg
181
+ MANIFEST
182
+
183
+ # PyInstaller
184
+ # Usually these files are written by a python script from a template
185
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
186
+ *.manifest
187
+ *.spec
188
+
189
+ # Installer logs
190
+ pip-log.txt
191
+ pip-delete-this-directory.txt
192
+
193
+ # Unit test / coverage reports
194
+ htmlcov/
195
+ .tox/
196
+ .nox/
197
+ .coverage
198
+ .coverage.*
199
+ .cache
200
+ nosetests.xml
201
+ coverage.xml
202
+ *.cover
203
+ *.py,cover
204
+ .hypothesis/
205
+ .pytest_cache/
206
+ cover/
207
+
208
+ # Translations
209
+ *.mo
210
+ *.pot
211
+
212
+ # Django stuff:
213
+ *.log
214
+ local_settings.py
215
+ db.sqlite3
216
+ db.sqlite3-journal
217
+
218
+ # Flask stuff:
219
+ instance/
220
+ .webassets-cache
221
+
222
+ # Scrapy stuff:
223
+ .scrapy
224
+
225
+ # Sphinx documentation
226
+ docs/_build/
227
+
228
+ # PyBuilder
229
+ .pybuilder/
230
+ target/
231
+
232
+ # Jupyter Notebook
233
+ .ipynb_checkpoints
234
+
235
+ # IPython
236
+ profile_default/
237
+ ipython_config.py
238
+
239
+ # pyenv
240
+ # For a library or package, you might want to ignore these files since the code is
241
+ # intended to run in multiple environments; otherwise, check them in:
242
+ # .python-version
243
+
244
+ # pipenv
245
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
246
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
247
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
248
+ # install all needed dependencies.
249
+ #Pipfile.lock
250
+
251
+ # poetry
252
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
253
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
254
+ # commonly ignored for libraries.
255
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
256
+ #poetry.lock
257
+
258
+ # pdm
259
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
260
+ #pdm.lock
261
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
262
+ # in version control.
263
+ # https://pdm.fming.dev/#use-with-ide
264
+ .pdm.toml
265
+
266
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
267
+ __pypackages__/
268
+
269
+ # Celery stuff
270
+ celerybeat-schedule
271
+ celerybeat.pid
272
+
273
+ # SageMath parsed files
274
+ *.sage.py
275
+
276
+ # Environments
277
+ .env
278
+ .venv
279
+ env/
280
+ venv/
281
+ ENV/
282
+ env.bak/
283
+ venv.bak/
284
+
285
+ # Spyder project settings
286
+ .spyderproject
287
+ .spyproject
288
+
289
+ # Rope project settings
290
+ .ropeproject
291
+
292
+ # mkdocs documentation
293
+ /site
294
+
295
+ # mypy
296
+ .mypy_cache/
297
+ .dmypy.json
298
+ dmypy.json
299
+
300
+ # Pyre type checker
301
+ .pyre/
302
+
303
+ # pytype static type analyzer
304
+ .pytype/
305
+
306
+ # Cython debug symbols
307
+ cython_debug/
308
+
309
+ # PyCharm
310
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
311
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
312
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
313
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
314
+ #.idea/
315
+
316
+ ### Python Patch ###
317
+ # Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
318
+ poetry.toml
319
+
320
+ # ruff
321
+ .ruff_cache/
322
+
323
+ # LSP config files
324
+ pyrightconfig.json
325
+
326
+ ### Rust ###
327
+ # Generated by Cargo
328
+ # Root-level debug-output directories only.
329
+ /debug/
330
+
331
+ # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
332
+ # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
333
+ Cargo.lock
334
+
335
+ # These are backup files generated by rustfmt
336
+ **/*.rs.bk
337
+
338
+ # MSVC Windows builds of rustc generate these, which store debugging information
339
+ *.pdb
340
+
341
+ # End of https://www.toptal.com/developers/gitignore/api/macos,jetbrains,rust,python
342
+
343
+ tests/data/kb143_gpt2.bin
344
+ src.zip
@@ -0,0 +1,18 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0 — 2026-07-15 — Shingleback initial release
4
+
5
+ ### Highlights
6
+
7
+ - Public project brand: Shingleback; the Rust crate, PyPI distribution, and Python import remain `glrmask`.
8
+ - Vocabulary-specific grammar-constrained decoding for EBNF, Lark, and a documented pragmatic subset of JSON Schema.
9
+ - Reusable compiled `Constraint` objects with incremental mask, commit, completion, and forced-prefix operations.
10
+ - GLR-based parsing for ambiguous and genuinely context-free grammars, including tokenizations that cross grammar-terminal boundaries.
11
+ - Rust and Python APIs for incremental mask, commit, completion, and forced-prefix operations.
12
+ - Constraint serialization for compile-once, load-and-run deployments, plus a smaller execution-only runtime crate for serving artifacts.
13
+ - A build-only Python wheel workflow covering Python 3.9–3.13 across manylinux x86_64/aarch64, macOS x86_64/arm64, and Windows x86_64.
14
+
15
+ ### Release evidence and caveats
16
+
17
+ - The bounded v0.1 `make example-slow-all` comparison is documented in [`docs/benchmark-0.1.md`](docs/benchmark-0.1.md), including exact scope, environment, backend versions, methodology, and caveats.
18
+ - JSON Schema support is not full specification conformance; see [`docs/json-schema-semantic-deviations.md`](docs/json-schema-semantic-deviations.md).