skillfed

braceexpand

Bash-style brace expansion for Python

braceexpand v0.1.7 3.6M downloads/30d#2,546 on PyPI61
Permissive license MIT Abandoned released

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 braceexpand

uv

uv add braceexpand

poetry

poetry add braceexpand

Installing 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

License :: OSI Approved :: MIT LicenseProgramming Language :: PythonProgramming Language :: Python :: 2Programming Language :: Python :: 3

Tags

bash brace expansion pythonpattern expansion string sequencesrange expansion utilityshell-style glob patternsbrace pattern generator
pattern-expansionbash-compatibility

More Utilities packages