# Aptos Python SDK
[![Discord][discord-image]][discord-url]
[![PyPI Package Version][pypi-image-version]][pypi-url]
[![PyPI Package Downloads][pypi-image-downloads]][pypi-url]
This provides basic functionalities to interact with [Aptos](https:/github.com/aptos-labs/aptos-core/). Get started [here](https://aptos.dev/guides/system-integrators-guide/#getting-started).
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](https://python-poetry.org/docs/#installation) for packaging and dependency management:
```
curl -sSL https://install.python-poetry.org | python3 -
poetry install
```
## Unit testing
```bash
make test
```
## E2E testing and Using the Aptos CLI
* Download the [Aptos CLI](https://aptos.dev/tools/aptos-cli/install-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):
```bash
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:
```bash
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:
```bash
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.
### Integration Testing Using the Aptos CLI
```bash
make examples_cli
```
## Autoformatting
```bash
make fmt
```
## Autolinting
```bash
make lint
```
## Package Publishing
* Download the [Aptos CLI](https://aptos.dev/tools/aptos-cli/install-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:
```bash
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](https://semver.org/) as closely as possible
[repo]: https://github.com/aptos-labs/aptos-core
[pypi-image-version]: https://img.shields.io/pypi/v/aptos-sdk.svg
[pypi-image-downloads]: https://img.shields.io/pypi/dm/aptos-sdk.svg
[pypi-url]: https://pypi.org/project/aptos-sdk
[discord-image]: https://img.shields.io/discord/945856774056083548?label=Discord&logo=discord&style=flat~~~~
[discord-url]: https://discord.gg/aptosnetwork
Raw data
{
"_id": null,
"home_page": "https://github.com/aptos-labs/aptos-core/tree/main/ecosystem/python/sdk",
"name": "aptos-sdk",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8.1",
"maintainer_email": null,
"keywords": "web3, sdk, aptos, blockchain",
"author": "Aptos Labs",
"author_email": "opensource@aptoslabs.com",
"download_url": "https://files.pythonhosted.org/packages/13/90/da9a2a56fec19b49cf4a5ebac55e2fa2612414745fd2182a2c7489b3e3ef/aptos_sdk-0.8.6.tar.gz",
"platform": null,
"description": "# Aptos Python SDK\n[![Discord][discord-image]][discord-url]\n[![PyPI Package Version][pypi-image-version]][pypi-url]\n[![PyPI Package Downloads][pypi-image-downloads]][pypi-url]\n\nThis provides basic functionalities to interact with [Aptos](https:/github.com/aptos-labs/aptos-core/). Get started [here](https://aptos.dev/guides/system-integrators-guide/#getting-started).\n\nCurrently, this is still in development and may not be suitable for production purposes.\n\nNote: The sync client is deprecated, please only start new projects using the async client. Feature contributions to the sync client will be rejected.\n\n## Requirements\nThis SDK uses [Poetry](https://python-poetry.org/docs/#installation) for packaging and dependency management:\n\n```\ncurl -sSL https://install.python-poetry.org | python3 -\npoetry install\n```\n\n## Unit testing\n```bash\nmake test\n```\n\n## E2E testing and Using the Aptos CLI\n\n* Download the [Aptos CLI](https://aptos.dev/tools/aptos-cli/install-cli/).\n* Set the environment variable `APTOS_CLI_PATH` to the full path of the CLI.\n* `make examples_cli`\n\nWe of course allow you to do this a bit more manually by:\n\nFirst, run a local testnet (run this from the root of aptos-core):\n\n```bash\ncargo run -p aptos -- node run-local-testnet --force-restart --assume-yes\n```\n\nNext, tell the end-to-end tests to talk to this locally running testnet:\n\n```bash\nexport APTOS_NODE_URL=\"http://127.0.0.1:8080/v1\"\nexport APTOS_FAUCET_URL=\"http://127.0.0.1:8081\"\n```\n\nFinally run the tests:\n\n```bash\nmake examples\n```\n\nNote: 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.\n\n### Integration Testing Using the Aptos CLI\n```bash\nmake examples_cli\n```\n\n## Autoformatting\n```bash\nmake fmt\n```\n\n## Autolinting\n```bash\nmake lint\n```\n\n## Package Publishing\n\n* Download the [Aptos CLI](https://aptos.dev/tools/aptos-cli/install-cli/).\n* Set the environment variable `APTOS_CLI_PATH` to the full path of the CLI.\n* `poetry run python -m aptos_sdk.cli` and set the appropriate command-line parameters\n\n## Generating types\nThe Python `openapi-python-client` tool cannot parse references. Therefore there are three options:\n\n- Use swagger-cli to dereference, gain a type explosion, and still have missing types\n- Live without missing types\n- Write a pure python implementation with no autogenerated code\n\nCurrently the team is moving forward with pure python, but leaves the following notes for the curious:\n\n```bash\nnpm install -g @apidevtools/swagger-cli\nswagger-cli bundle --dereference ../../../api/doc/v0/openapi.yaml -t yaml > openapi.yaml\npython3 -m openapi_python_client generate --path openapi.yaml\nmv aptos-dev-api-specification-client/aptos_dev_api_specification_client/ aptos_sdk/openapi\n```\n\n## Semantic versioning\nThis project follows [semver](https://semver.org/) as closely as possible\n\n[repo]: https://github.com/aptos-labs/aptos-core\n[pypi-image-version]: https://img.shields.io/pypi/v/aptos-sdk.svg\n[pypi-image-downloads]: https://img.shields.io/pypi/dm/aptos-sdk.svg\n[pypi-url]: https://pypi.org/project/aptos-sdk\n[discord-image]: https://img.shields.io/discord/945856774056083548?label=Discord&logo=discord&style=flat~~~~\n[discord-url]: https://discord.gg/aptosnetwork\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Aptos SDK",
"version": "0.8.6",
"project_urls": {
"Homepage": "https://github.com/aptos-labs/aptos-core/tree/main/ecosystem/python/sdk",
"Repository": "https://github.com/aptos-labs/aptos-core"
},
"split_keywords": [
"web3",
" sdk",
" aptos",
" blockchain"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "024416a703538718889c4124b966c9cbba4f2cae1fe9f77edbba3db1d3475f2f",
"md5": "478f7b87343987988dd5753fd36db595",
"sha256": "94818c54ac18b5eb631e744edfb5dcf721b8fdf28aa8b471814bcab3c6f6f7a5"
},
"downloads": -1,
"filename": "aptos_sdk-0.8.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "478f7b87343987988dd5753fd36db595",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8.1",
"size": 50997,
"upload_time": "2024-04-02T07:52:36",
"upload_time_iso_8601": "2024-04-02T07:52:36.801263Z",
"url": "https://files.pythonhosted.org/packages/02/44/16a703538718889c4124b966c9cbba4f2cae1fe9f77edbba3db1d3475f2f/aptos_sdk-0.8.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "1390da9a2a56fec19b49cf4a5ebac55e2fa2612414745fd2182a2c7489b3e3ef",
"md5": "5c5a9cf4b8c47e124c940270cdea8307",
"sha256": "57fe71d966903b096933b905c94f0c835e57ca0781c098e38b637bf861c4470c"
},
"downloads": -1,
"filename": "aptos_sdk-0.8.6.tar.gz",
"has_sig": false,
"md5_digest": "5c5a9cf4b8c47e124c940270cdea8307",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8.1",
"size": 43416,
"upload_time": "2024-04-02T07:52:39",
"upload_time_iso_8601": "2024-04-02T07:52:39.566278Z",
"url": "https://files.pythonhosted.org/packages/13/90/da9a2a56fec19b49cf4a5ebac55e2fa2612414745fd2182a2c7489b3e3ef/aptos_sdk-0.8.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-02 07:52:39",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "aptos-labs",
"github_project": "aptos-core",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "aptos-sdk"
}