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

We use cucumber testing for all of our SDKs, including this one. Please refer to algorand-sdk-testing for guidance and existing tests that you may need to update. Depending on the type of update you wish to contribute, you may also need to have corresponding updates in the other SDKs (Go, JS, and Java). Feel welcome to ask for collaboration on that front.

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.

Release files for py-algorand-sdk 2.12.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.12.0
File Size Uploaded
py_algorand_sdk-2.12.0.tar.gz 91.9 kB Details

Built distribution (wheel)

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

Total release size:206.3 kB

Release files / py_algorand_sdk-2.12.0.tar.gz

Download URL py_algorand_sdk-2.12.0.tar.gz
Size 91.9 kB
Tags Source
SHA-256 checksum
How to use checksums
0726a714879d8962aeb72379321b236bb7991b7e8c931ae35ba75c8977f52fae
BLAKE2b-256 checksum
How to use checksums
90fe2a1e864809321d467a0e26fbcbc4498ec153b64df53e2bcd3a6062706af0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.21

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

Download URL py_algorand_sdk-2.12.0-py3-none-any.whl
Size 114.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d7a627e79060912a619418582d9fce838a0f0acc3c58a21d46b2fca458522211
BLAKE2b-256 checksum
How to use checksums
d7b9f5256cc2aab463481bb08352aa8db4c95cbe53021e03c7ba7e924473f0e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.21

Release history Release notifications | RSS feed

This release

2.12.0 This release

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

2.1.0

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