--- id: bashlex version: "0.18" license: GPLv3+ license_treatment: copyleft maintenance: dormant --- # bashlex — Python parser for bash License: copyleft · Maintenance: dormant · Downloads: 16.5M/mo ## What it is and what it does bashlex is a Python port of GNU bash's internal parser, transliterated from C to parse bash shell syntax into a complete AST. Unlike shlex, it understands complex bash constructs such as command substitutions, process substitutions, and nested expansions, making it suitable for tools that need to analyze or manipulate bash scripts programmatically. The package does not execute shell code—it only parses and tokenizes. It has a single runtime dependency (enum34 for older Python versions) and installs as a pure Python wheel with low friction. The codebase is dormant but stable; it was last updated in January 2023 and has no known security vulnerabilities. Use it for: - Build shell script analyzers or linters that need to understand bash syntax beyond simple word splitting - Implement shell command documentation tools that parse and explain bash constructs - Extract and analyze command structures from bash scripts for auditing or refactoring - Tokenize bash input more accurately than shlex for tools that handle process or command substitutions ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. bashlex parses bash shell syntax into an abstract syntax tree (AST), supporting complex constructs like command and process substitutions that standard tools like shlex cannot handle. Yes, if you need to parse bash syntax programmatically. bashlex is stable, well-tested, has no vulnerabilities, and solves a specific problem that standard library tools cannot. The GPLv3+ license is a blocker only for proprietary projects; open-source projects should install without hesitation. The dormant maintenance status is not a concern for a parser—the bash syntax it targets is mature and unlikely to change significantly. ## Install pip install bashlex uv add bashlex poetry add bashlex ## Installing bashlex Before you install: Installation is straightforward with low friction. The package is dormant (last release 2023-01-18, 1304 days ago) but the repository remains active and well-maintained for its scope; it has 642 stars and no known vulnerabilities. License in practice: bashlex is licensed under GPLv3+, a copyleft license. Any derivative work or distribution must also be open-source under compatible terms; proprietary projects cannot include this package without legal review. Quickstart: pip install bashlex import bashlex parts = bashlex.parse('echo hello') for ast in parts: print(ast.dump()) Requires Python 2.7 or Python 3.5+; does not support Python 3.0–3.4. Verify before relying: - Whether arithmetic expressions $((..)) support is planned or considered out of scope - Performance characteristics on very large or deeply nested bash scripts ## Package facts - License: GPLv3+ (copyleft) - Python support: supports_current - Install friction: low - Maintenance: dormant - Downloads: 16.5M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags bash parser python, shell syntax parsing, bash ast generator, command substitution parser, bash tokenizer, shell-parsing, ast-generation [View on SkillFed](https://skillfed.io/packages/bashlex) · [View on PyPI](https://pypi.org/project/bashlex/)