Skip to main content

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 a Program.
  • parse_word(word, **options) and parse_heredoc(word, **options) return a tuple of WordPieceWithSource.
  • parse_parameter(word, **options) returns a Parameter.
  • parse_brace_expansions(word, **options) returns a tuple of BraceExpressionOrText, or None when 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

Metadata

Release files for brush-parser-py 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for brush-parser-py 0.1.0
File Size Uploaded Provenance Actions
brush_parser_py-0.1.0.tar.gz 74.3 kB Without provenance Details for brush_parser_py-0.1.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for brush-parser-py 0.1.0
File Interpreter ABI Platform Actions
brush_parser_py-0.1.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.12 abi3 Linux glibc 2.17+ x86-64 Details for brush_parser_py-0.1.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
brush_parser_py-0.1.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.12 abi3 Linux glibc 2.17+ ARM64 Details for brush_parser_py-0.1.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
brush_parser_py-0.1.0-cp312-abi3-macosx_11_0_arm64.whl CPython 3.12 abi3 macOS 11.0+ ARM64 Details for brush_parser_py-0.1.0-cp312-abi3-macosx_11_0_arm64.whl

Total release size: 2.4 MB

Release files / brush_parser_py-0.1.0.tar.gz

Download URL brush_parser_py-0.1.0.tar.gz
Size 74.3 kB
Tags Source
SHA-256 checksum
How to use checksums
cdc62bc482002b8fb1a2a5df377e3899d52b01ddf0f51328795ce8618c4ae1b3
BLAKE2b-256 checksum
How to use checksums
654beb74fda1a2a7d7602bca8b830352862ecdd2711b1c9f9ff1bc57e342dc36
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release files / brush_parser_py-0.1.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL brush_parser_py-0.1.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 771.1 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
2d5b7b8aec75e265c7e3b59f2d6d562f5600500b67c8d23fb7657dfc9e7fa79c
BLAKE2b-256 checksum
How to use checksums
1bab884ccaa90086b324384dcf750c31ec6742843d14c2f378bd543dc77b3b8d
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release files / brush_parser_py-0.1.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL brush_parser_py-0.1.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 803.2 kB
Tags CPython 3.12 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
5c7b483dfeeb5b989c6b47c8c79785e6d1f858c9a2e96f9a5e85592dd76b91d4
BLAKE2b-256 checksum
How to use checksums
dc7245df030dd3771c891d07a685432470d67370d7128e2694d9b5d16d22f2d4
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release files / brush_parser_py-0.1.0-cp312-abi3-macosx_11_0_arm64.whl

Download URL brush_parser_py-0.1.0-cp312-abi3-macosx_11_0_arm64.whl
Size 723.3 kB
Tags CPython 3.12 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
0a369addd8b0d90a6c4b9fe361ddb51e07ed4119ef0fb5bb8c90ea86014a0f1c
BLAKE2b-256 checksum
How to use checksums
7e57f592ba01d40e57de69c623b23d89b3cb87396cd3d6b0f9c13348dd14bf83
Upload date
Uploaded using Trusted Publishing?
What is 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}

Security for brush-parser-py 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

4 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page