Skip to main content

IPYEOS project

Project description

Interactive Python for Eos

PyPi PyPi

What Is IPyEos

  • IPyEos is a Smart Contracts test framework for Eos
  • IPyEos is a Python binding for Eos

Installation

python3 -m pip install ipyeos

on the macOS platform, you may need to install gmp and zstd if you don't install them.

brew reinstall gmp
brew reinstall zstd

If your platform is Windows or MacOSX M1/M2, you also need to download an image that includes the ipyeos tool:

docker pull ghcr.io/uuosio/ipyeos:latest

If you have not installed the ipyeos image in Docker, then the ipyeos image will be automatically downloaded the first time you run ipyeos or eosdebugger.

On macOS, the recommended software for installing and running Docker is OrbStack. For other platforms, you can use Docker Desktop.

Usage

#test.py
import os
from ipyeos.chaintester import ChainTester

chaintester.chain_config['contracts_console'] = True

def test_example():
    t = ChainTester(True)
    with open('./hello/build/hello/hello.wasm', 'rb') as f:
        code = f.read()
    with open('./hello/build/hello/hello.abi', 'rb') as f:
        abi = f.read()
    t.deploy_contract('hello', code, abi)
    t.produce_block()

    t.push_action('hello', 'hi', {'nm': 'alice'}, {'hello': 'active'})
    t.produce_block()

Test:

ipyeos -m pytest -x -s tests/test.py

Building

To build this project, please follow the steps below:

  1. Clone the source code from the repository:
git clone https://github.com/uuosio/ipyeos --branch main --recursive
  1. Build the forked leap source code under the leap directory by following the instructions in the build-and-install-from-source documentation.

  2. Build the Python release package:

cd ipyeos
./build.sh
  1. Install the Python package
python3 -m pip install dist/pyeos-0.4.2**.whl

Run a Node

eosnode

Run a Debugging Server

eosdebugger

Testing

test example code

#test.py
import os
from ipyeos.chaintester import ChainTester

chaintester.chain_config['contracts_console'] = True

def test_example():
    t = ChainTester(True)
    with open('./hello/build/hello/hello.wasm', 'rb') as f:
        code = f.read()
    with open('./hello/build/hello/hello.abi', 'rb') as f:
        abi = f.read()
    t.deploy_contract('hello', code, abi)
    t.produce_block()

    t.push_action('hello', 'hi', {'nm': 'alice'}, {'hello': 'active'})
    t.produce_block()
ipyeos -m pytest -x -s tests/test.py

Run a Testnet

ipyeos -m ipyeos eosnode --data-dir dd --config-dir cd -p eosio --plugin eosio::producer_plugin --plugin eosio::chain_api_plugin --plugin eosio::producer_api_plugin -e --resource-monitor-space-threshold 99 --http-server-address 127.0.0.1:8889 --contracts-console --access-control-allow-origin="*"  --wasm-runtime eos-vm-jit

Also, you can run a test node with eosnode command directly.

eosnode --data-dir dd --config-dir cd -p eosio --plugin eosio::producer_plugin --plugin eosio::chain_api_plugin --plugin eosio::producer_api_plugin -e --resource-monitor-space-threshold 99 --http-server-address 127.0.0.1:8889 --contracts-console --access-control-allow-origin="*"  --wasm-runtime eos-vm-jit

Note

If you encounter the error message during running the above commands like Failed to load libpython3.7m.so!, try running the following command in your terminal:

export PYTHON_SHARED_LIB_PATH=path/to/libpython[.so|.dylib]

License

MIT

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

ipyeos-0.4.2.tar.gz (86.3 kB view hashes)

Uploaded Source

Built Distributions

ipyeos-0.4.2-cp311-cp311-manylinux_2_31_x86_64.whl (24.7 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.31+ x86-64

ipyeos-0.4.2-cp311-cp311-macosx_10_15_x86_64.whl (10.1 MB view hashes)

Uploaded CPython 3.11 macOS 10.15+ x86-64

ipyeos-0.4.2-cp310-cp310-manylinux_2_31_x86_64.whl (24.7 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.31+ x86-64

ipyeos-0.4.2-cp310-cp310-macosx_10_15_x86_64.whl (10.1 MB view hashes)

Uploaded CPython 3.10 macOS 10.15+ x86-64

ipyeos-0.4.2-cp39-cp39-manylinux_2_31_x86_64.whl (24.7 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.31+ x86-64

ipyeos-0.4.2-cp39-cp39-macosx_10_15_x86_64.whl (10.1 MB view hashes)

Uploaded CPython 3.9 macOS 10.15+ x86-64

ipyeos-0.4.2-cp38-cp38-manylinux_2_31_x86_64.whl (24.7 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.31+ x86-64

ipyeos-0.4.2-cp38-cp38-macosx_10_15_x86_64.whl (10.1 MB view hashes)

Uploaded CPython 3.8 macOS 10.15+ x86-64

Supported by

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