Skip to main content

Python SDK for Walacor

Project description

Walacor Python SDK

License Apache 2.0 Walacor (1100127456347832400) Walacor (1100127456347832400) Walacor (1100127456347832400)

Walacor Python SDK

PyPI License

A typed, lightweight wrapper around Walacor’s REST API for immutable provenance, schema management and (soon) data‑science transformations.


✨ Features

  • One‑liner setup – a single WalacorService object bootstraps authentication and exposes sub‑clients (auth, schema, data, etc.)
  • Pydantic models everywhere – rich typing, runtime validation and IDE autocompletion.
  • Version‑safe schemas – helper methods to list, inspect and create schema blueprints.
  • Composable requests – thin wrappers over requests that automatically inject Bearer tokens and headers.
  • Python 3.11 + only – enjoy typing generics, | unions, match statements.

📦 Installation

From PyPI (recommended)

pip install walacor-python-sdk

From source (editable)

git clone https://github.com/walacor/python-sdk.git
cd python-sdk
pip install -e .[dev,test]

After installation, import via walacor_sdk (underscore), not the PyPI name with a dash.

from walacor_sdk import WalacorService

🚀 Quick Start

1 – Create a service instance

from walacor_sdk import WalacorService

wal = WalacorService(
    server="http://[walacor.instance.address/api",
    username="Admin",
    password="Password!"
)

Need to change credentials later?

wal.changeCred("new_user", "new_password")

2 – Work with schemas

from walacor_sdk.schema.models import (
    CreateSchemaRequest, CreateSchemaDefinition,
    CreateFieldRequest, CreateIndexRequest
)

schema_req = CreateSchemaRequest(
    ETId=50,    # system envelope for schemas
    SV=1,
    Schema=CreateSchemaDefinition(
        ETId=654321,
        TableName="books",
        Family="library",
        DoSummary=True,
        Fields=[
            CreateFieldRequest(FieldName="book_id", DataType="TEXT", Required=True),
            CreateFieldRequest(FieldName="title",   DataType="TEXT", Required=True)
        ],
        Indexes=[
            CreateIndexRequest(Fields=["book_id"], IndexValue="book_id")
        ]
    )
)

meta = wal.schema.create_schema(schema_req)
print("Created schema envelope:", meta.EId)

Other handy calls:

# list latest versions for every ETId
for s in wal.schema.get_list_with_latest_version():
    print(s.ETId, s.TableName)

# detailed info for a known ETId
info = wal.schema.get_schema_details_with_ETId(654321)
print(info.Fields)

3 – Use enums & constants

from walacor_sdk.utils.enums import SystemEnvelopeType
print(SystemEnvelopeType.SCHEMA.value)   # -> 50

⚙️ Error handling & logging

  • Network errors raise requests.HTTPError so you can retry or surface gracefully.
  • Validation errors are logged with logging.error and result in None/[] returns, never raw dictionaries.
  • The SDK writes to the module‑level walacor_sdk.utils.logger logger; attach your own handler or redirect to file.

🧪 Running tests

pip install .[test]
pytest -q

🤝 Contributing

We love PRs! Please open an issue first for large features. All contributions must:

  • Pass pre-commit hooks (pre-commit run --all-files).
  • Include unit tests with pytest.
  • Follow the existing docstring & typing style.

For full contribution details, see 👉 CONTRIBUTING.md.


📄 License

Apache 2.0 © 2025 Walacor & Contributors.

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

walacor_python_sdk-0.1.4.tar.gz (35.9 kB view details)

Uploaded Source

Built Distribution

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

walacor_python_sdk-0.1.4-py3-none-any.whl (32.4 kB view details)

Uploaded Python 3

File details

Details for the file walacor_python_sdk-0.1.4.tar.gz.

File metadata

  • Download URL: walacor_python_sdk-0.1.4.tar.gz
  • Upload date:
  • Size: 35.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for walacor_python_sdk-0.1.4.tar.gz
Algorithm Hash digest
SHA256 a6346fefda6e24419b8f553e301bac1c25d322d5c5e5d0c6ad0c3531808adf5d
MD5 8688d1b81f23e8f930f777827e2e82fe
BLAKE2b-256 82bbf8fdb321e06796ce4d6aade1a9fe4a1e13337be00886d2f14a3fe5aff366

See more details on using hashes here.

Provenance

The following attestation bundles were made for walacor_python_sdk-0.1.4.tar.gz:

Publisher: release.yaml on walacor/python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file walacor_python_sdk-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for walacor_python_sdk-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 1f37fde22d0f2ddcdd1a4695fc3640e773c7bc82513c0de12bf8d2b0a5149541
MD5 e9aa5a1815ac446371923c09d5326490
BLAKE2b-256 29e9bb704ef38a6e4b55f28ce2ed4aa4bfd6b13f7b3dba4f624f9e9e436a51d4

See more details on using hashes here.

Provenance

The following attestation bundles were made for walacor_python_sdk-0.1.4-py3-none-any.whl:

Publisher: release.yaml on walacor/python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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