This release is a pre-release and may not be stable for production use.
◼️ The marginfi Python SDK ◼️
marginpy is the python library for interacting with marginfi, the decentralized portfolio margin protocol on Solana.
🏎 Quickstart
Installation
pip install marginpy
Running marginpy in a Github Codespace
marginpy is installed out-of-the-box in the [.devcontainer/Dockerfile](Python SDK Codespace).
Enable Github Codespaces for your Github user or organization account and spin up a machine for a no-hassle way to get started!
Installing on an M1
If you are using an M1, you need to install marginpy through a Rosetta-enabled x86_64 version of python. If starting from scratch:
- Install brew into
/usr/local/
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
-
Open a terminal instance with Rosetta enabled
-
Install a supported version of python with brew from
/usr/local/:
$ /usr/local/bin/brew install python@[PYTHON_VERSION]
- Create a new virtualenv using newly installed python:
/usr/local/opt/python@[PYTHON_VERSION]/bin/python3 -m venv .env
- Activate new env
source .env/bin/activate
- Install
marginpywith pip from env:
pip install marginpy
General Usage
import marginpy
Check out the examples for more details.
👷♀️ Development
Setup local development environment
- Ensure you have python installed.
- Install poetry:
$ curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python - - Install nox-poetry:
$ pip install nox-poetry - Initialize Python virtual environment:
$ poetry env use [PYTHON_VERSION] - Install project dependencies:
$ poetry install - Activate virtual environment:
$ poetry shell - Build the rust crate and install it locally:
$ maturin develop
Running tests
As of writing, only a small subset of tests can be run by the user, due to initially private dependencies. They can be run like so:
- Activate virtual environment:
$ poetry shell
- Run desired task:
- unit tests only:
$ make test-unit - type check + lint:
$ make lint
- unit tests only:
Feel free to check the Makefile for other available actions.
Metadata
Release files for marginpy 0.1.0a2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| marginpy-0.1.0a2.tar.gz | 13.4 kB | Details |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| marginpy-0.1.0a2-cp39-abi3-win_amd64.whl | CPython 3.9 | abi3 | Windows x86-64 | Details |
| marginpy-0.1.0a2-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl | CPython 3.9 | abi3 | Linux glibc 2.5+ x86-64 | Details |
| marginpy-0.1.0a2-cp39-abi3-macosx_10_7_x86_64.whl | CPython 3.9 | abi3 | macOS 10.7+ x86-64 | Details |
Total release size: 1.8 MB
Release files / marginpy-0.1.0a2.tar.gz
| Download URL | marginpy-0.1.0a2.tar.gz |
|---|---|
| Size | 13.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7f12eab6ad04d126b0c6259641736800adef29139d0b51ab8d1ab26e8d88c9c6
|
|
BLAKE2b-256 checksum How to use checksums |
38623a7d47b133b3d13abae9b912d762fdd9083338de66f6485fb18d453b72d7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/0.13.2
|
Release files / marginpy-0.1.0a2-cp39-abi3-win_amd64.whl
| Download URL | marginpy-0.1.0a2-cp39-abi3-win_amd64.whl |
|---|---|
| Size | 271.0 kB |
| Tags | CPython 3.9 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
8d6cad5ccc5f609434678821a3755c89b3edd345fd5aa4a300cd719ed27bbd80
|
|
BLAKE2b-256 checksum How to use checksums |
627687a59ef3eaa1e68fefe02861109180b98092b6a37a99de186edc43203e09
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/0.13.2
|
Release files / marginpy-0.1.0a2-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl
| Download URL | marginpy-0.1.0a2-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.9 Linux glibc 2.5+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
3e2e22e20029512acec2515dadf51a8463009e03eb49e4c520d53865e61e977b
|
|
BLAKE2b-256 checksum How to use checksums |
20918ec249f0a08174da0a4ed122ca165573c0d356a7640b5f9a901610e12fba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/0.13.2
|
Release files / marginpy-0.1.0a2-cp39-abi3-macosx_10_7_x86_64.whl
| Download URL | marginpy-0.1.0a2-cp39-abi3-macosx_10_7_x86_64.whl |
|---|---|
| Size | 384.4 kB |
| Tags | CPython 3.9 abi3 macOS 10.7+ x86-64 |
|
SHA-256 checksum How to use checksums |
0f995e6a86c8dfdbf7053a9259a84f165e03be90554913af021414d07746cb46
|
|
BLAKE2b-256 checksum How to use checksums |
67e3b92c94e8d8166505c533e523d2317b4f7dee0ef4162819de2ac3884fc786
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/0.13.2
|