Skip to main content

py-algorand-sdk

PyPI version Documentation Status Code style: black

A python library for interacting with the Algorand network.

Installation

Run $ pip3 install py-algorand-sdk to install the package.

Alternatively, choose a distribution file, and run $ pip3 install [file name].

Supported Python versions

py-algorand-sdk's minimum Python version policy attempts to balance several constraints.

  • Make it easy for the community to use py-algorand-sdk by minimizing or excluding the need to customize Python installations.
  • Provide maintainers with access to newer language features that produce more robust software.

Given these constraints, the minimum Python version policy is: Target Python version on newest Ubuntu LTS released >= 6 months ago.

The rationale is:

  • If a major Linux OS distribution bumps a Python version, then it's sufficiently available to the community for us to upgrade.
  • The 6 month time buffer ensures we delay upgrades until the community starts using a recently released LTS version.

SDK Development

Install dependencies

  • pip3 install -r requirements.txt

Run tests

  • make docker-test

Set up the Algorand Sandbox based test-harness without running the tests

  • make harness

Format code

  • black .

Update algosdk/__init__.pyi which allows downstream developers importing algosdk and using VSCode's PyLance to have improved type analysis

  • make generate-init

Lint types

  • make mypy (or mypy algosdk)

Check all lints required by the C.I. process

  • make lint

Run non-test-harness related unit tests

  • make pytest-unit

Quick start

Here's a simple example you can run without a node.

from algosdk import account, encoding

# generate an account
private_key, address = account.generate_account()
print("Private key:", private_key)
print("Address:", address)

# check if the address is valid
if encoding.is_valid_address(address):
    print("The address is valid!")
else:
    print("The address is invalid.")

Node setup

Follow the instructions in Algorand's developer resources to install a node on your computer. You can also set up a local Algorand Sandbox with make harness.

Running examples/example.py

Before running example.py, start kmd on a private network or testnet node:

./goal kmd start -d [data directory]

Next, create a wallet and an account:

./goal wallet new [wallet name] -d [data directory]
./goal account new -d [data directory] -w [wallet name]

Visit the Algorand dispenser and enter the account address to fund your account.

Next, in tokens.py, either update the tokens and addresses, or provide a path to the data directory. Alternatively, tokens.py also defaults to the sandbox harness configurations for algod and kmd, which can be brought up by running make harness.

You're now ready to run example.py!

Documentation

Documentation for the Python SDK is available at py-algorand-sdk.readthedocs.io.

License

py-algorand-sdk is licensed under an MIT license. See the LICENSE file for details.

Metadata

Release files for py-algorand-sdk 2.1.0

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

Source distribution (sdist)

Source distribution for py-algorand-sdk 2.1.0
File Size Uploaded
py-algorand-sdk-2.1.0.tar.gz 148.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for py-algorand-sdk 2.1.0
File Interpreter ABI Platform
py_algorand_sdk-2.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 388.4 kB

Release files / py-algorand-sdk-2.1.0.tar.gz

Download URL py-algorand-sdk-2.1.0.tar.gz
Size 148.1 kB
Tags Source
SHA-256 checksum
How to use checksums
e56d8e55de7d5eaf219ababb389c521464a82fb541d8fda21922b5898ee6d2df
BLAKE2b-256 checksum
How to use checksums
ef9695988a1cc21ce817d450a4cb616edfaaeeefa573578a865b94b687072d7d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Release files / py_algorand_sdk-2.1.0-py3-none-any.whl

Download URL py_algorand_sdk-2.1.0-py3-none-any.whl
Size 240.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6538c9c2727e46e5740af6a5b76fec516438f28e7f594c0daf4ac4f5ec1af1ac
BLAKE2b-256 checksum
How to use checksums
f36845a3db6f4110781cbca72f6940ca76a8b2e7137419e9e046ec1b1308f909
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Release history Release notifications | RSS feed

2.12.0

2 release files

2.11.0

2 release files

2.9.1

2 release files

2.9.0

2 release files

2.8.0

2 release files

2.7.0

2 release files

2.6.1

2 release files

2.6.0

2 release files

2.5.0

2 release files

2.4.0

2 release files

2.3.0

2 release files

2.2.0

2 release files

2.1.2

2 release files

2.1.1

2 release files

This release

2.1.0 This release

2 release files

2.0.0

2 release files

1.20.1

2 release files

1.19.0

2 release files

1.18.0

2 release files

1.16.1

2 release files

1.16.0

2 release files

1.15.0

2 release files

1.12.0

2 release files

1.11.0

2 release files

1.9.0

2 release files

1.8.0

2 release files

1.7.0

2 release files

1.6.0

2 release files

1.5.0

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.0

2 release 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