Yet Another Bython (braced Python) Implementation
Project description
YABI
Ever wanted to use braces instead of indentation in Python? No? Well, it's possible now!
Installing
pip install yabi-bython
Running
# run file
yabi file.by
# run module
yabi -m module
# run interactive console
yabi
# run code from command line
yabi -c "import os; try { os.remove('/') } except { print('Bruh') }"
Run yabi --help to see other options.
Is YABI better than other implementations?
- Doesn't have problems with dicts
- Has full
importsupport (any.byfile can be imported) - Has
.pycsupport (code is cached after translation)
It can have bugs though, I'd be glad if you opened an issue in case you encounter one.
If your condition contains { or lambda, remember to parenthesise it:
# Wrong
if x := {a for a in range(n)} { print("Hello") }
# Correct
if (x := {a for a in range(n)}) { print("Hello") }
Perfect for one-liners
Braces and semicolons allow to make any code a one-liner. But, like, why would you do that?
C-style preprocessing?!
In case braces aren't enough for you, there's an option to enable C-style preprocessing.
You can do so by passing --enable-preprocessing as argument to YABI or putting #pragma pypp on into the code.
YABI heavily relies on PWCP after all.
Converting Python files
You don't need to convert anything because .py files can be imported into .by.
YABI provides yabi-convert in case you still want to convert.
The output may be a little weird but should still be correct.
yabi-convert something.py > something.by
Acknowledgements
Inspired by https://github.com/mathialo/bython and my friend ByThon.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file yabi_bython-0.9.0.tar.gz.
File metadata
- Download URL: yabi_bython-0.9.0.tar.gz
- Upload date:
- Size: 10.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
05ce9d084d7bfc5a154450e15306d0745d26936bb1073b382cb1032f352db24a
|
|
| MD5 |
58db8a31e49ad70ba591262a6fa5da66
|
|
| BLAKE2b-256 |
61838294befc66c394f1371d2f9cf43f8e804b1c31a26a24e7fc686d22963a16
|
Provenance
The following attestation bundles were made for yabi_bython-0.9.0.tar.gz:
Publisher:
release.yml on solaluset/yabi
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
yabi_bython-0.9.0.tar.gz -
Subject digest:
05ce9d084d7bfc5a154450e15306d0745d26936bb1073b382cb1032f352db24a - Sigstore transparency entry: 714061280
- Sigstore integration time:
-
Permalink:
solaluset/yabi@e1adeb960cc251ddb9db94b3109efff0cbb6ab28 -
Branch / Tag:
refs/tags/v0.9.0 - Owner: https://github.com/solaluset
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e1adeb960cc251ddb9db94b3109efff0cbb6ab28 -
Trigger Event:
release
-
Statement type:
File details
Details for the file yabi_bython-0.9.0-py2.py3-none-any.whl.
File metadata
- Download URL: yabi_bython-0.9.0-py2.py3-none-any.whl
- Upload date:
- Size: 10.1 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e0f229aad5cb4bf5b84f9d553bfa6d14dbebe207638eedf0f2665e52b8046c1
|
|
| MD5 |
5df3fe5251bb671c55bb46b277165241
|
|
| BLAKE2b-256 |
cfdb75a863b4abdd9af777f994ca0bf25e042375d8d94476cde2dd39b3c49032
|
Provenance
The following attestation bundles were made for yabi_bython-0.9.0-py2.py3-none-any.whl:
Publisher:
release.yml on solaluset/yabi
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
yabi_bython-0.9.0-py2.py3-none-any.whl -
Subject digest:
1e0f229aad5cb4bf5b84f9d553bfa6d14dbebe207638eedf0f2665e52b8046c1 - Sigstore transparency entry: 714061285
- Sigstore integration time:
-
Permalink:
solaluset/yabi@e1adeb960cc251ddb9db94b3109efff0cbb6ab28 -
Branch / Tag:
refs/tags/v0.9.0 - Owner: https://github.com/solaluset
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e1adeb960cc251ddb9db94b3109efff0cbb6ab28 -
Trigger Event:
release
-
Statement type: