Unified Python Client für Questra Platform - Umbrella Package für Authentication und Data API
Project description
Questra Umbrella Package and Docs
Dieses Repository bündelt alle Questra Python Packages als Submodule und generiert die gemeinsame Dokumentation.
Verwendung
Installation
pip install seven2one-questra
Dies installiert automatisch:
seven2one-questra-authentication(OAuth2 Authentifizierung)seven2one-questra-data(GraphQL + REST Data API)
Schnellstart
from questra import QuestraAuthentication, QuestraData
# Authentication
auth = QuestraAuthentication(
url="https://auth.example.com",
username="service_user",
password="secret"
)
# Data Client (High-Level API)
client = QuestraData(
graphql_url="https://api.example.com/graphql",
auth_client=auth
)
# Daten abrufen
items = client.list(
inventory_name="Sensors",
namespace="IoT"
)
# TimeSeries-Daten laden
from datetime import datetime
values = client.list_timeseries_values(
inventory_name="Stromzaehler",
namespace="Energie",
timeseries_property="messwerte_Energie",
from_time=datetime(2024, 1, 1),
to_time=datetime(2024, 1, 31)
)
Fortgeschrittene Verwendung
Alle Sub-Package-APIs bleiben direkt zugänglich:
# Low-Level Data API
from questra import QuestraDataCore
core_client = QuestraDataCore(graphql_url="...", auth_client=auth)
inventories = core_client.queries.get_inventories()
# Spezifische Models
from questra import (
Inventory, Namespace, TimeSeriesValue,
SortOrder, ConflictAction
)
# Direkter Sub-Paket-Zugriff für erweiterte Features
from questra_data.models import InventoryPrivilege
from questra_authentication.authentication import OidcDiscoveryClient
Verfügbare Komponenten
Das Umbrella-Package exportiert:
Core Clients:
QuestraAuthentication- OAuth2 AuthentifizierungQuestraData- High-Level Data API (empfohlen)QuestraDataCore- Low-Level Data API
Häufig verwendete Models:
- GraphQL:
Inventory,InventoryProperty,Namespace,Role,Unit,TimeZone - TimeSeries:
TimeSeriesValue,Aggregation,Quality,TimeUnit,Interval - Input Models:
StringPropertyConfig,FilePropertyConfig,TimeSeriesPropertyConfig - REST:
TimeSeriesData,SetTimeSeriesDataInput,File
Exceptions:
AuthenticationError,InvalidCredentialsError,TokenExpiredError
Siehe src/questra/__init__.py für vollständige Liste.
Struktur
.
├── authentication/ # git submodule: questra-authentication
├── data/ # git submodule: questra-data
├── docs/ # zentrale Dokumentation
├── scripts/
│ └── update_versions.py # Hook: sync Versionen → Docs & pyproject.toml
├── pyproject.toml # Umbrella-Package Dependencies
└── mkdocs.yml # Docs-Konfiguration
Workflows
Alle Packages sind auf PyPI verfügbar.
Workflow A: Submodul-Update (z.B. questra-data)
Wenn ein Submodul (data/authentication) aktualisiert wurde und bereits nach PyPI deployt wurde:
1. Lokale Änderungen pullen
cd data
git pull
cd ..
2. Neues Release nach PyPI deployen
Im Submodul (z.B. data/):
# Build
uv build
# Upload nach PyPI
uv publish --token <your-token>
Alternativ mit dem Build-Skript:
./buildAndPublish.sh <token> --pypi
3. Dependencies im Umbrella-Package aktualisieren
# Im Root-Verzeichnis - Version in pyproject.toml manuell anpassen, dann:
uv sync
# Oder direkt mit uv add:
uv add "seven2one-questra-data>=0.8.0"
uv add "seven2one-questra-authentication>=0.2.2"
4. Questra Version erhöhen
Version in pyproject.toml manuell anpassen oder mit einem Tool:
uv version --bump patch
4. Dokumentation bauen
uv run mkdocs build
Was passiert beim Build:
- Hook (mkdocs.yml:57) führt
scripts.update_versions:update_versionsaus - Liest Versionen aus allen
pyproject.toml-Dateien (Root + Submodule) - Aktualisiert Versionsnummern in:
docs/index.md(Umbrella-Package)docs/data/index.md(questra-data)docs/authentication/index.md(questra-authentication)
5. Optional: Dokumentation lokal ansehen
uv run mkdocs serve
Öffnet Docs unter http://127.0.0.1:8000.
Workflow B: Umbrella-Package Release
Wenn das Umbrella-Package selbst eine neue Version bekommen soll (z.B. nach Dependency-Updates):
1. Version bumpen
# In pyproject.toml manuell editieren:
# version = "0.4.4" # patch: 0.4.3 → 0.4.4
# version = "0.5.0" # minor: 0.4.3 → 0.5.0
# version = "1.0.0" # major: 0.4.3 → 1.0.0
2. Build & Publish
uv build
uv publish --token <your-token>
# Oder mit Build-Skript:
./buildAndPublish.sh <token> --pypi
3. Dokumentation aktualisieren
uv run mkdocs build
Der Hook aktualisiert automatisch die Version in docs/index.md.
4. Optional: Deploy Docs
Wenn die Docs auf einem Server deployed werden sollen:
# Beispiel: rsync, S3, Azure Blob Storage, etc.
rsync -av site/ user@server:/var/www/docs/
Dependency-Management
PyPI als Quelle
Alle Packages (seven2one-questra, seven2one-questra-authentication, seven2one-questra-data) sind auf PyPI verfügbar und werden automatisch von dort bezogen.
Version Constraints
Die Version-Ranges in pyproject.toml nutzen Standard-PEP 440 Syntax:
dependencies = [
"seven2one-questra-authentication>=0.1.5,<0.3.0",
"seven2one-questra-data>=0.7.3",
]
- Ermöglicht Patch- und Minor-Updates
- Verhindert Breaking Changes bei Major-Version-Bumps
Manuelle Anpassung nötig bei:
- Neuer Major-Version
- Besonderen Dependency-Anforderungen
Häufige Probleme
Neue Package-Version wird nicht gefunden
Ursache: Cache-Problem oder Package noch nicht auf PyPI.
# uv Cache löschen
uv cache clean
# Neu synchronisieren
uv sync
Hook-Fehler beim Build
Ursache: toml-Package fehlt in docs-Dependencies.
Lösung: Bereits in pyproject.toml unter [project.optional-dependencies.docs] definiert.
Falsche Version installiert
Diagnose:
uv pip list | grep seven2one
Lösung:
# Version in pyproject.toml anpassen, dann:
uv sync
# oder direkt:
uv add "seven2one-questra-data>=0.8.0"
Installation (für Entwickler)
# Repository klonen mit Submodulen
git clone --recursive <repo-url>
# Dependencies installieren (inkl. docs)
uv sync --all-groups
# Docs bauen
uv run mkdocs build
Erste Schritte
Nach erfolgreicher Installation:
- Lokaler Dev-Server:
uv run mkdocs serve - Static Build:
uv run mkdocs build→ Output insite/ - Tests laufen:
cd data && uv run pytest
Weitere Infos
- MkDocs Material: https://squidfunk.github.io/mkdocs-material/
- mkdocstrings: https://mkdocstrings.github.io/python/
- uv Documentation: https://docs.astral.sh/uv/
Project details
Release history Release notifications | RSS feed
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 seven2one_questra-0.4.4.tar.gz.
File metadata
- Download URL: seven2one_questra-0.4.4.tar.gz
- Upload date:
- Size: 3.9 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.11 {"installer":{"name":"uv","version":"0.9.11"},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
17a2f3b25edb358d416660d2cc0dcb4d572ad5d08327682f7c26c7122ed5b3b0
|
|
| MD5 |
a6b941f24b7a3d8621f36d39584763c7
|
|
| BLAKE2b-256 |
ce364556093867ab181b70420be3713a0e04e2753e1b672aaa00ad89da65c2ab
|
File details
Details for the file seven2one_questra-0.4.4-py3-none-any.whl.
File metadata
- Download URL: seven2one_questra-0.4.4-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.11 {"installer":{"name":"uv","version":"0.9.11"},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c2807463e23e0bc1a601ab875a437a8aef74d690ff16f7b1f3a80c3be5ce9187
|
|
| MD5 |
15c885a839278f8f3ccd04abb388e7e5
|
|
| BLAKE2b-256 |
326bc12565e7dfc70392e8b6ff2e2ff90ed42b55185665687a14bd3793b094a0
|