Python compiler for the Neo Virtual Machine
Overview
The neo-boa compiler is a tool for compiling Python files to the .avm format for usage in the Neo Virtual Machine which is used to execute contracts on the Neo Blockchain.
The compiler supports a subset of the Python language ( in the same way that a boa constrictor is a subset of the Python snake species)
What does it currently do
Compiles a subset of the Python language to the .avm format for use in the Neo Virtual Machine
Works for Python 3.6+
Adds debugging map for debugging in neo-python or other NEO debuggers
What will it do
Compile a larger subset of the Python language
Get Help or give help
Open a new issue if you encounter a problem.
Or ping @localhuman on the NEO official community chatroom.
Pull requests welcome. New features, writing tests and documentation are all needed.
Installation
Make sure you are using a Python 3.6 or greater virtual environment
Pip
pip install neo-boa
Docker
This project contains a Dockerfile to batch compile Python smart contracts. Clone the repository and navigate into the docker sub directory of the project. Run the following command to build the container:
docker build -t neo-boa .
The neo-boa Docker container takes a directory on the host containing python smart contracts as an input and a directory to compile the .avm files to as an output. It can be executed like this:
docker run -it -v /absolute/path/input_dir:/python-contracts -v /absolute/path/output_dir:/compiled-contracts neo-boa
The -v (volume) command maps the directories on the host to the directories within the container.
Manual
Clone the repository and navigate into the project directory. Make a Python 3 virtual environment and activate it via:
python3 -m venv venv source venv/bin/activate
or, to install Python 3.6 specifically:
virtualenv -p /usr/local/bin/python3.6 venv source venv/bin/activate
Then, install the requirements:
pip install -r requirements.txt
Usage
The compiler may be used like in the following example:
from boa.compiler import Compiler
Compiler.load_and_save('path/to/your/file.py')
Docs
You can read the docs here.
Tests
All tests are located in boa_test/test. Tests can be run with the following command python -m unittest discover boa_test
License
Open-source MIT.
Main author is localhuman.
Donations
Accepted at ATEMNPSjRVvsXmaJW4ZYJBSVuJ6uR2mjQU
Metadata
Release files for neo-boa 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| neo-boa-0.5.0.tar.gz | 59.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| neo_boa-0.5.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 171.0 kB
Release files / neo-boa-0.5.0.tar.gz
| Download URL | neo-boa-0.5.0.tar.gz |
|---|---|
| Size | 59.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
40ebd95ebe78b36801aeb230c4e8859d8b44dbb8cd0180d8319d019a21820282
|
|
BLAKE2b-256 checksum How to use checksums |
4b123174c59854fb8843b0fda92c52c051f8f8ba724393dbb867b3de233cdb95
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/28.8.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.3
|
Release files / neo_boa-0.5.0-py3-none-any.whl
| Download URL | neo_boa-0.5.0-py3-none-any.whl |
|---|---|
| Size | 111.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
191ad46bfda717f606a42775cb25ec356067b68f7866c7942f676d60e1de03bb
|
|
BLAKE2b-256 checksum How to use checksums |
f097db40b5fb0b22777aa90c264e9e8bcef80b29a5e7aa2da46393477814020b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/28.8.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.3
|