Skip to main content

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)
)

Git Submodules

Dieses Repository bündelt folgende Questra-Packages als Git Submodules:

Neues Client-Submodul einbinden

Wenn ein neuer Questra-Client (z.B. questra-reporting) als Submodul hinzugefügt werden soll:

1. Submodul hinzufügen

git submodule add <repository-url> <target-directory>
# Beispiel:
git submodule add https://github.com/seven2one/questra-reporting.git reporting
Sonderfall: Nur Unterordner aus Repository auschecken

Wenn der Python-Client in einem Unterordner des Repositories liegt (z.B. src/python-client):

# Submodule mit Branch hinzufügen
git submodule add --branch <branch-name> <repository-url> <target-directory>

cd <target-directory>

# Sparse-checkout aktivieren (nur Unterordner auschecken)
git sparse-checkout init --cone
git sparse-checkout set <subdirectory-path>

# Branch auschecken
git checkout <branch-name>

cd ..

# Beispiel: questra-automation aus Azure DevOps
git submodule add --branch feat/python-package \
  https://seven2one@dev.azure.com/seven2one/Seven2one.Questra/_git/S2O.Questra.Automation \
  automation

cd automation
git sparse-checkout init --cone
git sparse-checkout set src/python-client
git checkout feat/python-package
cd ..

Hinweis: Bei sparse-checkout ist nur src/python-client/ sichtbar, nicht das gesamte Repository.

2. Dependency in pyproject.toml eintragen

Füge das neue Package in pyproject.toml unter dependencies hinzu:

[project]
dependencies = [
    "seven2one-questra-authentication>=0.1.5,<0.3.0",
    "seven2one-questra-data>=0.7.3",
    "seven2one-questra-reporting>=0.1.0",  # NEU
]

3. Package in init.py re-exportieren

Bearbeite src/questra/init.py und füge Re-Exports hinzu:

# Reporting Client
from questra_reporting import QuestraReporting

__all__ = [
    # ... existing exports
    "QuestraReporting",
]

4. MkDocs-Konfiguration erweitern

Füge in mkdocs.yml unter nav und plugins.mkdocstrings.handlers.python.paths das neue Submodul hinzu:

nav:
  - Home: index.md
  - Authentication: authentication/index.md
  - Reporting: reporting/index.md  # NEU
  - Data: data/index.md

plugins:
  - mkdocstrings:
      handlers:
        python:
          paths:
            - authentication/src
            - reporting/src  # NEU
            - data/src
Bei Submodule mit Unterordner-Struktur

Beispiel: automation/src/python-client/src

paths:
  - authentication/src
  - automation/src/python-client/src  # Angepasster Pfad
  - data/src

5. Dokumentations-Index erstellen

Erstelle docs/reporting/index.md mit folgendem Inhalt:

# Questra Reporting

::: questra_reporting

6. Synchronisieren und testen

# Dependencies installieren
uv sync

# Dokumentation bauen
uv run mkdocs build

# Lokal testen
uv run mkdocs serve

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_versions aus
  • 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:

  1. Lokaler Dev-Server: uv run mkdocs serve
  2. Static Build: uv run mkdocs build → Output in site/
  3. Tests laufen: cd data && uv run pytest

Weitere Infos

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

seven2one_questra-0.5.1.tar.gz (4.2 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

seven2one_questra-0.5.1-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file seven2one_questra-0.5.1.tar.gz.

File metadata

  • Download URL: seven2one_questra-0.5.1.tar.gz
  • Upload date:
  • Size: 4.2 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

Hashes for seven2one_questra-0.5.1.tar.gz
Algorithm Hash digest
SHA256 cb84acb1108e2d716abe87797d4cb8f1b34c296d477475623b320d52f68ee843
MD5 c1ff9021219e57ddcdd291bb0bec5b5c
BLAKE2b-256 9f07c1c99fc5c68d92fba7a705c8ca116d4bf3889e9b9741fefcab4133a249ce

See more details on using hashes here.

File details

Details for the file seven2one_questra-0.5.1-py3-none-any.whl.

File metadata

  • Download URL: seven2one_questra-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 5.9 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

Hashes for seven2one_questra-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 072c9cb83bd034018418baa249c5d41d8dd9ee3b37418411783e16d80f5be9d0
MD5 122217648d18a0b7b7a473c6f3c9969a
BLAKE2b-256 02bc2991e4ef85cec84fb3f174e2a2fd20d0811665784d8572e8a07d81347886

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page