Skip to main content

Aptos SDK

Project description

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 and Using the Aptos CLI

  • Download the Aptos CLI.
  • Set the environment variable APTOS_CLI_PATH to the full path of the CLI.
  • make examples_cli

We of course allow you to do this a bit more manually by:

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

cargo run -p aptos -- node run-local-testnet --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

Package Publishing

  • Download the Aptos CLI.
  • Set the environment variable APTOS_CLI_PATH to the full path of the CLI.
  • poetry run python -m aptos_sdk.cli and set the appropriate command-line parameters

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

Project details


Download files

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

Source Distribution

aptos_sdk_fork-0.7.1a2.tar.gz (43.8 kB view details)

Uploaded Source

Built Distribution

aptos_sdk_fork-0.7.1a2-py3-none-any.whl (52.3 kB view details)

Uploaded Python 3

File details

Details for the file aptos_sdk_fork-0.7.1a2.tar.gz.

File metadata

  • Download URL: aptos_sdk_fork-0.7.1a2.tar.gz
  • Upload date:
  • Size: 43.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.0 CPython/3.11.6 Darwin/22.6.0

File hashes

Hashes for aptos_sdk_fork-0.7.1a2.tar.gz
Algorithm Hash digest
SHA256 6f7cc3ebe8695d036b0a6502e4d09c3585c78c3cd8fddee0b7e4e70901c60986
MD5 d3eee656aee01fee12d0830fbc8f0a9d
BLAKE2b-256 7532be8719fbda687b805a8b4fea320b058f567bf09747f99b6dacd643bc8bc8

See more details on using hashes here.

File details

Details for the file aptos_sdk_fork-0.7.1a2-py3-none-any.whl.

File metadata

File hashes

Hashes for aptos_sdk_fork-0.7.1a2-py3-none-any.whl
Algorithm Hash digest
SHA256 d0e7a79d8ba77fc53543aa0aa88a860ced52a0ee8511a8f821486bf4b2b9dbb7
MD5 6b7ddf782150318d3602fd3ae370d107
BLAKE2b-256 efa85b0ede1685e953c6d558b433eb37575dcf08d33a17e1ccf22dbb7725e4dc

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page