Skip to content

Repository files navigation

General Liquidity Python SDK

The Python client for the General Liquidity machine economy API, generated from the general-liquidity-openapi spec.

Install

Once published:

pip install general-liquidity

From source:

git clone https://github.com/general-liquidity/general-liquidity-python
cd general-liquidity-python
pip install -e .

Usage

The surface is split into four API classes, each constructed from a shared ApiClient:

  • MoneyApi: pay
  • CommerceApi: buy, quote
  • IdentityApi: resolve, disclose, verify
  • GovernanceApi: audit
from general_liquidity import ApiClient, Configuration, MoneyApi
from general_liquidity.models.intent import Intent

config = Configuration(host="https://api.general-liquidity.com")

with ApiClient(config) as api_client:
    money = MoneyApi(api_client)

    intent = Intent.from_dict({
        # ... signed Intent fields per the spec ...
    })

    receipt = money.pay(
        idempotency_key="your-client-generated-key",
        intent=intent,
    )
    print(receipt)

pay submits a signed Intent; the sovereign gate evaluates mandate, caps, risk, velocity, and deny-list, then settles on the routed rail and returns a Receipt. The caller never holds a settle primitive. The idempotency_key is required on mutating operations (pay, buy) as a correctness guarantee against double-spend.

Model names (Intent, Receipt, Mandate, Order, QuoteRequest, Counterparty, ...) live under general_liquidity.models. See the generated docs/ directory for the full method and model reference.

Signing

This generated client covers transport and models only. Intent envelope signing is client-side and is not included here. You are responsible for constructing and signing the Intent before passing it to pay or buy. Only the hand-written TypeScript SDK carries the built-in operator signer today.

Layout

The package uses the Python src-layout: the importable package lives at src/general_liquidity/, and the import name stays general_liquidity. pip install -e . picks it up via package_dir={"": "src"} in setup.py.

Generation

This SDK is generated from the general-liquidity-openapi spec with openapi-generator (python generator) and is regenerated whenever the spec changes. Do not hand-edit the generated modules; change the spec and regenerate.

openapi-generator emits the package at the repo root as general_liquidity/. After regenerating, move it under src/ so the src-layout is preserved:

git mv general_liquidity src/general_liquidity

(This mirrors the Go SDK, which relocates its generated sources into client/ after each run.)

About

The General Liquidity Python SDK, generated from the machine economy API spec.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages