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.

Metadata

Release files for xcdk 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xcdk 0.2.0
File Size Uploaded Provenance
xcdk-0.2.0.tar.gz 162.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for xcdk 0.2.0
File Interpreter ABI Platform
xcdk-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 185.6 kB

Release files / xcdk-0.2.0.tar.gz

Download URL xcdk-0.2.0.tar.gz
Size 162.1 kB
Tags Source
SHA-256 checksum
How to use checksums
ba87b69b061cda6527d177dd76e2fcc66ba76692f057836efca659370a0dad01
BLAKE2b-256 checksum
How to use checksums
b478212de6657ce68a85fa4625a6c452da0e2ff8cd7d59b824e4b97761624696
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.23 {"installer":{"name":"uv","version":"0.12.23","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}

Release files / xcdk-0.2.0-py3-none-any.whl

Download URL xcdk-0.2.0-py3-none-any.whl
Size 23.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
91e3bcb0d987b179374aa30492ec4c6170f6a79494e411789c2a1c6d1220ae27
BLAKE2b-256 checksum
How to use checksums
480018a93653908b229124374285b5b8283032ea8d5e64d4340cf3b871ca490a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.23 {"installer":{"name":"uv","version":"0.12.23","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}

Security for xcdk 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

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