PyCardano
PyCardano is a standalone Cardano client written in Python. The library is able to create and sign transactions without depending on third-party Cardano serialization tools, such as cardano-cli and cardano-serialization-lib, making it a light-weight library that is easy and fast to set up in all kinds of environments.
Current goal of this project is to enable developers to write off-chain and testing code only in Python for their DApps. Nevertheless, we see the potential in expanding this project to a full Cardano node implementation in Python, which might be beneficial for faster R&D iterations.
Installation
Examples
Documentations
Development
Workspace setup
Clone the repository:
git clone https://github.com/cffls/pycardano.git
PyCardano uses poetry to manage its dependencies. Install poetry for osx / linux / bashonwindows:
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -
Go to poetry installation for more details.
Change directory into the repo, install all dependencies using poetry, and you are done!
cd pycardano && poetry install
Test
PyCardano uses pytest for unit testing.
When testing or running any program, it is recommended to enter a poetry shell in which all python dependencies are automatically configured: poetry shell
.
Run all tests:
pytest
Run all tests including doctests:
pytest --doctest-modules
Run all tests in a specific test file:
pytest test/pycardano/test_transaction.py
Run a specific test function:
pytest -k "test_transaction_body"
Run a specific test function in a test file:
pytest test/pycardano/test_transaction.py -k "test_transaction_body"
Test coverage
Test coverage could be checked by running:
pytest --cov=pycardano
A coverage report visualized in html could be generated by running:
pytest --cov=pycardano --cov-report html:cov_html
The generated report will be in folder ./cov_html
.
Style guidelines
The package uses Google style docstring.
The code style could be checked by flake8: flake8 pycardano
Docs generation
The majority of package documentation is created by the docstrings in python files. We use sphinx with Read the Docs theme to generate the html pages.
Build htmls:
cd docs && make html
Go to the main page:
open build/html/index.html
Roadmap
Feature | Status |
---|---|
Shelly address | Supported |
Transaction builder | Supported |
Transaction signing | Supported |
Multi-asset minting | Planned |
Native script | Planned |
Plutus | Planned |
Byron Address | Planned |
Reward withdraw | Planned |
HD Wallet | |
Staking certificates | |
Protocol proposal update |