A fast, flexible and simple development environment framework for Ethereum smart contract, testing and deployment on Ethereum virtual machine(EVM).
With cobra you can get built-in smart contract compilation, linking, deployment, binary management, automated contract testing with Unittest and PyTest frameworks, scriptable deployment & migrations framework and network management for deploying to many public & private networks like INFURA or Ganache CLI.
Dependency
This library requires the solc executable to be present.
Only versions >=0.4.2 are supported and tested though this library may work
with other versions.
- solc: Ethereum solidity compiler.
- ganache-cli: A command-line version of Ethereum blockchain server.
- pip: To install packages from the Python Package Index and other indexes.
- python3: version 3.6 or greater.
Installation
PIP to install cobra globally. For Linux sudo may be required.
$ pip install py-cobra
Development
We welcome pull requests. To get started, just fork this repo, clone it locally, and run:
$ pip install -e . -r requirements.txt
Quick Usage
Initialize project structure
A default set of contract and tests, run the following command:
$ cobra init
Get help:
$ cobra --help
From there, you can run cobra compile, cobra deploy/migrate and cobra test --unittest/--pytest
to compile your contracts, deploy those contracts to the network, and run their associated unit tests.
advanced cobra.yaml
compile:
solidity_path: "./contracts" # global
artifact_path: "./build/contracts"
contracts: [
contract: {
solidity: "Contract.sol",
solidity_path: "./contracts/libs", # detail
import_remappings: [
"=/path/folder/contracts/"
],
allow_paths: [
"/path/folder/contracts/"
]
}
]
deploy:
artifact_path: "./build/contracts/"
contracts: [
contract: {
artifact: "Contract.json",
links: ["Contract.json"]
}
]
test:
artifact_path: "./build/contracts/"
test_paths: ["./tests"]
contracts: [
contract: {
artifact: "Contract.json",
links: ["Contract.json"]
}
]
network:
development: {
url: "https://ropsten.infura.io/...",
host: "localhost",
port: 8545,
hdwallet: {
mnemonic: "decide adjust legend nation type same task aim rigid lucky guilt close", # or
seed: "decide adjust legend nation type same task aim rigid lucky guilt close",
password: "meherett",
private: "5f8935bb3b61b312ba1114cbf6f1ea30102383f2b043a1b213aa482132d25049",
gas: 3000000,
gas_price: 1000000
},
protocol: "HTTP", # HTTP, HTTPS, WS(WebSocket) and ICP
account: {
address: "0x6a373a75c388ac2d160f1d2b6d9ada34f29831cd",
gas: 3000000,
gas_price: 1000000
}
}
Testing
Tests are still under development.
You can run the tests with:
$ pytest tests
Or use tox to run the complete suite against the full set of build targets, or pytest to run specific
tests against a specific version of Python.
Meta
Meheret Tesfaye – @meherett – meherett@zoho.com
Distributed under the MIT license. See LICENSE for more information.
License
This project is licensed under the MIT License - see the LICENSE file for details
Metadata
Release files for py-cobra 0.1.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 | Provenance | Actions |
|---|---|---|---|---|
| py-cobra-0.1.0.tar.gz | 23.1 kB | Without provenance | Details for py-cobra-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| py_cobra-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for py_cobra-0.1.0-py3-none-any.whl |
Total release size: 52.4 kB
Release files / py-cobra-0.1.0.tar.gz
| Download URL | py-cobra-0.1.0.tar.gz |
|---|---|
| Size | 23.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
610c44ee9ece7d56a42a4486eeba387e4bcafd81655d31a4d9f435a8c8e8e387
|
|
BLAKE2b-256 checksum How to use checksums |
975e5c8d0a1635678a65b133d534ab6d70976e83faf1827a6cec96319d3d4f37
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.5
|
Release files / py_cobra-0.1.0-py3-none-any.whl
| Download URL | py_cobra-0.1.0-py3-none-any.whl |
|---|---|
| Size | 29.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
76e5c67a05d410618adf1154b4c17dba8666e8a9c345f462170e029c8ad9e505
|
|
BLAKE2b-256 checksum How to use checksums |
f846aaf0bbdd70d618507132a0ce37bf8ff7524b772286278376daa3f59545a8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.5
|
Security for py-cobra 0.1.0
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.