Libreria Python asincrona per interagire con PocketBase e SDC, pensata per Windmill
Project description
windmill-sdk
Libreria Python asincrona per interagire con sistemi PocketBase e SDC, pensata per l'uso all'interno di Windmill.
✨ Funzionalità
- Recupero asincrono dei tenant da PocketBase (filtrabile)
- Interrogazione dei servizi da API SDC con autenticazione automatica
- Compatibilità futura con Directus tramite interfaccia unificata
- Supporto alla validazione con Pydantic
- Invio opzionale di notifiche su Slack in caso di errore
📦 Installazione
pip install windmill-sdk
# oppure
poetry add windmill-sdk
⚙️ Requisiti
- Python 3.10+
- httpx, pydantic, pytest, respx, pytest-asyncio
🚀 Esempio d’uso
import asyncio
from windmill_sdk.clients.pocketbase import PocketBaseClient
from windmill_sdk.clients.sdc import SDCClient
async def main():
pb = PocketBaseClient("https://pb.example.com", "admin", "password")
await pb.authenticate()
tenants = await pb.list_tenants(filters={"identifier": "oc-pnrr-1"})
await pb.close()
for tenant in tenants:
sdc = SDCClient(str(tenant.production_url), "sdc_user", "sdc_pass")
services = await sdc.list_services()
await sdc.close()
for service in services:
print(service.name)
asyncio.run(main())
✅ Test
pytest
📁 Struttura del progetto
windmill_sdk/
├── clients/
│ ├── pocketbase.py
│ ├── sdc.py
│ ├── directus.py
│ └── base_client.py
├── models.py
├── notifiers/
│ └── slack.py
🧪 Esecuzione dei test
Per eseguire la suite di test e controllare che tutto funzioni correttamente:
pytest
Assicurati di avere le dipendenze installate:
pip install -r requirements-dev.txt
✅ Verifica della copertura
Per eseguire i test e generare un report di copertura del codice:
pytest --cov=windmill_sdk --cov-report=term-missing
Questo comando:
- Esegue tutti i test
- Mostra a terminale le righe di codice non coperte
- Usa il modulo
windmill_sdkcome riferimento per il calcolo della copertura
Puoi anche generare un report HTML navigabile:
pytest --cov=windmill_sdk --cov-report=html
Il report sarà disponibile nella cartella htmlcov/index.html.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file windmill_sdk-0.0.8.tar.gz.
File metadata
- Download URL: windmill_sdk-0.0.8.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.2 CPython/3.12.0 Darwin/24.4.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ec61d363a816c87f148b07deb9c0ee51c42bb4b8a763cf920eb18f20fb281d8f
|
|
| MD5 |
1c9ac46360da9274e068e122f79bd553
|
|
| BLAKE2b-256 |
6d44bd938eac09b94719f9143e0660c6dbf6f188e89300c9295466d901d0a7e4
|
File details
Details for the file windmill_sdk-0.0.8-py3-none-any.whl.
File metadata
- Download URL: windmill_sdk-0.0.8-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.2 CPython/3.12.0 Darwin/24.4.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
349e28e756b6f98ea1318ed4e1517c381a72d98bb604a523063c37728fb790ef
|
|
| MD5 |
609cc44d7f08d75e17770cc16fcd2934
|
|
| BLAKE2b-256 |
dbed61eb95cb7ce7623102713608cd7965fba5b11e9ab44f471648eb0e207c4e
|