Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/Kludex/kwonly-transformer

We don't like positional args, we like keyword only args! 🎉
https://github.com/Kludex/kwonly-transformer

Last synced: 27 days ago
JSON representation

We don't like positional args, we like keyword only args! 🎉

Awesome Lists containing this project

README

        


kwonly-transformer




Package version



This is a very opinionated tool. The idea is that we want functions with multiple parameters to have **exclusively** keyword only parameters.

As an example, let's consider a function with multiple parameters. When we are reading the call for that function,
we lose time either checking the reference, or trying to map in our brains what argument matches a specific function parameter.
```python
def do_something(a, b, c, d, e, f):
...

do_something(True, "potato", 1, "haha", None, False)
```
`kwonly-transformer` is a tool that formats the above into the following:

```python
def do_something(*, a, b, c, d, e, f):
...

do_something(a=True, b="potato", c=1, d="haha", e=None, f=False)
```

## Installation

```bash
pip install kwonly-transformer
```

## License

This project is licensed under the terms of the MIT license.