braceexpand
Bash-style brace expansion for Python
What it is and what it does
braceexpand is a small, zero-dependency library that translates bash-style brace expansion syntax into Python iterables. It handles integer ranges (e.g., `{1..3}`), character ranges (e.g., `{a..c}`), comma-separated sequences, nested patterns, zero-padding, custom increments, and bidirectional ranges. The function returns an iterator, making it memory-efficient for large expansions.
The package is useful when you need to programmatically generate file paths, configuration keys, or test parameters that follow bash expansion rules. It raises `UnbalancedBracesError` on malformed input rather than silently ignoring it as bash does, and mixed-case character ranges exclude certain ASCII characters between uppercase and lowercase letters.
Use it for:
- Generate file paths or glob-like patterns programmatically without shell invocation.
- Create test parameter sets from compact brace notation in test frameworks.
- Expand configuration keys or template variables that follow bash syntax conventions.
- Build command-line argument lists from shorthand patterns in Python scripts.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Expands bash-style brace patterns into sequences of strings, supporting integer ranges, character ranges, nested patterns, and custom increments.
Yes, if you need bash brace expansion in Python and can tolerate an abandoned codebase. The library is simple, has no dependencies, and carries no known vulnerabilities. Install it for one-off pattern generation or legacy tool compatibility, but do not rely on it for new projects requiring active maintenance or future Python version support.
Install
braceexpand on PyPI
pip
pip install braceexpanduv
uv add braceexpandpoetry
poetry add braceexpandInstalling braceexpand
Before you install
Installation is frictionless—pure Python wheel with no runtime dependencies. However, the package is abandoned; the last commit was 2021-10-08 and no releases have shipped since 2021-05-07, so security updates and compatibility fixes are unlikely.
License in practice
MIT license is permissive; you may use, modify, and distribute braceexpand freely in commercial or private projects without restriction.
Quickstart
from braceexpand import braceexpand
list(braceexpand('item{1..3}'))
# ['item1', 'item2', 'item3']
list(braceexpand('{a..c}'))
# ['a', 'b', 'c']
Verify before relying
- Whether unbalanced-brace behavior matches your shell version's exact semantics in edge cases.
- Current compatibility with Python versions released after 2021.
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | abandoned — 1,925 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 3,639,827/month — #2,546 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: braceexpand-0.1.7-py2.py3-none-any.whl
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
bracexBracex expands Bash-style brace patterns into…
permissive · top 1,000 on PyPI
wcmatchwcmatch provides enhanced file pattern matching…
permissive · top 1,000 on PyPI
tree-sitter-bashProvides a tree-sitter grammar for parsing Bash…
permissive · top 1,000 on PyPI
expandvarsExpands Unix-style variable references in…
permissive · top 5,000 on PyPI
contractionsExpands English contractions and slang into…
permissive · top 15,000 on PyPI
parameter-expansion-patchedExpands POSIX and Bash shell parameter syntax…
permissive · top 15,000 on PyPI
FileseqParses frame ranges and file sequences using…
permissive · top 15,000 on PyPI
exrexExrex generates all or random strings matching…
agpl · top 15,000 on PyPI
py-iam-expandExpands and deobfuscates AWS IAM action…
permissive · top 15,000 on PyPI
uri-templateExpands RFC 6570 URI Templates with variable…
permissive · top 1,000 on PyPI