Skip to main content

xcoreSDK

SDK Python pour developper des plugins xcore.

xcoreSDK fournit les bases, mixins, decorateurs et utilitaires necessaires pour construire des plugins xcore avec des actions, routes HTTP, evenements, hooks, scheduling, cache, observabilite et integrations de services.

Ce que le SDK apporte

  • Une base de plugin prete a l'emploi avec AutoMixin
  • Des decorateurs comme @action, @route, @trusted, @sandboxed
  • La gestion des evenements et hooks avec @on_event et @on_hook
  • Le scheduling avec @cron et @interval
  • Le cache avec @cached et @invalidate
  • Des helpers d'observabilite comme @traced, @timed, @counted, @health_check
  • Des adaptateurs de repository pour SQL async/sync, MongoDB et Redis

Prerequis

  • Python 3.12+
  • uv
  • Le noyau xcore disponible dans l'environnement

Le projet depend de xcore, qui doit etre importable au runtime.

Installation

Pour travailler localement sur le SDK :

git clone https://github.com/traoreera/xcoreSDK
cd xcoreSDK
uv sync

Structure minimale d'un plugin

my_plugin/
├── plugin.yaml
└── src/
    └── main.py

plugin.yaml

name: my_plugin
version: 1.0.0
execution_mode: trusted

src/main.py

from xcore.sdk import AutoMixin, action, ok


class Plugin(AutoMixin):
    @action("ping")
    async def ping(self, payload: dict) -> dict:
        return ok(pong=True)

Exemple rapide

Le SDK expose un point d'entree central :

from xcore.sdk import (
    AutoMixin,
    action,
    route,
    on_event,
    cron,
    cached,
    ok,
)

Exemple avec action, route et evenement :

from xcore.sdk import AutoMixin, Event, action, ok, on_event, route


class Plugin(AutoMixin):
    @action("ping")
    async def ping(self, payload: dict) -> dict:
        return ok(pong=True, plugin=self.ctx.name)

    @route("/ping", method="GET")
    async def ping_route(self):
        return {"pong": True}

    @on_event("user.created")
    async def on_user_created(self, event: Event) -> None:
        self.logger.info("new user: %s", event.data.get("user_id"))

Developpement

# Synchroniser l'environnement
uv sync

# Lancer la documentation locale
uv run mkdocs serve

Documentation

La documentation du projet est dans docs/ :

  • docs/installation.md pour l'installation
  • docs/concepts.md pour l'architecture et les concepts
  • docs/examples/demo-plugin.md pour un plugin de demonstration complet
  • docs/api/ pour les references des decorateurs, manifest, auth, cache, scheduler, observabilite et evenements

Export principal

Le module xcore.sdk reexporte notamment :

  • AutoMixin
  • TrustedBase
  • action, route, trusted, sandboxed, validate_payload
  • on_event, on_hook
  • cron, interval
  • cached, invalidate
  • traced, timed, counted, health_check
  • ok, error

Licence

Ce projet est distribue sous licence LICENSE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xcdk-0.1.0.tar.gz (161.7 kB view details)

Uploaded Source

Built Distribution

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

xcdk-0.1.0-py3-none-any.whl (23.3 kB view details)

Uploaded Python 3

File details

Details for the file xcdk-0.1.0.tar.gz.

File metadata

  • Download URL: xcdk-0.1.0.tar.gz
  • Upload date:
  • Size: 161.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for xcdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2991e0608dbd7a260a5df0f3f1a48a814392315514ae462fb8fc299696bf6602
MD5 264f726b15c1c0ac4821d334f574f400
BLAKE2b-256 7848a44b59454d7773847f02c20fde7b7d6354f108c51d82d52dc1ce590435dc

See more details on using hashes here.

File details

Details for the file xcdk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: xcdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 23.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for xcdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 20963798ca0f5714cbb9e836a2076ad8523a2707c451bb447e948e76a99dce90
MD5 1880f444d7afa6485b6ced50cf519c5b
BLAKE2b-256 83ddaf9e936983e605e18d2cf4944c76ec41e43ec7c969e3e13824a8760fc823

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page