PyTezos

A Python library for interacting with Tezos blockchain,
testing smart contracts, and writing Michelson scripts.

Integration testing


You can run tests either on a remote node (without actual injecting) or using a builtin interpreter, it takes seconds to execute, not minutes.


PyTezos allows to patch AMOUNT, SENDER, SOURCE, BALANCE, NOW, initial storage, and handle exceptions raised by FAILWITH.


Builtin REPL allows to mock cross-contract calls — all you need is to validate parameters of the spawned transactions.


Contract interface is derived straight from the compiled Michelson code, it doesn't matter what is the source language, LIGO, SmartPy, or else.


Use the whole power of the Python unit testing framework, including various assert helpers and interactive debugging plugins in VSCode and PyCharm.

PyTezos client


The minimal setup requires only a browser — you can manage Tezos contracts using Google Colaboratory, or any other online service that allows you to run Jupyter notebooks.


PyTezos is capable of almost everything tezos-client can do, so you can automate any CI/CD task, key management, data conversion or other.


PyTezos is perfect when you need to do something fast: the default node and key settings allow you to get started right away, and the built-in documentation allows you to avoid switching between windows.


PyTezos is built as flexible as possible: in most cases you will need only high-level interfaces, but at any moment you can go deeper and customize the logic.

Michelson kernel


Visualize and better understand stack transformations with the step-by-step execution and verbose logging.


Michelson instruction set is extended with useful helpers for debugging and patching context.


Mock blockchain bindings as you wish, even complicated scenarios like Big_map copying can be reproduced.


Shipped with autocomplete and builtin documentation, no need to switch tabs if you forget something.