darkfi-sdk-python: Clean up doc and support zkbin.k()

This commit is contained in:
x
2023-07-28 21:48:15 +00:00
parent 3529519855
commit 4379ffdafc
3 changed files with 11 additions and 6 deletions

View File

@@ -5,6 +5,9 @@ MATURIN = maturin
all:
$(MATURIN) build --release
@echo "You can install this wheel with pip install"
@echo "You can install this wheel with make install"
dev:
$(MATURIN) develop --release
.PHONY: all

View File

@@ -4,7 +4,7 @@ Python bindings for some parts of the `darkfi-sdk` and the `zkvm`.
## Build and install
1. Install `maturin` via your package manager or from whatever source.
1. Install `maturin` via your package manager or from source.
2. Run `make` to build the wheel
3. (Optional) Run pip install --user <path_to_wheel>
@@ -15,16 +15,14 @@ For a development version you can use a venv:
```
$ python3 -m venv venv
$ source venv/bin/activate
(venv) $ maturin develop --release
(venv) $ make dev
```
## Usage
```
$ python3
$ python
>>> 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)

View File

@@ -64,6 +64,10 @@ impl ZkBinary {
})
.collect()
}
fn k(&self) -> u32 {
self.0.k
}
}
pub fn create_module(py: pyo3::Python<'_>) -> pyo3::PyResult<&PyModule> {