Skip to main content

A Python compiler for the Neo Virtual Machine on the Ontology Blockchain

Project description

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

Donations

Accepted at ATEMNPSjRVvsXmaJW4ZYJBSVuJ6uR2mjQU

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ont-boa-0.4.9.tar.gz (65.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ont_boa-0.4.9-py3-none-any.whl (116.9 kB view details)

Uploaded Python 3

File details

Details for the file ont-boa-0.4.9.tar.gz.

File metadata

  • Download URL: ont-boa-0.4.9.tar.gz
  • Upload date:
  • Size: 65.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0

File hashes

Hashes for ont-boa-0.4.9.tar.gz
Algorithm Hash digest
SHA256 dcdf8bdc21de45081aadf0c3481ca9b3e6cf8868dc562c0c83cbf63fbabcb518
MD5 c6e2e621d2c1fb26b0f16fba9943a834
BLAKE2b-256 046607d35cb647eb46cff61f1a681d1cb57492cc7393dd0f8625588a4db275c6

See more details on using hashes here.

File details

Details for the file ont_boa-0.4.9-py3-none-any.whl.

File metadata

  • Download URL: ont_boa-0.4.9-py3-none-any.whl
  • Upload date:
  • Size: 116.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0

File hashes

Hashes for ont_boa-0.4.9-py3-none-any.whl
Algorithm Hash digest
SHA256 024146f73076dc6a30620de569ae943a08679bbc98d44be3e1e27eafc9e00667
MD5 64c9c9ffa3bbc58cff3dd746e82bd211
BLAKE2b-256 8c19a27a7ccf52df35c257b3aa7e03c96b6d959a678c34ad600c985f7e79dca7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page