brush-parser-py 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 (61) hide show
  1. brush_parser_py-0.1.0/.github/dependabot.yml +14 -0
  2. brush_parser_py-0.1.0/.github/workflows/CI.yml +190 -0
  3. brush_parser_py-0.1.0/.gitignore +14 -0
  4. brush_parser_py-0.1.0/.pre-commit-config.yaml +41 -0
  5. brush_parser_py-0.1.0/CHANGELOG.md +29 -0
  6. brush_parser_py-0.1.0/Cargo.lock +874 -0
  7. brush_parser_py-0.1.0/Cargo.toml +31 -0
  8. brush_parser_py-0.1.0/LICENSE +21 -0
  9. brush_parser_py-0.1.0/PKG-INFO +94 -0
  10. brush_parser_py-0.1.0/README.md +67 -0
  11. brush_parser_py-0.1.0/pyproject.toml +140 -0
  12. brush_parser_py-0.1.0/src/ast/clauses.rs +141 -0
  13. brush_parser_py-0.1.0/src/ast/commands.rs +289 -0
  14. brush_parser_py-0.1.0/src/ast/compound.rs +178 -0
  15. brush_parser_py-0.1.0/src/ast/extended_test.rs +233 -0
  16. brush_parser_py-0.1.0/src/ast/lists.rs +131 -0
  17. brush_parser_py-0.1.0/src/ast/mod.rs +19 -0
  18. brush_parser_py-0.1.0/src/ast/redirects.rs +162 -0
  19. brush_parser_py-0.1.0/src/ast/words.rs +29 -0
  20. brush_parser_py-0.1.0/src/brush_parser/__init__.py +137 -0
  21. brush_parser_py-0.1.0/src/brush_parser/_ast_clauses.pyi +142 -0
  22. brush_parser_py-0.1.0/src/brush_parser/_ast_commands.pyi +198 -0
  23. brush_parser_py-0.1.0/src/brush_parser/_ast_compound.pyi +167 -0
  24. brush_parser_py-0.1.0/src/brush_parser/_ast_extended_test.pyi +123 -0
  25. brush_parser_py-0.1.0/src/brush_parser/_ast_lists.pyi +100 -0
  26. brush_parser_py-0.1.0/src/brush_parser/_ast_redirects.pyi +120 -0
  27. brush_parser_py-0.1.0/src/brush_parser/_core.pyi +191 -0
  28. brush_parser_py-0.1.0/src/brush_parser/_errors.pyi +7 -0
  29. brush_parser_py-0.1.0/src/brush_parser/_source.pyi +25 -0
  30. brush_parser_py-0.1.0/src/brush_parser/_word_expressions.pyi +288 -0
  31. brush_parser_py-0.1.0/src/brush_parser/_word_parameters.pyi +149 -0
  32. brush_parser_py-0.1.0/src/brush_parser/_word_pieces.pyi +187 -0
  33. brush_parser_py-0.1.0/src/brush_parser/py.typed +0 -0
  34. brush_parser_py-0.1.0/src/errors.rs +76 -0
  35. brush_parser_py-0.1.0/src/lib.rs +237 -0
  36. brush_parser_py-0.1.0/src/options.rs +20 -0
  37. brush_parser_py-0.1.0/src/source.rs +29 -0
  38. brush_parser_py-0.1.0/src/value.rs +337 -0
  39. brush_parser_py-0.1.0/src/word/brace.rs +85 -0
  40. brush_parser_py-0.1.0/src/word/expressions.rs +326 -0
  41. brush_parser_py-0.1.0/src/word/mod.rs +13 -0
  42. brush_parser_py-0.1.0/src/word/parameters.rs +195 -0
  43. brush_parser_py-0.1.0/src/word/pieces.rs +228 -0
  44. brush_parser_py-0.1.0/tests/__init__.py +0 -0
  45. brush_parser_py-0.1.0/tests/_helpers.py +76 -0
  46. brush_parser_py-0.1.0/tests/test_ast_commands.py +146 -0
  47. brush_parser_py-0.1.0/tests/test_ast_compound.py +129 -0
  48. brush_parser_py-0.1.0/tests/test_ast_extended_test.py +114 -0
  49. brush_parser_py-0.1.0/tests/test_ast_lists.py +144 -0
  50. brush_parser_py-0.1.0/tests/test_ast_redirects.py +115 -0
  51. brush_parser_py-0.1.0/tests/test_errors.py +108 -0
  52. brush_parser_py-0.1.0/tests/test_registry.py +109 -0
  53. brush_parser_py-0.1.0/tests/test_stubs.py +24 -0
  54. brush_parser_py-0.1.0/tests/test_typed_consumer.py +96 -0
  55. brush_parser_py-0.1.0/tests/test_value_semantics.py +75 -0
  56. brush_parser_py-0.1.0/tests/test_variants.py +108 -0
  57. brush_parser_py-0.1.0/tests/test_word_brace.py +38 -0
  58. brush_parser_py-0.1.0/tests/test_word_normalisation.py +37 -0
  59. brush_parser_py-0.1.0/tests/test_word_parameters.py +154 -0
  60. brush_parser_py-0.1.0/tests/test_word_pieces.py +158 -0
  61. brush_parser_py-0.1.0/uv.lock +386 -0
@@ -0,0 +1,14 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: cargo
4
+ directory: /
5
+ schedule:
6
+ interval: weekly
7
+ - package-ecosystem: github-actions
8
+ directory: /
9
+ schedule:
10
+ interval: weekly
11
+ - package-ecosystem: uv
12
+ directory: /
13
+ schedule:
14
+ interval: weekly
@@ -0,0 +1,190 @@
1
+ # Lints, tests, builds and publishes the package. The wheels are abi3, so one
2
+ # build per platform covers every supported interpreter and no free-threaded
3
+ # (3.14t) wheel exists to build. Top-level `permissions` stay at `contents:
4
+ # read` because nothing is uploaded to a GitHub release. The checks job runs
5
+ # the development gate README lists; the test job installs the built wheel
6
+ # into an environment outside the checkout; the sdist-build job compiles on
7
+ # the declared MSRV; the release job runs only for `v*` tags and publishes
8
+ # through PyPI trusted publishing, so no token is stored.
9
+ # `[tool.maturin.generate-ci.github]` in pyproject.toml holds the settings
10
+ # `maturin generate-ci github` reads.
11
+
12
+ name: CI
13
+
14
+ on:
15
+ push:
16
+ branches:
17
+ - "**"
18
+ tags:
19
+ - "v*"
20
+ pull_request:
21
+ workflow_dispatch:
22
+
23
+ permissions:
24
+ contents: read
25
+
26
+ jobs:
27
+ checks:
28
+ name: Lint, type-check and Rust tests
29
+ runs-on: ubuntu-24.04
30
+ steps:
31
+ - uses: actions/checkout@v6
32
+ - uses: dtolnay/rust-toolchain@stable
33
+ with:
34
+ components: clippy, rustfmt
35
+ # `cargo test` embeds Python, so pyo3 links against the first `python3`
36
+ # on PATH; setup-python pins that to the declared 3.12 floor with a
37
+ # shared libpython and its LD_LIBRARY_PATH, instead of whichever
38
+ # interpreter the runner image exposes.
39
+ - uses: actions/setup-python@v6
40
+ with:
41
+ python-version: "3.12"
42
+ - uses: astral-sh/setup-uv@v7
43
+ with:
44
+ python-version: "3.12"
45
+ - run: cargo fmt --all -- --check
46
+ - run: cargo clippy --all-targets -- -D warnings
47
+ - run: cargo test
48
+ - run: uv sync --locked
49
+ - run: uv run ruff check .
50
+ - run: uv run ruff format --check .
51
+ - run: uv run ty check .
52
+
53
+ linux:
54
+ runs-on: ubuntu-24.04
55
+ strategy:
56
+ matrix:
57
+ target: [x86_64, aarch64]
58
+ steps:
59
+ - uses: actions/checkout@v6
60
+ - uses: actions/setup-python@v6
61
+ with:
62
+ python-version: "3.12"
63
+ - name: Build wheels
64
+ uses: PyO3/maturin-action@v1
65
+ with:
66
+ target: ${{ matrix.target }}
67
+ args: --release --out dist
68
+ sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
69
+ manylinux: auto
70
+ - name: Upload wheels
71
+ uses: actions/upload-artifact@v6
72
+ with:
73
+ name: wheels-linux-${{ matrix.target }}
74
+ path: dist
75
+
76
+ macos:
77
+ runs-on: macos-latest
78
+ steps:
79
+ - uses: actions/checkout@v6
80
+ - uses: actions/setup-python@v6
81
+ with:
82
+ python-version: "3.12"
83
+ - name: Build wheels
84
+ uses: PyO3/maturin-action@v1
85
+ with:
86
+ target: aarch64
87
+ args: --release --out dist
88
+ sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
89
+ - name: Upload wheels
90
+ uses: actions/upload-artifact@v6
91
+ with:
92
+ name: wheels-macos-aarch64
93
+ path: dist
94
+
95
+ sdist:
96
+ runs-on: ubuntu-latest
97
+ steps:
98
+ - uses: actions/checkout@v6
99
+ - name: Build sdist
100
+ uses: PyO3/maturin-action@v1
101
+ with:
102
+ command: sdist
103
+ args: --out dist
104
+ - name: Upload sdist
105
+ uses: actions/upload-artifact@v6
106
+ with:
107
+ name: wheels-sdist
108
+ path: dist
109
+
110
+ test:
111
+ name: Test installed wheel
112
+ needs: [linux, macos]
113
+ runs-on: ${{ matrix.runner }}
114
+ strategy:
115
+ fail-fast: false
116
+ matrix:
117
+ runner: [ubuntu-24.04, macos-latest]
118
+ python-version: ["3.12", "3.13", "3.14"]
119
+ include:
120
+ - runner: ubuntu-24.04
121
+ wheels: wheels-linux-x86_64
122
+ - runner: macos-latest
123
+ wheels: wheels-macos-aarch64
124
+ steps:
125
+ - uses: actions/checkout@v6
126
+ - uses: dtolnay/rust-toolchain@stable
127
+ - uses: astral-sh/setup-uv@v7
128
+ with:
129
+ python-version: ${{ matrix.python-version }}
130
+ - uses: actions/download-artifact@v7
131
+ with:
132
+ name: ${{ matrix.wheels }}
133
+ path: dist
134
+ # `uv run --no-project` builds an environment in uv's cache, outside the
135
+ # checkout, from the wheel alone; the checkout only supplies the tests.
136
+ - name: Run the test suite against the installed wheel
137
+ run: >-
138
+ uv run --no-project --python ${{ matrix.python-version }}
139
+ --with dist/*.whl --with pytest --with mypy
140
+ -m pytest -q
141
+ - name: Check the stubs against the installed wheel
142
+ run: >-
143
+ uv run --no-project --python ${{ matrix.python-version }}
144
+ --with dist/*.whl --with mypy
145
+ -m mypy.stubtest brush_parser._core
146
+
147
+ sdist-build:
148
+ name: Build wheel from sdist on the declared MSRV
149
+ needs: [sdist]
150
+ runs-on: ubuntu-24.04
151
+ steps:
152
+ # Matches `rust-version` in Cargo.toml; the sdist carries no
153
+ # rust-toolchain.toml, so this toolchain is the one that builds it.
154
+ - uses: dtolnay/rust-toolchain@1.88
155
+ - uses: astral-sh/setup-uv@v7
156
+ with:
157
+ python-version: "3.12"
158
+ - uses: actions/download-artifact@v7
159
+ with:
160
+ name: wheels-sdist
161
+ path: dist
162
+ - name: Build a wheel from the sdist alone
163
+ run: uv build --wheel --no-sources --out-dir from-sdist dist/*.tar.gz
164
+ - name: Import the package from that wheel
165
+ run: >-
166
+ uv run --no-project --with from-sdist/*.whl
167
+ python -c "import brush_parser; print(brush_parser.BRUSH_PARSER_VERSION)"
168
+
169
+ release:
170
+ name: Release
171
+ runs-on: ubuntu-latest
172
+ if: ${{ startsWith(github.ref, 'refs/tags/v') }}
173
+ needs: [checks, linux, macos, sdist, test, sdist-build]
174
+ environment: pypi
175
+ permissions:
176
+ # Trusted publishing (OIDC) and artifact signing
177
+ id-token: write
178
+ # Used to generate artifact attestation
179
+ attestations: write
180
+ contents: read
181
+ steps:
182
+ - uses: actions/download-artifact@v7
183
+ - name: Generate artifact attestation
184
+ uses: actions/attest@v4
185
+ with:
186
+ subject-path: "wheels-*/*"
187
+ - name: Install uv
188
+ uses: astral-sh/setup-uv@v7
189
+ - name: Publish to PyPI
190
+ run: uv publish --trusted-publishing always 'wheels-*/*'
@@ -0,0 +1,14 @@
1
+ /target/
2
+
3
+ __pycache__/
4
+ *.py[cod]
5
+ *.so
6
+ /.venv/
7
+ /dist/
8
+ /wheels/
9
+ *.egg-info/
10
+ /.pytest_cache/
11
+ /.ruff_cache/
12
+ /.mypy_cache/
13
+
14
+ .DS_Store
@@ -0,0 +1,41 @@
1
+ default_install_hook_types: [pre-commit]
2
+ fail_fast: true
3
+
4
+ repos:
5
+ - repo: https://github.com/pre-commit/pre-commit-hooks
6
+ rev: v6.0.0
7
+ hooks:
8
+ - id: trailing-whitespace
9
+ - id: end-of-file-fixer
10
+ - id: check-yaml
11
+ - id: check-toml
12
+ - id: check-added-large-files
13
+ args: [--maxkb=500]
14
+ - id: check-merge-conflict
15
+
16
+ - repo: https://github.com/astral-sh/uv-pre-commit
17
+ rev: 0.12.3
18
+ hooks:
19
+ - id: uv-lock
20
+
21
+ - repo: https://github.com/astral-sh/ruff-pre-commit
22
+ rev: v0.16.2
23
+ hooks:
24
+ - id: ruff-check
25
+ args: [--fix]
26
+ - id: ruff-format
27
+
28
+ - repo: local
29
+ hooks:
30
+ - id: cargo-fmt
31
+ name: cargo fmt
32
+ entry: cargo fmt --all -- --check
33
+ language: system
34
+ types: [rust]
35
+ pass_filenames: false
36
+ - id: cargo-clippy
37
+ name: cargo clippy
38
+ entry: cargo clippy --all-targets -- -D warnings
39
+ language: system
40
+ types: [rust]
41
+ pass_filenames: false
@@ -0,0 +1,29 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented here. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the project
5
+ follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html) with the
6
+ 0.x caveat below.
7
+
8
+ Version policy: this package mirrors one exact `brush-parser` release
9
+ (`BRUSH_PARSER_VERSION`). An upstream release that changes the AST shape
10
+ becomes a minor bump here while the package is 0.x; a bump that only changes
11
+ the binding keeps the upstream pin and is a patch release.
12
+
13
+ ## [0.1.0] - 2026-09-10
14
+
15
+ ### Added
16
+
17
+ - `parse_program`, `parse_word`, `parse_heredoc`, `parse_parameter` and
18
+ `parse_brace_expansions` over `brush-parser` 0.4.0, each taking the five
19
+ upstream `ParserOptions` booleans as keyword-only arguments.
20
+ - One frozen, structurally comparable class per upstream AST and word type;
21
+ enum variants are nested `@final` subclasses usable in `match`. Nodes,
22
+ enum members and errors support `pickle` and `copy`.
23
+ - `ParseError` with `.position` and `WordParseError` with `.input`, both
24
+ `ValueError` subclasses carrying the upstream `Display` message.
25
+ - Hand-written type stubs checked by `mypy.stubtest`.
26
+ - `abi3-py312` wheels for macOS arm64 and manylinux x86_64 / aarch64, plus an
27
+ sdist.
28
+
29
+ [0.1.0]: https://github.com/eigenigma/brush-parser-py/releases/tag/v0.1.0