Skip to main content

echomirror-sdk (Python)

Official Python SDK for EchoMirror — mood tracking with Stellar-powered rewards.

Native bindings (PyO3 + maturin) over the same Rust core that powers the JS and Flutter SDKs — every call is real native code and returns a proper asyncio coroutine, so nothing blocks the event loop.

Install

python -m venv .venv
source .venv/bin/activate  # Windows PowerShell: .venv\Scripts\Activate.ps1
pip install echomirror-sdk

The package targets Python 3.9–3.12. If a wheel for your platform is not yet available, build the checkout with maturin:

git clone https://github.com/Echo-Mirror-Butler/echomirror-sdk.git
cd echomirror-sdk/crates/echomirror-python
pip install maturin
maturin develop --release

Quickstart

Set the API key issued by your EchoMirror deployment, then create one client for mood, Stellar, and social operations:

export ECHOMIRROR_API_KEY="your_api_key"
# Windows PowerShell: $env:ECHOMIRROR_API_KEY = "your_api_key"
import asyncio
import os

from echomirror import EchoMirror, StellarNetwork

async def main():
    app = EchoMirror(
        api_key=os.environ["ECHOMIRROR_API_KEY"],
        network=StellarNetwork.Testnet,
    )

    entry = await app.mood.log(score=8, note="Great day", tags=["work", "proud"])
    print(f"Logged mood {entry.score}/10")

    balance = await app.stellar.get_balance(os.environ["STELLAR_PUBLIC_KEY"])
    print(f"{balance.xlm} XLM • {balance.echo} ECHO")

    payment = await app.stellar.build_transfer(
        from_address=os.environ["STELLAR_PUBLIC_KEY"],
        to_address=os.environ["STELLAR_DESTINATION"],
        amount=5.0,
        memo="Great energy today",
    )
    print(f"Unsigned payment XDR ({payment.fee} stroops): {payment.xdr}")

    feed = await app.social.get_global_feed(limit=10)
    print(f"{len(feed)} entries in the global feed")

asyncio.run(main())

build_transfer deliberately returns an unsigned XDR. Sign it with the account owner's wallet or signer before calling submit_transaction; never put a secret key in source code or environment variables used by this example.

For a complete script that also demonstrates authentication, a fixture-backed payment submission, and typed error handling, see examples/quickstart.py.

Run the complete example safely

The repository's contract-test fixture is deterministic and never broadcasts a Stellar transaction. From the repository root, start both fixture roles and run the example with one command:

python crates/echomirror-python/examples/quickstart.py --start-fixture

The example defaults to the fixture URLs and keys from contract-tests/contract-spec.json. Without --start-fixture, override its ECHOMIRROR_* and STELLAR_* environment variables to point at an already running fixture or another test deployment.

Sub-clients

Each sub-client also works standalone against a shared EchoMirrorClient — handy if you only need one slice of the API:

from echomirror import EchoMirrorClient, MoodClient, StellarClient, SocialClient, StellarNetwork

client = EchoMirrorClient("your_api_key", network=StellarNetwork.Mainnet)
mood = MoodClient(client)
stellar = StellarClient(client)
social = SocialClient(client)

Error handling

All errors inherit from EchoMirrorException:

from echomirror import AuthError, RateLimitError, NotFoundError, EchoMirrorException

try:
    await app.mood.get_streak()
except AuthError:
    ...  # invalid or expired API key
except RateLimitError:
    ...  # back off and retry
except NotFoundError:
    ...
except EchoMirrorException as e:
    ...  # anything else

HTTP 401, 404, and 429 responses map to AuthError, NotFoundError, and RateLimitError; transport and server failures remain catchable through EchoMirrorException.

Type checking

The package ships py.typed and type stubs. Editors using Pyright and projects running mypy can catch mistakes before execution—for example, await app.mood.log(score="8") is rejected because score must be an int.

Testnet

app = EchoMirror(api_key="your_api_key", network=StellarNetwork.Testnet)
await app.stellar.fund_testnet_account("GPUBLIC_KEY")  # Friendbot: 10,000 XLM

Development

pip install maturin pytest pytest-asyncio
maturin develop --release
pytest

License

MIT

Download files

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

Source Distribution

echomirror_sdk-0.1.0.tar.gz (70.3 kB view details)

Uploaded Source

Built Distributions

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

echomirror_sdk-0.1.0-cp313-cp313-macosx_10_12_x86_64.whl (2.5 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

echomirror_sdk-0.1.0-cp312-cp312-win_amd64.whl (2.4 MB view details)

Uploaded CPython 3.12Windows x86-64

echomirror_sdk-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.7 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

echomirror_sdk-0.1.0-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (4.8 MB view details)

Uploaded CPython 3.12macOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

echomirror_sdk-0.1.0-cp311-cp311-win_amd64.whl (2.4 MB view details)

Uploaded CPython 3.11Windows x86-64

echomirror_sdk-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.7 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

echomirror_sdk-0.1.0-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (4.8 MB view details)

Uploaded CPython 3.11macOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

echomirror_sdk-0.1.0-cp310-cp310-win_amd64.whl (2.4 MB view details)

Uploaded CPython 3.10Windows x86-64

echomirror_sdk-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.7 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

echomirror_sdk-0.1.0-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (4.8 MB view details)

Uploaded CPython 3.10macOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

echomirror_sdk-0.1.0-cp39-cp39-win_amd64.whl (2.4 MB view details)

Uploaded CPython 3.9Windows x86-64

echomirror_sdk-0.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.7 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

echomirror_sdk-0.1.0-cp39-cp39-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (4.8 MB view details)

Uploaded CPython 3.9macOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: echomirror_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 70.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.1

File hashes

Hashes for echomirror_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c35139602a82a080861e5aba0cabb84200391c808fa80b8f56cf028c1a834c68
MD5 cc05b9078d4167245f50607919e4be29
BLAKE2b-256 44c39ad828afb68ed54d3b076707a3341d27fd30f1f6d8245c9bd725be5b6be3

See more details on using hashes here.

File details

Details for the file echomirror_sdk-0.1.0-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for echomirror_sdk-0.1.0-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 2efe5d365f24d54e2d9b6d54d5cc80acf859bb764a9b4711d49666bb26f1cd62
MD5 afe2518a8e6e6c5c5f9c339d04a356e9
BLAKE2b-256 99c32432e89ea8e0acc135b47777b245574dadb5f709e57e9008e706a708383b

See more details on using hashes here.

File details

Details for the file echomirror_sdk-0.1.0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for echomirror_sdk-0.1.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 321d241f113408ae24233c39addfa8c47068f872aaa59547cfb6c6a60ad4ddae
MD5 0cb507daac62d08f55c523831414b3ca
BLAKE2b-256 796f962da31116da319f7c5b7faf7fd499782ca01a7ee69c5ca4242018db0d4c

See more details on using hashes here.

File details

Details for the file echomirror_sdk-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for echomirror_sdk-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0f441ac096e85b99ecddaf38ce7539f4643fc6f929d089fe33fc40e11274b8f5
MD5 511116929b0558d4d3ed930706140847
BLAKE2b-256 dd93cb9b9e00f1030680551a5363c7c88956ef5c9468d4647bf41ecedb6bd1b8

See more details on using hashes here.

File details

Details for the file echomirror_sdk-0.1.0-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for echomirror_sdk-0.1.0-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 b6dd93d1f766251834e16df304a60110e174f107b0c6acdfd368f61787c0cc4a
MD5 1ce41bb66bbb9345d47d7972136ae785
BLAKE2b-256 5f04c460280fad3e005e6e0644a813deb01dcd7203b4a55b1babb15271916b63

See more details on using hashes here.

File details

Details for the file echomirror_sdk-0.1.0-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for echomirror_sdk-0.1.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 be4402a7a55bd1d67e7bc7b4418b5888f559461536a0d88c1a868f1e4bd92889
MD5 861cf5fe859a89fb93f9d88420968992
BLAKE2b-256 66ffd02c2150388fa2d780d0f90d1f03a298e8abe3fc3955758ffb4321d67b94

See more details on using hashes here.

File details

Details for the file echomirror_sdk-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for echomirror_sdk-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8cb7ee6036efd6bb874b08b81ce2ff55392d36b317eda0cca1ca855dc1da9a8c
MD5 25fb31fea820a331fa1ac7b2f9d8cff7
BLAKE2b-256 ff603bf1d7e3287fb49c0718695bee303202b0ee178974f77661b76894496ad9

See more details on using hashes here.

File details

Details for the file echomirror_sdk-0.1.0-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for echomirror_sdk-0.1.0-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 d6de00e9aaaa160f2463d762d57bd8e25ffa2aec6b9130cf39e887c3f6699bf1
MD5 1534dbfb145dee0e6240eadd19a09cf8
BLAKE2b-256 1c3c63e61c9fb50f47a4b1cafa6e92d0cc172e39f0ba797a3fae2831880d4e6e

See more details on using hashes here.

File details

Details for the file echomirror_sdk-0.1.0-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for echomirror_sdk-0.1.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 cf25a766432e91b637fae5215c089360f9052e2176521b19e57a314bb54f3c77
MD5 b2c4ce776deb9969fe0fdec539520c89
BLAKE2b-256 9dac7473067b691f1016bcda929a36f4e9ff7a37681a7f2e5f9772c059c04789

See more details on using hashes here.

File details

Details for the file echomirror_sdk-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for echomirror_sdk-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7c26bf9043913250f29b7772e1e1c5aedbac154201a3aefe0c1cddb2c7079a57
MD5 d3e16050fb4130ac0c4c143096b98d22
BLAKE2b-256 72b9877f017e28deb9162dcada73697a99b87ee64fff8a1d0dea434aeeecb2c7

See more details on using hashes here.

File details

Details for the file echomirror_sdk-0.1.0-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for echomirror_sdk-0.1.0-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 ed30a2370868fbbbdc2237e894508e4c251751bb735c0710e27630e3010baf59
MD5 ea47e4455f81acf9f1a132508128b548
BLAKE2b-256 4749e2d96f3f1fc3d493091724382d07434323d9f9164ddd05db0a53f74e302a

See more details on using hashes here.

File details

Details for the file echomirror_sdk-0.1.0-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for echomirror_sdk-0.1.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 56a21c0c1689f5aa3c288754cae6bd22a4f63d6f23dcf10bde58a2811ae2226b
MD5 ea68e27e9365fcc7ae422885dc021c2f
BLAKE2b-256 13c5c15501aabbe0453b07056cc2fd34bd7741decba17f01eec963681cb8e83a

See more details on using hashes here.

File details

Details for the file echomirror_sdk-0.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for echomirror_sdk-0.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e6df7d43809e7208e382dcf2dbca0d3fe708bdc2e767f0dd7e80443eaf4c717f
MD5 01d53b40f9f293cda3e1c6adda79167c
BLAKE2b-256 e77c3451b8cf28c86bb9f75b4940acf2913d469da611ed88a105a837e815e193

See more details on using hashes here.

File details

Details for the file echomirror_sdk-0.1.0-cp39-cp39-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for echomirror_sdk-0.1.0-cp39-cp39-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 7b56ad089a66dbb963c6ab692a1187f068f4d65b0e38870dc3d74e0084d4287b
MD5 fe7f85d3cb4665fccc59b8163aad4bda
BLAKE2b-256 a063fd9b950deabe881ea707b44b0e4df6cb907657b4efc0741a3124ddcb5218

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

14 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