Skip to main content

ds-provider-xledger-py-lib

A Python package from the ds-common library collection.

Installation

Install the package using pip:

pip install ds-provider-xledger-py-lib

Or using uv (recommended):

uv pip install ds-provider-xledger-py-lib

Quick Start

from ds_provider_xledger_py_lib import __version__

print(f"ds-provider-xledger-py-lib version: {__version__}")

Features

  • Linked service support for Xledger GraphQL authentication and connectivity checks
  • Dataset operations for read, create, update, and delete workflows
  • Pagination and checkpoint support for resilient read operations
  • Structured GraphQL error mapping into provider-specific exceptions

Usage

1) Test linked service connection

from uuid import uuid4

from ds_provider_xledger_py_lib.linked_service import (
    XledgerLinkedService,
    XledgerLinkedServiceSettings,
)

linked_service = XledgerLinkedService(
    id=uuid4(),
    name="xledger-linked-service",
    version="1.0.0",
    settings=XledgerLinkedServiceSettings(
        host="https://demo.xledger.net/graphql",
        token="YOUR_XLEDGER_TOKEN",
        timeout=60,
    ),
)

success, message = linked_service.test_connection()
print(success, message)

2) Read data from an entrypoint

from uuid import uuid4

from ds_provider_xledger_py_lib.dataset import XledgerDataset, XledgerDatasetSettings
from ds_provider_xledger_py_lib.dataset.xledger import XledgerReadSettings
from ds_provider_xledger_py_lib.linked_service import XledgerLinkedService, XledgerLinkedServiceSettings

linked_service = XledgerLinkedService(
    id=uuid4(),
    name="xledger-linked-service",
    version="1.0.0",
    settings=XledgerLinkedServiceSettings(
        host="https://demo.xledger.net/graphql",
        token="YOUR_XLEDGER_TOKEN",
        timeout=60,
    ),
)

dataset = XledgerDataset(
    id=uuid4(),
    name="xledger-dataset-read",
    version="1.0.0",
    linked_service=linked_service,
    settings=XledgerDatasetSettings(
        entrypoint="employees",
        read=XledgerReadSettings(
            columns=["dbId", "code", "description"],
            limit=1000,
            first=1000,
        ),
    ),
)

linked_service.connect()
dataset.read()
print(dataset.output.head())

3) Update rows

from uuid import uuid4

import pandas as pd
from ds_provider_xledger_py_lib.dataset import XledgerDataset, XledgerDatasetSettings
from ds_provider_xledger_py_lib.dataset.xledger import XledgerUpdateSettings
from ds_provider_xledger_py_lib.linked_service import XledgerLinkedService, XledgerLinkedServiceSettings

linked_service = XledgerLinkedService(
    id=uuid4(),
    name="xledger-linked-service",
    version="1.0.0",
    settings=XledgerLinkedServiceSettings(
        host="https://demo.xledger.net/graphql",
        token="YOUR_XLEDGER_TOKEN",
        timeout=60,
    ),
)

dataset = XledgerDataset(
    id=uuid4(),
    name="xledger-dataset-update",
    version="1.0.0",
    linked_service=linked_service,
    settings=XledgerDatasetSettings(
        entrypoint="employees",
        update=XledgerUpdateSettings(
            return_columns=["dbId", "code", "description"],
        ),
    ),
)

dataset.input = pd.DataFrame(
    [{"dbId": 1, "code": "EMP-001", "description": "Updated employee"}]
)
linked_service.connect()
dataset.update()
print(dataset.output)

For complete runnable scripts, see the repository's examples/ folder.

Requirements

  • Python 3.11 or higher

Optional Dependencies

  • ds-protocol-http-py-lib>=0.1.0-beta.4,<1.0.0
  • ds-resource-plugin-py-lib>=0.1.0-rc.2,<1.0.0
  • ds-common-logger-py-lib>=0.1.0-alpha.5,<1.0.0

Documentation

Full documentation is available at:

Development

To contribute or set up a development environment:

# Clone the repository
git clone https://github.com/grasp-labs/ds-provider-xledger-py-lib.git
cd ds-provider-xledger-py-lib

# Install development dependencies
uv sync --all-extras --dev

# Run tests
make test

See the README for more information.

License

This package is licensed under the Apache License 2.0. See the LICENSE-APACHE file for details.

Support

Metadata

Release files for ds-provider-xledger-py-lib 0.2.7

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

Source distribution (sdist)

Source distribution for ds-provider-xledger-py-lib 0.2.7
File Size Uploaded Provenance Actions
ds_provider_xledger_py_lib-0.2.7.tar.gz 105.2 kB Without provenance Details for ds_provider_xledger_py_lib-0.2.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ds-provider-xledger-py-lib 0.2.7
File Interpreter ABI Platform Actions
ds_provider_xledger_py_lib-0.2.7-py3-none-any.whl Python 3 none any Details for ds_provider_xledger_py_lib-0.2.7-py3-none-any.whl

Total release size: 283.6 kB

Release files / ds_provider_xledger_py_lib-0.2.7.tar.gz

Download URL ds_provider_xledger_py_lib-0.2.7.tar.gz
Size 105.2 kB
Tags Source
SHA-256 checksum
How to use checksums
a30f23187c9f97e0bf4ecfde8b45cf04919156b672e3f75a4cd531b1fc2d00a9
BLAKE2b-256 checksum
How to use checksums
677cd99467ec60221fa26b64f1d84f305288ea47420305d82073742f49c56295
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / ds_provider_xledger_py_lib-0.2.7-py3-none-any.whl

Download URL ds_provider_xledger_py_lib-0.2.7-py3-none-any.whl
Size 178.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dbf42fd17ace18d9d92e4206176c006f3f88d5f8fb0a68ad38e016cf8d6aefe7
BLAKE2b-256 checksum
How to use checksums
b16b3a0b22cc70670bd2b8242a5db7f9358931a18f78727ce9e3f733ee94bf8b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for ds-provider-xledger-py-lib 0.2.7

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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