Bracex
Bracex is a brace expanding library (à la Bash) for Python. Brace expanding is used to generate arbitrary strings.
$ echo {{a,b},c}d
ad bd cd
Bracex adds this ability to Python:
>>> bracex.expand(r'file-{{a,b},c}d.txt')
['file-ad.txt', 'file-bd.txt', 'file-cd.txt']
and as a command:
$ python3 -m bracex -0 "base/{a,b}/{1..2}" | xargs -0 mkdir -p
$ tree base/
base/
├── a
│ ├── 1
│ └── 2
└── b
├── 1
└── 2
-
Why Bracex over other solutions?
Bracex actually follows pretty closely to how Bash processes braces. It is not a 1:1 implementation of how Bash handles braces, but generally, it follows very closely. Almost all of the test cases are run through Bash first, then our implementation is compared against the results Bash gives. There are a few cases where we have purposely deviated. For instance, we are not handling Bash's command line inputs, so we are not giving special meaning to back ticks and quotes at this time.
On the command line Bracex can handle more expansions than Bash itself.
Install
$ pip install bracex
Documentation
Documentation is found here: https://facelessuser.github.io/bracex/.
License
MIT License
Release files for bracex 3.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| bracex-3.0.1.tar.gz | 44.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bracex-3.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 56.0 kB
Release files / bracex-3.0.1.tar.gz
| Download URL | bracex-3.0.1.tar.gz |
|---|---|
| Size | 44.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4e38e32392e4a4780fe15d644bfc7c8514057cfc3861e060b11814ce829c25e4
|
|
BLAKE2b-256 checksum How to use checksums |
ac015f394b8bcd6e5b92f73130990960423bbb19711f906bd9fe9ea5557c667c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 20, 2026.
Transparency logRelease files / bracex-3.0.1-py3-none-any.whl
| Download URL | bracex-3.0.1-py3-none-any.whl |
|---|---|
| Size | 11.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6523ad83aeb5098a4ee597cff0f964442ff74e460bd3fafaffab6a013ff2288c
|
|
BLAKE2b-256 checksum How to use checksums |
b88f6f7273a7adb8d73fc8d21ede4376a3e475e52f98435c6007f69100dec8ca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 20, 2026.
Transparency log