Skip to main content

Utilities for Algorand development for use by AlgoKit

Project description

AlgoKit Python Utilities

A set of core Algorand utilities written in Python and released via PyPi that make it easier to build solutions on Algorand. This project is part of AlgoKit.

The goal of this library is to provide intuitive, productive utility functions that make it easier, quicker and safer to build applications on Algorand. Largely these functions wrap the underlying Algorand SDK, but provide a higher level interface with sensible defaults and capabilities for common tasks.

Note If you prefer TypeScript there's an equivalent TypeScript utility library.

Install | Documentation

Install

This library can be installed using pip, e.g.:

pip install algokit-utils

Validation Schemas

This repository includes Pydantic validation schemas for development-time validation of API client responses. These are test fixtures, not shipped as part of the published package.

from tests.fixtures.schemas.algod import AccountSchema, NodeStatusResponseSchema

# Validate API responses
response = algod_client.status()
validated = NodeStatusResponseSchema.model_validate(response)
print(f"Last round: {validated.last_round}")

Features:

  • Type validation (str, int, bool, etc.)
  • Uint64 bounds checking (0 to 2^64-1)
  • Nested schema support
  • 208 schemas across algod, kmd, and indexer clients

For developers - regenerate schemas:

poe generate-schemas

See VALIDATION.md for details.

Migration from v2.x to v3.x

Refer to the v3 migration guide for more information on how to migrate to latest version of algokit-utils-py.

Guiding principles

This library follows the Guiding Principles of AlgoKit.

Contributing

This is an open source project managed by the Algorand Foundation. See the AlgoKit contributing page to learn about making improvements.

To successfully run the tests in this repository you need to be running LocalNet via AlgoKit:

algokit localnet start

Mock Server Tests

Tests under tests/modules/ use a mock server for deterministic API testing against pre-recorded HAR files. The mock server is managed externally (not by pytest).

In CI: Mock servers are automatically started via the algokit-polytest GitHub Action.

Local development:

  1. Clone algokit-polytest and start the mock servers:
# Clone algokit-polytest (if not already)
git clone https://github.com/algorandfoundation/algokit-polytest.git

# Start all mock servers (recommended)
cd algokit-polytest/resources/mock-server
./scripts/start_all_servers.sh

This starts algod (port 8000), kmd (port 8001), and indexer (port 8002) in the background.

  1. Set environment variables and run tests:
export MOCK_ALGOD_URL=http://localhost:8000
export MOCK_INDEXER_URL=http://localhost:8002
export MOCK_KMD_URL=http://localhost:8001

# Run all module tests
pytest tests/modules/

# Or run specific client tests
pytest tests/modules/algod_client/
  1. Stop servers when done:
cd algokit-polytest/resources/mock-server
./scripts/stop_all_servers.sh
Environment Variable Description Default Port
MOCK_ALGOD_URL Algod mock server URL 8000
MOCK_INDEXER_URL Indexer mock server URL 8002
MOCK_KMD_URL KMD mock server URL 8001

Environment variables can also be set via .env file in project root (copy from .env.template).

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

algokit_utils-5.0.0b1.tar.gz (222.4 kB view details)

Uploaded Source

Built Distribution

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

algokit_utils-5.0.0b1-py3-none-any.whl (344.1 kB view details)

Uploaded Python 3

File details

Details for the file algokit_utils-5.0.0b1.tar.gz.

File metadata

  • Download URL: algokit_utils-5.0.0b1.tar.gz
  • Upload date:
  • Size: 222.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for algokit_utils-5.0.0b1.tar.gz
Algorithm Hash digest
SHA256 4ac5d99b4c354aef01347a0392b441f363c888505cf9ee62dc7af781e9730417
MD5 2bde8cfab3bd1c46dc1dcc4f01ae420b
BLAKE2b-256 118f9749eadee85a9e0205d4e6458fcddd38af74dce51a17a8231857fcbf7148

See more details on using hashes here.

Provenance

The following attestation bundles were made for algokit_utils-5.0.0b1.tar.gz:

Publisher: cd.yaml on algorandfoundation/algokit-utils-py

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

File details

Details for the file algokit_utils-5.0.0b1-py3-none-any.whl.

File metadata

  • Download URL: algokit_utils-5.0.0b1-py3-none-any.whl
  • Upload date:
  • Size: 344.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for algokit_utils-5.0.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 9aca756c058606fe5d25eba19d0e350e96085e4aecc58a615a9ea16e3143e86c
MD5 819b003d19df537a876cb4cd5bb8fc0d
BLAKE2b-256 f77a8ca0d1d737f148b9cd83057ab7efd202364481df84a2a54297cdc56ac703

See more details on using hashes here.

Provenance

The following attestation bundles were made for algokit_utils-5.0.0b1-py3-none-any.whl:

Publisher: cd.yaml on algorandfoundation/algokit-utils-py

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