Vyper formatter
Project description
Mamushi
Mamushi is a fork of the popular Black formatter adapted to the Vyper programming language. Mamushi reformats your Vyper contracts in a readable and consistent way.
Installation
pip install -e .
Usage
Search all *.vy files and overwrite them after formatting:
mamushi
Specify a list of *.vy files or directories and output to console after formatting:
mamushi [SRC]
Output the result to console instead of overwriting:
mamushi --in-place False
Notes
AST Safety
By default, mamushi will compare the AST of your reformatted code with that of the original to ensure that the changes applied remain strictly formal. The option can be disabled with --safe False
to speed things up.
Trailing commas
When handling expressions split by commas, mamushi follows Black's default behavior.
Mamushi also uses Black's magic trailing comma to give user the option to collapse a comma-separated expression into one line if possible. If a trailing comma is added, mamushi will always explode the expression. This can have important consequences for the commenting of your code. Consider the following two examples:
This code snippet:
self.b(0, # amount to send
msg.sender, # sender
True, # refund ?
)
formats to the following with a trailing comma after the last argument (True
):
self.b(
0, # amount to send
msg.sender, # sender
True, # refund ?
)
but if the trailing comma is removed, the line will be collapsed to:
self.b(0, msg.sender, True) # amount to send # sender # refund ?
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
File details
Details for the file mamushi-0.0.1a0.tar.gz
.
File metadata
- Download URL: mamushi-0.0.1a0.tar.gz
- Upload date:
- Size: 38.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 237df7d79be1f50463d14c436729dc17e4c8812c6440522bac02df77f24e4103 |
|
MD5 | f104a8b55793e8f6c5510226bd9f8275 |
|
BLAKE2b-256 | 7d617a8f255baa75ac6a2d7deee888f5143985b9bc1379facd13ef3ab7c235d6 |
File details
Details for the file mamushi-0.0.1a0-py3-none-any.whl
.
File metadata
- Download URL: mamushi-0.0.1a0-py3-none-any.whl
- Upload date:
- Size: 41.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f8126a07e02da6dfd3d5c03d8d29457821f38ebf1f664a29193f9c9ed03cde5 |
|
MD5 | da8cf658d5053cc29c31c67d95d201b9 |
|
BLAKE2b-256 | ec1228d2e869402090e8b82c1215e848af5b0cf9aed12920f42881de4c2f59fe |