Skip to content

Commit d1865ff

Browse files
author
Matthias Zimmermann
committed
improve README
1 parent 64e5370 commit d1865ff

File tree

1 file changed

+61
-77
lines changed

1 file changed

+61
-77
lines changed

README.md

Lines changed: 61 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,23 @@ Arkiv is a permissioned storage system for decentralized apps, supporting flexib
44

55
The Arkiv SDK is the official Python library for interacting with Arkiv networks. It offers a type-safe, developer-friendly API for managing entities, querying data, subscribing to events, and offchain verification—ideal for both rapid prototyping and production use.
66

7-
## SDK Architecture
7+
## Architecture
88

9-
### Principles
9+
Principles:
10+
- The SDK is based on a modern and stable client library.
11+
- The SDK should feel like "Library + Entities"
1012

11-
SDK should be directly derived from one of the most well known and more recent client libraries.
12-
13-
Highlevel goals:
14-
1. Go with the flow of the language and the library.
15-
2. Whatever works for the library should also work for the SDK
16-
3. Feels like "Library + Entities".
17-
18-
### Underlying Library
19-
20-
As underlying library we use [Web3.py](https://github.com/ethereum/web3.py) (no good alternatives).
21-
22-
### Naming
23-
24-
Github "Home": `arkiv-network`
25-
| Language | Element | Name | Comment |
26-
|----------|------------|----------------|-------------------------|
27-
| Python | Repository | `arkiv-sdk-python` | Golem Base repo: `python-sdk` move and rename to `arkiv-python-beta` |
28-
| Python | PIP | `pip install arkiv-sdk` | or `pip install arkiv` as `arkiv` is not available for Rust |
13+
As underlying library we use [Web3.py](https://github.com/ethereum/web3.py) (no good alternatives for Python).
2914

3015

3116
### Arkiv Client
3217

33-
Goal: Make Arkiv feel like "web3.py + entities", maintaining the familiar developer experience that Python web3 developers.
18+
The Arkiv SDK should feel like "web3.py + entities", maintaining the familiar developer experience that Python web3 developers.
3419

35-
A `client.entities.*` approach for consistency with web3.py's module pattern. It clearly communicates that arkiv is a module extension just like eth, net, etc.
20+
A `client.arkiv.*` approach is in line with web3.py's module pattern.
21+
It clearly communicates that arkiv is a module extension just like eth, net, etc.
3622

23+
## Hello World
3724
Here's a "Hello World!" example showing how to use the Python Arkiv SDK:
3825

3926
```python
@@ -49,8 +36,9 @@ provider = HTTPProvider('https://kaolin.hoodi.arkiv.network/rpc')
4936
account = NamedAccount.from_wallet('Alice', wallet, 's3cret')
5037
client = Arkiv(provider, account = account)
5138

52-
# Check connection
39+
# Check connection and balance
5340
print(f"Connected: {client.is_connected()}")
41+
print(f"Account balance: {client.eth.get_balance(account.address)}")
5442

5543
# Create entity with data and annotations
5644
entity_key, tx_hash = client.arkiv.create_entity(
@@ -66,16 +54,26 @@ print(f"Entity: {entity}")
6654

6755
# TODO
6856
# Clean up - delete entities
69-
print("\n=== Cleanup ===")
7057
client.arkiv.delete_entity(entity_key)
7158
print("Entities deleted")
7259

7360
# Verify deletion
74-
exists = client.arkiv.exists(entity_key1)
61+
exists = client.arkiv.exists(entity_key)
7562
print(f"Entity 1 exists? {exists}")
7663
```
7764

78-
Arkiv extensions
65+
### Web3 Standard Support
66+
```python
67+
from web3 import HTTPProvider
68+
provider = HTTPProvider('https://kaolin.hoodi.arkiv.network/rpc')
69+
70+
# Arkiv 'is a' Web3 client
71+
client = Arkiv(provider)
72+
balance = client.eth.get_balance(client.eth.default_account)
73+
tx = client.eth.get_transaction(tx_hash)
74+
```
75+
76+
### Arkiv Module Extension
7977
```python
8078
from arkiv import Arkiv
8179
from arkiv.account import NamedAccount
@@ -90,90 +88,76 @@ entity_key, tx_hash = client.arkiv.create_entity(
9088
)
9189

9290
entity = client.arkiv.get_entity(entity_key)
93-
````
91+
exists = client.arkiv.exists(entity_key)
92+
```
9493

95-
Web3 standard
96-
```python
97-
from web3 import HTTPProvider
98-
provider = HTTPProvider('https://kaolin.hoodi.arkiv.network/rpc')
94+
## Development Guide
9995

100-
# Arkiv 'is a' Web3 client
101-
client = Arkiv(provider)
102-
balance = client.eth.get_balance(client.eth.default_account)
103-
client.eth.get_transaction(tx_hash)
104-
````
96+
### Branches, Versions, Changes
10597

106-
# Development Guide
98+
#### Branches
10799

108-
## Code Quality and Type Safety
100+
The current stable branch on Git is `main`.
101+
Currently `main` hosts the initial SDK implementation.
109102

110-
This project uses comprehensive linting and type checking to maintain high code quality:
103+
The branch `v1-dev` hosts the future V1.0 SDK release.
111104

112-
### Tools Used
105+
#### Versions
113106

114-
- **MyPy**: Static type checker with strict configuration
115-
- **Ruff**: Fast linter and formatter (replaces black, isort, flake8, etc.)
116-
- **Pre-commit**: Automated quality checks on git commits
107+
For version management the [uv](https://github.com/astral-sh/uv) package and project manger is used.
108+
Use the command below to display the current version
109+
```bash
110+
uv version
111+
```
112+
113+
SDK versions are tracked in the following files:
114+
- `pyproject.toml`
115+
- `uv.lock`
116+
117+
### Code Quality
118+
119+
This project uses comprehensive unit testing, linting and type checking to maintain high code quality:
117120

118-
### Quick Commands
121+
#### Quick Commands
119122

123+
Before any commit run quality checks:
120124
```bash
121-
# Run all quality checks
122125
./scripts/check-all.sh
126+
```
127+
128+
#### Tools Used
129+
130+
- **MyPy**: Static type checker with strict configuration
131+
- **Ruff**: Fast linter and formatter (replaces black, isort, flake8, etc.)
132+
- **Pre-commit**: Automated quality checks on git commits
123133

124-
# Individual tools
134+
#### Individual commands
135+
```bash
125136
uv run ruff check . --fix # Lint and auto-fix
126137
uv run ruff format . # Format code
127138
uv run mypy src/ tests/ # Type check
128139
uv run pytest tests/ -v # Run tests
129140
uv run pytest --cov=src # Run code coverage
141+
uv run pre-commit run --all-files # Manual pre commit checks
130142
```
131143

132-
### Pre-commit Hooks
144+
#### Pre-commit Hooks
133145

134146
Pre-commit hooks run automatically on `git commit` and will:
135147
- Fix linting issues with ruff
136148
- Format code consistently
137149
- Run type checking with mypy
138150
- Check file formatting (trailing whitespace, etc.)
139151

140-
To run pre-commit manually:
141-
```bash
142-
uv run pre-commit run --all-files
143-
```
144-
145-
### Type Hints Best Practices
146-
147-
1. **Always use type hints** for function parameters and return values
148-
2. **Use specific types** instead of `Any` when possible
149-
3. **Import types** from `typing` or `collections.abc` as needed
150-
4. **Use Union types** for multiple acceptable types: `str | int`
151-
5. **Generic containers**: `list[str]`, `dict[str, int]`, etc.
152-
153-
### Example Type-Safe Code
154-
155-
```python
156-
from collections.abc import Generator
157-
from typing import Any
158-
159-
def process_data(items: list[dict[str, Any]]) -> Generator[str, None, None]:
160-
"""Process data items and yield formatted strings."""
161-
for item in items:
162-
if isinstance(item.get("name"), str):
163-
yield f"Processing: {item['name']}"
164-
```
165-
166-
### MyPy Configuration
152+
#### MyPy Settings
167153

168-
The project uses strict mypy settings:
169154
- `strict = true` - Enable all strict checks
170155
- `no_implicit_reexport = true` - Require explicit re-exports
171156
- `warn_return_any = true` - Warn about returning Any values
172157
- Missing imports are ignored for third-party libraries without type stubs
173158

174-
### Ruff Configuration
159+
#### Ruff Configuration
175160

176-
Ruff is configured to:
177161
- Use 88 character line length (Black-compatible)
178162
- Target Python 3.12+ features
179163
- Enable comprehensive rule sets (pycodestyle, pyflakes, isort, etc.)

0 commit comments

Comments
 (0)