Python wrapper for the Zenroom virtual machine
A Python3 wrapper of Zenroom, a secure and small virtual machine for crypto language processing
Zenroom and Zenroom.py are part of the DECODE project about data-ownership and technological sovereignty. Our effort is that of improving people's awareness of how their data is processed by algorithms, as well facilitate the work of developers to create along privacy by design principles using algorithms that can be deployed in any situation without any change.
This library attempts to provide a very simple wrapper around the Zenroom (https://zenroom.dyne.org/) crypto virtual machine developed as part of the DECODE project (https://decodeproject.eu/), that aims to make the Zenroom virtual machine easier to call from normal Python code.
Zenroom itself does have good cross platform functionality, so if you are interested in finding out more about the functionalities offered by Zenroom, then please visit the website linked to above to find out more.
pip install zenroom
NOTE - the above command attempts to install the zenroom package, pulling in the Zenroom VM as a precompiled binary, so will only work on Linux (amd64) and macOS machines.
Two main calls are exposed, one to run
zencode and one for
If you don't know what
zencode is, you can start with this blogpost
The official documentation is available on https://dev.zenroom.org/zencode/
A good set of examples of
zencode contracts could be found on
🐍 Python wrapper
the wrapper exposes two simple calls:
as the names suggest are the two methods to execute zenroom (lua scripts) and zencode.
Both functions accept the same arguments:
scriptstring the lua script or the zencode script to be executed
keysstring the optional keys string to pass in execution as documented in zenroom docs here
datastring the optional data string to pass in execution as documented in zenroom docs here
confstring the optional conf string to pass according to zen_config here
Both functions return the same object result
ZenResult that have two attributes:
stdoutstring holds the stdout of the script execution
stderrstring holds the stderr of the script execution
Example usage of
zencode_exec(script, keys=None, data=None, conf=None)
from zenroom import zenroom contract = """Scenario 'simple': Create a keypair" Given that I am known as 'identifier' When I create the keypair Then print my data """ result = zenroom.zencode_exec(contract) print(result.stdout)
Example usage of
zenroom_exec(script, keys=None, data=None, conf=None)
from zenroom import zenroom script = "print('Hello world')" result = zenroom.zenroom_exec(script) print(result.stdout)
The same arguments and the same result are applied as the
Tests are made with pytests, just run
python setup.py test
file you'll find more usage examples of the wrapper
Copyright (C) 2018 by Dyne.org foundation, Amsterdam
Originally designed and written by Sam Mulube.
Designed, written and maintained by Puria Nafisi Azizi.
Software contained include sources taken from pytest.
This project is receiving funding from the European Union’s Horizon 2020 research and innovation programme under grant agreement nr. 732546 (DECODE).
- FORK IT
- Create your feature branch
git checkout -b feature/branch
- Commit your changes
git commit -am 'Add some fooBar'
- Push to the branch
git push origin feature/branch
- Create a new Pull Request
- Thank you
Zenroom.py - a python wrapper of zenroom Copyright (c) 2018 Dyne.org foundation, Amsterdam This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size zenroom-1.0.12-py3-none-any.whl (20.9 MB)||File type Wheel||Python version py3||Upload date||Hashes View|
|Filename, size zenroom-1.0.12.tar.gz (20.8 MB)||File type Source||Python version None||Upload date||Hashes View|