|
@@ -1,15 +1,34 @@
|
|
|
-# Installation
|
|
|
|
|
|
|
+# darkfi-sdk-py
|
|
|
|
|
|
|
|
-Follow virtualenv and pyo3 setup guide: https://pyo3.rs/v0.15.1/#using-rust-from-python
|
|
|
|
|
|
|
+## Bootstrap
|
|
|
|
|
|
|
|
-## tldr
|
|
|
|
|
|
|
+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.
|
|
|
|
|
+
|
|
|
|
|
+## Development
|
|
|
|
|
+
|
|
|
|
|
+### Build
|
|
|
|
|
|
|
|
|
|
+After successfully bootstrapping the virtual environment,
|
|
|
|
|
+you can build the sdk by simply executing:
|
|
|
```
|
|
```
|
|
|
-$ python3 -m venv venv
|
|
|
|
|
-$ source venv/bin/activate
|
|
|
|
|
-$ maturin develop --release
|
|
|
|
|
|
|
+$ make
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
|
|
+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
|
|
|
|
|
+
|
|
|
```
|
|
```
|
|
|
$ python3
|
|
$ python3
|
|
|
from darkfi_sdk_py.base import Base
|
|
from darkfi_sdk_py.base import Base
|
|
@@ -18,7 +37,7 @@ b = Base.from_u64(69)
|
|
|
a + b == Base.from_u64(111)
|
|
a + b == Base.from_u64(111)
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
-## Randomness
|
|
|
|
|
|
|
+### Randomness
|
|
|
|
|
|
|
|
Note that the `random` methods take randomness
|
|
Note that the `random` methods take randomness
|
|
|
from the OS on the Rust side.
|
|
from the OS on the Rust side.
|