diff --git a/src/sdk/python/Makefile b/src/sdk/python/Makefile index 5b74d1ce1..5e90e8781 100644 --- a/src/sdk/python/Makefile +++ b/src/sdk/python/Makefile @@ -1,33 +1,10 @@ .POSIX: -# Pip install command -PIP = pip install - # Maturin binary MATURIN = maturin -# Python dependencies -DEPS = $(MATURIN) patchelf - -# WARNING: -# After all development here -# we need to remove the venv folder, -# as it breaks rest make operations -# in the repo, so just run `make clean`. -VENV = venv - -# Venv setup -VENV_SETUP = python3 -m $(VENV) $(VENV) - all: - $(MATURIN) develop --release + $(MATURIN) build --release + @echo "You can install this wheel with pip install" -bootstrap: clean - $(VENV_SETUP) - . $(VENV)/bin/activate - $(PIP) $(DEPS) - -clean: - rm -rf $(VENV) - -.PHONY: all bootstrap clean +.PHONY: all diff --git a/src/sdk/python/README.md b/src/sdk/python/README.md index f7d042a78..0c286a400 100644 --- a/src/sdk/python/README.md +++ b/src/sdk/python/README.md @@ -1,40 +1,34 @@ # darkfi-sdk-py -## Bootstrap +Python bindings for some parts of the `darkfi-sdk` and the `zkvm`. -This python sdk requires a virtual environment, along with a build tool. -To create the environment, execute: -``` -$ make bootstrap -``` -You may find more information in [pyo3](https://pyo3.rs/v0.15.1/#using-rust-from-python) -setup guide. +## Build and install + +1. Install `maturin` via your package manager or from whatever source. +2. Run `make` to build the wheel +3. (Optional) Run pip install --user ## Development -### Build +For a development version you can use a venv: -After successfully bootstrapping the virtual environment, -you can build the sdk by simply executing: ``` -$ make +$ python3 -m venv venv +$ source venv/bin/activate +(venv) $ maturin develop --release ``` -After all development is finished, you need to remove -the virtual envirnment folder, as it breaks rest make -operations in the repo, so just execute: -``` -$ make clean -``` - -### Usage example +## Usage ``` $ python3 -from darkfi_sdk_py.base import Base -a = Base.from_u64(42) -b = Base.from_u64(69) -a + b == Base.from_u64(111) +>>> import darkfi_sdk_py +>>> darkfi_sdk_py.__dir__() +>>> +>>> from darkfi_sdk_py.base import Base +>>> a = Base.from_u64(42) +>>> b = Base.from_u64(69) +>>> a + b == Base.from_u64(111) ``` ### Randomness