Skip to main content

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')

For legacy purposes, if you wish to compile without NEP8 stack isolation functionality, you may do the following:

from boa.compiler import Compiler

Compiler.load_and_save('path/to/your/file.py', use_nep=False)

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

Donations

Accepted at ATEMNPSjRVvsXmaJW4ZYJBSVuJ6uR2mjQU

Metadata

Release files for neo-boa 0.5.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for neo-boa 0.5.5
File Size Uploaded
neo-boa-0.5.5.tar.gz 63.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for neo-boa 0.5.5
File Interpreter ABI Platform
neo_boa-0.5.5-py3-none-any.whl Python 3 none any Details

Total release size: 179.2 kB

Release files / neo-boa-0.5.5.tar.gz

Download URL neo-boa-0.5.5.tar.gz
Size 63.7 kB
Tags Source
SHA-256 checksum
How to use checksums
ef91bca5cd4af464ce6bca9f0efbfe80d7981a2faa47a1d02033894a2dddd586
BLAKE2b-256 checksum
How to use checksums
891f5fb095793c2b82de4831988fc60447df82fd0860ea1ddf601357f90bb033
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.7.0

Release files / neo_boa-0.5.5-py3-none-any.whl

Download URL neo_boa-0.5.5-py3-none-any.whl
Size 115.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ddd0a4aff46122c05d0ed1702a3bcdb743ad8c0cfddb186bdb7513ccbad7692b
BLAKE2b-256 checksum
How to use checksums
80c43ef7a97f594ec3ba43ed64937bf49d6ff8f8e81e11098992eb5a271d7981
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.7.0

Release history Release notifications | RSS feed

0.7.2

2 release files

0.7.0

1 release file

0.6.0

2 release files

0.5.6

2 release files

This release

0.5.5 This release

2 release files

0.5.4

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.9

2 release files

0.4.8

2 release files

0.4.7

2 release files

0.4.6

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.7

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

1 release file

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.5

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page