Files

149 lines
4.6 KiB
Markdown
Raw Permalink Normal View History

2026-05-24 17:14:34 +03:00
# Status Python SDK
2026-02-24 21:46:56 +02:00
2026-08-05 20:10:20 +03:00
![Status Python SDK header image](https://raw.githubusercontent.com/status-im/status-python-sdk/refs/heads/master/docs/images/readme/overview.png)
2026-05-06 18:54:37 +03:00
2026-07-14 20:40:07 +03:00
[Status](http://status.app/) is a decentralized, open-source super app combining a crypto wallet, messenger, and community spaces. It uses peer-to-peer technology so no central server can censor your messages or access your data.
2026-05-24 17:14:34 +03:00
The initial Python Status Backend was built with testing in mind, instead of easy developer access. The objective of this repository is to make a SDK that is:
2026-05-06 18:54:37 +03:00
2026-05-24 17:14:34 +03:00
- **light** - as less external packages when it comes to working with Status App
- **fast** - quick to get started with Status Python
- **documented** - clear explanations of what was done and **why it was done in a specific way**.
2026-05-06 18:54:37 +03:00
## How it works
```mermaid
2026-05-24 17:14:34 +03:00
graph TB
2026-05-24 20:46:07 +03:00
subgraph backend[status-im/status-go]
subgraph Endpoints[Network: status-bridge]
2026-05-24 17:14:34 +03:00
RPC[RPC]
HTTP[REST]
SOCKET[Web Socket]
end
2026-05-24 20:46:07 +03:00
Vol1[(Backup)]
Vol2[(Assets)]
2026-05-24 17:14:34 +03:00
end
2026-05-06 18:54:37 +03:00
2026-05-24 17:14:34 +03:00
2026-07-14 20:40:07 +03:00
subgraph bot[status-im/status-python-sdk]
2026-07-15 15:24:33 +03:00
GROUP_CHAT[class GroupChat]
2026-07-28 19:05:13 +03:00
COMMUNITY[class Community]
CHANNEL[class Channel]
2026-05-24 17:14:34 +03:00
SDK[class Account]
SIGNAL[class Signal]
2026-05-06 18:54:37 +03:00
end
2026-05-24 17:14:34 +03:00
subgraph external[External Services]
COINGECKO[CoinGecko]
2026-06-23 08:01:37 +03:00
ALCHEMY[Alchemy]
INFURA[Infura]
2026-05-06 18:54:37 +03:00
end
2026-07-28 19:05:13 +03:00
COMMUNITY --> CHANNEL
COMMUNITY <--> |logged in Account| SDK
GROUP_CHAT <--> |logged in Account| SDK
2026-05-24 20:46:07 +03:00
SDK --> SIGNAL
SDK --> |Port 8080| RPC
SDK --> |Port 8080| HTTP
SIGNAL --> |Port 8080| SOCKET
SDK --> Vol1
SDK --> Vol2
RPC --> |coingecko_api_key| COINGECKO
2026-06-23 08:01:37 +03:00
RPC --> |infura_token| INFURA
HTTP --> |alchemy_token| ALCHEMY
2026-05-06 18:54:37 +03:00
```
2026-02-24 21:46:56 +02:00
2026-05-24 17:14:34 +03:00
## Setup
2026-02-24 21:46:56 +02:00
2026-05-24 17:14:34 +03:00
To access Python funcitonality you will have to set up [Status Backend](https://github.com/status-im/status-go/). Easiest and fastest way to get it running would be with [Docker](https://www.docker.com/products/docker-desktop/).
2026-03-03 20:01:11 +00:00
2026-05-24 17:14:34 +03:00
```mermaid
sequenceDiagram
actor User
participant Docker
2026-07-14 20:40:07 +03:00
participant Python@{"alias": "status-im/status-python-sdk"}
2026-05-24 17:14:34 +03:00
participant Github@{"alias": "status-im/status-go" }
User ->> Docker: docker-compose up
Docker ->> Github: Fetch Image
Docker ->> Docker: Build
User ->> Docker: Run container
User ->> Python: initialize module
2026-07-14 20:40:07 +03:00
Note over User,Python: from status_sdk import Account<br>account = Account()
2026-03-05 18:06:39 +00:00
```
2026-05-24 17:14:34 +03:00
### Python
2026-03-05 18:06:39 +00:00
2026-07-14 20:40:07 +03:00
#### Install
2026-08-03 15:04:27 +03:00
##### [PyPI](https://pypi.org/project/status-sdk/)
2026-07-28 23:31:58 +03:00
```
pip install status-sdk
```
##### Locally
2026-07-14 20:40:07 +03:00
Clone the repository and move into it:
```
git clone https://github.com/status-im/status-python-sdk.git
cd status-python-sdk
2026-02-24 21:46:56 +02:00
```
2026-07-14 20:40:07 +03:00
Install the base library:
2026-03-05 18:06:39 +00:00
2026-02-24 21:46:56 +02:00
```
2026-07-14 20:40:07 +03:00
pip install .
```
If you want to modify the library itself without having to reinstall:
```
pip install -e .
```
#### Uninstall
```
pip uninstall status-sdk
```
2026-05-24 20:46:07 +03:00
### Docker
2026-07-14 20:40:07 +03:00
[`status-im/status-go`](https://github.com/status-im/status-go/) runs from the provided [`docker-compose.yaml`](./status_sdk/docker-compose.yaml) file. It does not use a pre-built image - it builds the backend from source, pulling directly from GitHub.
2026-05-24 20:46:07 +03:00
2026-07-14 20:40:07 +03:00
To run on Windows, please make sure you have set up [WSL](https://learn.microsoft.com/en-us/windows/wsl/install). It is **required** for the `build: context` above. The SDK invokes Docker through WSL so it can build the Linux image and clone the repository during the build. If the `build` is changed to point to a local repository, then WSL is not required.
You can set it up in **two** ways.
#### With Python
2026-08-07 23:04:03 +03:00
Use [`launch_docker_container`](./docs/utils.md#launch_docker_containercommitnone-wait_seconds5-platformlinuxamd64-data_foldernone), which builds and starts the container for you. This is the recommended option, as it handles platform selection and (on Windows) recovers from stale Docker mounts:
2026-05-24 20:46:07 +03:00
```python
2026-07-14 20:40:07 +03:00
from status_sdk import launch_docker_container
2026-05-24 20:46:07 +03:00
launch_docker_container()
```
2026-07-14 20:40:07 +03:00
#### Manually
Run the compose file yourself. It lives inside the installed package, so point Docker at it:
```
docker compose -f status_sdk/docker-compose.yaml up -d
```
2026-08-07 23:04:03 +03:00
The compose file reads three variables from the environment. All of them have a default, so the command above works as-is, but they can be overridden:
2026-07-14 20:40:07 +03:00
| Variable | Default | Description |
|-----|-----|-------------|
2026-08-07 23:04:03 +03:00
| `STATUS_GO_COMMIT` | `develop` | The [`status-im/status-go`](https://github.com/status-im/status-go/) git ref (commit SHA, branch or tag) to build from. |
2026-08-18 08:43:44 +03:00
| `STATUS_GO_PLATFORM` | `linux/amd64` | The platform the image is built for. |
2026-07-14 20:40:07 +03:00
```
2026-08-18 08:43:44 +03:00
STATUS_GO_COMMIT=2bee8b6a38cdc8f92d74e2dbb8c4e77fbbeea149 PLATFORM=linux/amd64 docker compose -f status_sdk/docker-compose.yaml up -d
2026-07-14 20:40:07 +03:00
```