Skip to main content

Aptos Python SDK

Discord PyPI Package Version PyPI Package Downloads

This provides basic functionalities to interact with Aptos. Get started here.

Currently this is still in development and may not be suitable for production purposes.

Note: The sync client is deprecated, please only start new projects using the async client. Feature contributions to the sync client will be rejected.

Requirements

This SDK uses Poetry for packaging and dependency management:

curl -sSL https://install.python-poetry.org | python3 -
poetry install

Unit testing

make test

E2E testing

First, run a local testnet (run this from the root of aptos-core):

cargo run -p aptos -- node run-local-testnet --with-faucet --faucet-port 8081 --force-restart --assume-yes

Next, tell the end-to-end tests to talk to this locally running testnet:

export APTOS_NODE_URL="http://127.0.0.1:8080/v1"
export APTOS_FAUCET_URL="http://127.0.0.1:8081"

Finally run the tests:

make examples

Note: These end-to-end tests are tested against a node built from the same commit as part of CI, not devnet. For examples tested against devnet, see developer-docs-site/static/examples/python/ from the root of the repo.

Autoformatting

make fmt

Generating types

The Python openapi-python-client tool cannot parse references. Therefore there are three options:

  • Use swagger-cli to dereference, gain a type explosion, and still have missing types
  • Live without missing types
  • Write a pure python implementation with no autogenerated code

Currently the team is moving forward with pure python, but leaves the following notes for the curious:

npm install  -g @apidevtools/swagger-cli
swagger-cli bundle --dereference ../../../api/doc/v0/openapi.yaml  -t yaml > openapi.yaml
python3 -m openapi_python_client generate --path openapi.yaml
mv aptos-dev-api-specification-client/aptos_dev_api_specification_client/ aptos_sdk/openapi

Semantic versioning

This project follows semver as closely as possible

Metadata

Release files for aptos-sdk-zzf 0.7.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 aptos-sdk-zzf 0.7.0
File Size Uploaded
aptos_sdk_zzf-0.7.0.tar.gz 30.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aptos-sdk-zzf 0.7.0
File Interpreter ABI Platform
aptos_sdk_zzf-0.7.0-py3-none-any.whl Python 3 none any Details

Total release size: 65.3 kB

Release files / aptos_sdk_zzf-0.7.0.tar.gz

Download URL aptos_sdk_zzf-0.7.0.tar.gz
Size 30.3 kB
Tags Source
SHA-256 checksum
How to use checksums
ae52399cf5c779af294436d651a3395d1ce63452a84ae3184c4158516bc1cd24
BLAKE2b-256 checksum
How to use checksums
322b114d6ce3056f1f587efbf0f39fc32d00ac6a43bd7255119186de89828c11
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.11.4 Darwin/23.0.0

Release files / aptos_sdk_zzf-0.7.0-py3-none-any.whl

Download URL aptos_sdk_zzf-0.7.0-py3-none-any.whl
Size 35.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
031dd11355c4eb672aef6cee57921e150c4e29aa8b0b78b08323064f58855bb6
BLAKE2b-256 checksum
How to use checksums
6fc38bd8118a28a698ff717cb6d615d0ed82c7c2404104b17f1b3da707ddce9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.11.4 Darwin/23.0.0

Release history Release notifications | RSS feed

This release

0.7.0 This release

2 release files

0.1.1

2 release files

0.1.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