Skip to main content

pymeca

A python package for interacting with the MECAnywhere smart contracts

Installation

pip install pymeca

Build from source

git clone https://github.com/sbip-sg/pymeca.git
cd pymeca
git submodule init
git submodule update --recursive
pip install poetry
poetry install

Run tests

Requirements: poetry

pip install poetry
poetry install
cd ./mecanywhere_contracts/src/ganach && npm install

Requirements: node.js 20.11.1 and npm (tested with 8.5.5)

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
export NVM_DIR="${HOME}/.nvm" && ."$NVM_DIR/nvm.sh"
cd mecanywhere_contracts/src/ganache && nvm install .nvmrc && nvm use .nvmrc && nvm install-latest-npm && npm install

From the main directory:

poetry shell
pytest

Usage

Launch the ganache test chain in a terminal to watch

cd src/pymeca/scripts
python3 ganache.py \
--host http://localhost \
--port 9000 \
--ganache-server-script-path ../../../mecanywhere_contracts/src/ganache/index.js \
--generate-accounts \
--accounts_file_path ../../config/accounts.json \
--dao-address-file-path ../dao_contract_address.txt \
--dao-file-path \
../../../mecanywhere_contracts/src/contracts/MecaContract.sol \
--scheduler-file-path \
../../../mecanywhere_contracts/src/contracts/SchedulerContract.sol \
--host-file-path \
../../../mecanywhere_contracts/src/contracts/HostContract.sol \
--tower-file-path \
../../../mecanywhere_contracts/src/contracts/TowerContract.sol \
--task-file-path \
../../../mecanywhere_contracts/src/contracts/TaskContract.sol \
--scheduler-fee 100 \
--host-register-fee 100 \
--host-initial-stake 100 \
--host-task-register-fee 100 \
--host-failed-task-penalty 100 \
--tower-initial-stake 100 \
--tower-host-request-fee 100 \
--tower-failed-task-penalty 100 \
--task-addition-fee 100
  • A sample workflow of how DAO entities interact with each other is provided here. The sample assumes that a ganache chain launched with the sample commands with ganache.py to setup corresponding accounts.

Contributing

Interested in contributing? Check out the contributing guidelines. Please note that this project is released with a Code of Conduct. By contributing to this project, you agree to abide by its terms.

License

pymeca was created by Stefan-Dan Ciocirlan (sdcioc). It is licensed under the terms of the MIT license.

Credits

pymeca was created with cookiecutter and the py-pkgs-cookiecutter template.

Metadata

Release files for pymeca 0.1.2

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

Source distribution (sdist)

Source distribution for pymeca 0.1.2
File Size Uploaded Provenance Actions
pymeca-0.1.2.tar.gz 26.4 kB Without provenance Details for pymeca-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pymeca 0.1.2
File Interpreter ABI Platform Actions
pymeca-0.1.2-py3-none-any.whl Python 3 none any Details for pymeca-0.1.2-py3-none-any.whl

Total release size: 60.3 kB

Release files / pymeca-0.1.2.tar.gz

Download URL pymeca-0.1.2.tar.gz
Size 26.4 kB
Tags Source
SHA-256 checksum
How to use checksums
a0d03b78a04c7b782b52de3745990bb47fedaff4f9053d91ef8522c1d66de643
BLAKE2b-256 checksum
How to use checksums
be26441fc2039110e8b809d140e9dd23bceda80d34524609ae2e764e155dc566
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.5

Release files / pymeca-0.1.2-py3-none-any.whl

Download URL pymeca-0.1.2-py3-none-any.whl
Size 33.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
add8cae177a2d265047e5aba66cc55948035aec9963e404457e9d751fcf440a2
BLAKE2b-256 checksum
How to use checksums
197806448f803525e079e5fcae82b3e7c146f1286fc80a2f7eedd95e60752844
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.5

Security for pymeca 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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