brush-parser-py
Python binding for brush-parser, the
POSIX/bash parser behind the brush shell. The binding mirrors the crate's
AST one type per class and adds nothing of its own.
Import name: brush_parser. Wrapped crate version:
brush_parser.BRUSH_PARSER_VERSION.
Install
uv add brush-parser-py
Prebuilt wheels cover CPython 3.12 and later on common platforms; anything else builds from the sdist with a Rust toolchain.
import brush_parser
program = brush_parser.parse_program("echo hi | wc -l")
match program.complete_commands[0].items[0].list.first.seq[0]:
case brush_parser.Command.Simple(command=simple):
print(simple.word_or_name)
API
parse_program(text, **options)returns aProgram.parse_word(word, **options)andparse_heredoc(word, **options)return a tuple ofWordPieceWithSource.parse_parameter(word, **options)returns aParameter.parse_brace_expansions(word, **options)returns a tuple ofBraceExpressionOrText, orNonewhen there is nothing to expand.
options are the upstream ParserOptions booleans as keyword-only arguments
with upstream defaults; the type stubs list them.
Every class is frozen, compares structurally with ==, and is unhashable.
Enum variants are nested classes usable in match.
Positions are in characters, not bytes. SourceSpan on AST nodes indexes the
text given to parse_program; WordPieceWithSource.start / .end index the
string given to the word function. Ranges are end-exclusive.
Errors
ParseError (with .position) and WordParseError (with .input) are
ValueError subclasses. There is no time or recursion guard; callers that
need a bound run the parse in a subprocess.
Versioning
Each release pins one exact brush-parser version. See CHANGELOG.md for
the version policy and release notes.
Development
uv sync
cargo test
cargo clippy --all-targets -- -D warnings
uv run ruff check .
uv run ty check .
uv run pytest
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file brush_parser_py-0.1.0.tar.gz.
File metadata
- Download URL: brush_parser_py-0.1.0.tar.gz
- Upload date:
- Size: 74.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cdc62bc482002b8fb1a2a5df377e3899d52b01ddf0f51328795ce8618c4ae1b3
|
|
| MD5 |
df53ec41097a4d4183d42d05aff7ec75
|
|
| BLAKE2b-256 |
654beb74fda1a2a7d7602bca8b830352862ecdd2711b1c9f9ff1bc57e342dc36
|
File details
Details for the file brush_parser_py-0.1.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: brush_parser_py-0.1.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 771.1 kB
- Tags: CPython 3.12+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2d5b7b8aec75e265c7e3b59f2d6d562f5600500b67c8d23fb7657dfc9e7fa79c
|
|
| MD5 |
a3dce0c11c0e8b71a48d385c8877a78d
|
|
| BLAKE2b-256 |
1bab884ccaa90086b324384dcf750c31ec6742843d14c2f378bd543dc77b3b8d
|
File details
Details for the file brush_parser_py-0.1.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: brush_parser_py-0.1.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 803.2 kB
- Tags: CPython 3.12+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c7b483dfeeb5b989c6b47c8c79785e6d1f858c9a2e96f9a5e85592dd76b91d4
|
|
| MD5 |
14ee543e8c4ef3bdafffa2cb810d3d0d
|
|
| BLAKE2b-256 |
dc7245df030dd3771c891d07a685432470d67370d7128e2694d9b5d16d22f2d4
|
File details
Details for the file brush_parser_py-0.1.0-cp312-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: brush_parser_py-0.1.0-cp312-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 723.3 kB
- Tags: CPython 3.12+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a369addd8b0d90a6c4b9fe361ddb51e07ed4119ef0fb5bb8c90ea86014a0f1c
|
|
| MD5 |
4c22d6565b088db9bb9c2673af1cacc2
|
|
| BLAKE2b-256 |
7e57f592ba01d40e57de69c623b23d89b3cb87396cd3d6b0f9c13348dd14bf83
|