Metadata-Version: 2.4
Name: yabi-bython
Version: 0.9.1
Summary: Yet Another Bython (braced Python) Implementation
Project-URL: Repository, https://github.com/solaluset/yabi
Author: Sóla Łuset
License-Expression: MIT
License-File: LICENSE.md
Requires-Dist: pwcp<0.13,>=0.12.2
Provides-Extra: tests
Requires-Dist: pytest; extra == 'tests'
Description-Content-Type: text/markdown

# YABI

Ever wanted to use braces instead of indentation in Python? No? Well, it's possible now!

## Installing

```bash
pip install yabi-bython
```

## Running

```bash
# 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 `import` support (any `.by` file can be imported)
- Has `.pyc` support (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:
```python
# 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](https://pypi.org/project/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.

```bash
yabi-convert something.py > something.by
```

## Acknowledgements

Inspired by https://github.com/mathialo/bython and my friend ByThon.
