Browse Source

sdk-py: Wheel build guide, and dev guide.

parazyd 3 years ago
parent
commit
08467c7e0a
2 changed files with 21 additions and 50 deletions
  1. 3 26
      src/sdk/python/Makefile
  2. 18 24
      src/sdk/python/README.md

+ 3 - 26
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
-
-bootstrap: clean
-	$(VENV_SETUP)	
-	. $(VENV)/bin/activate
-	$(PIP) $(DEPS)
-
-clean:
-	rm -rf $(VENV)
+	$(MATURIN) build --release
+	@echo "You can install this wheel with pip install"
 
-.PHONY: all bootstrap clean
+.PHONY: all

+ 18 - 24
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
 
-## Development
+1. Install `maturin` via your package manager or from whatever source.
+2. Run `make` to build the wheel
+3. (Optional) Run pip install --user <path_to_wheel>
 
-### Build
+## Development
 
-After successfully bootstrapping the virtual environment,
-you can build the sdk by simply executing:
-```
-$ make
-```
+For a development version you can use a venv:
 
-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
+$ python3 -m venv venv
+$ source venv/bin/activate
+(venv) $ maturin develop --release
 ```
 
-### 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