{"id":13511194,"url":"https://github.com/michaelhly/solana-py","last_synced_at":"2025-04-23T21:02:04.269Z","repository":{"id":37042568,"uuid":"288933881","full_name":"michaelhly/solana-py","owner":"michaelhly","description":"Solana Python SDK","archived":false,"fork":false,"pushed_at":"2025-04-18T13:49:27.000Z","size":2679,"stargazers_count":1314,"open_issues_count":48,"forks_count":317,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-04-19T02:44:27.582Z","etag":null,"topics":["blockchain","python","sdk","solana"],"latest_commit_sha":null,"homepage":"https://michaelhly.github.io/solana-py","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/michaelhly.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-08-20T07:12:23.000Z","updated_at":"2025-04-18T13:48:53.000Z","dependencies_parsed_at":"2024-01-12T19:47:13.342Z","dependency_job_id":"70cb996d-baa8-4506-8071-de664f3cbf64","html_url":"https://github.com/michaelhly/solana-py","commit_stats":{"total_commits":805,"total_committers":53,"mean_commits":15.18867924528302,"dds":"0.49689440993788825","last_synced_commit":"bba64d41086816dea25133f8925d4a747650fe1f"},"previous_names":["michaelhly/solanapy"],"tags_count":62,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelhly%2Fsolana-py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelhly%2Fsolana-py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelhly%2Fsolana-py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelhly%2Fsolana-py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michaelhly","download_url":"https://codeload.github.com/michaelhly/solana-py/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250514767,"owners_count":21443208,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blockchain","python","sdk","solana"],"created_at":"2024-08-01T03:00:37.534Z","updated_at":"2025-04-23T21:02:04.001Z","avatar_url":"https://github.com/michaelhly.png","language":"Python","funding_links":[],"categories":["List of Web3 Libraries","Blockchain","Python","Development Tools and Libraries","SDKs"],"sub_categories":["Solana","Client Libraries","Indexers"],"readme":"\u003cdiv align=\"center\"\u003e\n    \u003cimg src=\"https://raw.githubusercontent.com/michaelhly/solana-py/master/docs/img/solana-py-logo.jpeg\" width=\"25%\" height=\"25%\"\u003e\n\u003c/div\u003e\n\n---\n\n[![Actions\nStatus](https://github.com/michaelhly/solanapy/workflows/CI/badge.svg)](https://github.com/michaelhly/solanapy/actions?query=workflow%3ACI)\n[![PyPI version](https://badge.fury.io/py/solana.svg)](https://badge.fury.io/py/solana)\n[![Python versions](https://img.shields.io/pypi/pyversions/solana.svg)]( https://pypi.python.org/pypi/solana)\n[![Codecov](https://codecov.io/gh/michaelhly/solana-py/branch/master/graph/badge.svg)](https://codecov.io/gh/michaelhly/solana-py/branch/master)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/michaelhly/solana-py/blob/master/LICENSE)\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/solana)](https://pypistats.org/packages/solana)\n\n# Solana.py\n\n**🐍 The Solana Python SDK 🐍**\n\nSolana.py is the base Python library for interacting with Solana.\nYou can use it to build transactions and interact\nwith the\n[Solana JSON RPC API](https://docs.solana.com/apps/jsonrpc-api),\nmuch like you would do with\n[solana-web3.js](https://github.com/solana-labs/solana-web3.js/)\n\nIt also covers the\n[SPL Token Program](https://spl.solana.com/token).\n\n[Latest Documentation](https://michaelhly.github.io/solana-py/).\n\nNote: This library uses many core types from the [Solders](https://github.com/kevinheavey/solders) package which used to be provided by `solana-py` itself. If you are upgrading from an old version and you're looking for something that was deleted, it's probably in `solders` now.\n\n**⚓︎ See also: [AnchorPy](https://github.com/kevinheavey/anchorpy),**\n**a Python client for**\n**[Anchor](https://project-serum.github.io/anchor/getting-started/introduction.html)-based**\n**programs on Solana. ⚓︎**\n\n## ⚡ Quickstart\n\n### Installation\n1. Install [Python bindings](https://kevinheavey.github.io/solders/) for the [solana-sdk](https://docs.rs/solana-sdk/latest/solana_sdk/).\n```sh\npip install solders\n```\n\n2. Install this package to interact with the [Solana JSON RPC API](https://solana.com/docs/rpc).\n```sh\npip install solana\n```\n\n### General Usage\n\nNote: check out the\n[Solana Cookbook](https://solanacookbook.com/)\nfor more detailed examples!\n\n```py\nimport solana\n```\n\n### API Client\n\n```py\nfrom solana.rpc.api import Client\n\nhttp_client = Client(\"https://api.devnet.solana.com\")\n```\n\n### Async API Client\n\n```py\nimport asyncio\nfrom solana.rpc.async_api import AsyncClient\n\nasync def main():\n    async with AsyncClient(\"https://api.devnet.solana.com\") as client:\n        res = await client.is_connected()\n    print(res)  # True\n\n    # Alternatively, close the client explicitly instead of using a context manager:\n    client = AsyncClient(\"https://api.devnet.solana.com\")\n    res = await client.is_connected()\n    print(res)  # True\n    await client.close()\n\nasyncio.run(main())\n```\n\n### Websockets Client\n\n```py\nimport asyncio\nfrom asyncstdlib import enumerate\nfrom solana.rpc.websocket_api import connect\n\nasync def main():\n    async with connect(\"wss://api.devnet.solana.com\") as websocket:\n        await websocket.logs_subscribe()\n        first_resp = await websocket.recv()\n        subscription_id = first_resp[0].result\n        next_resp = await websocket.recv()\n        print(next_resp)\n        await websocket.logs_unsubscribe(subscription_id)\n\n    # Alternatively, use the client as an infinite asynchronous iterator:\n    async with connect(\"wss://api.devnet.solana.com\") as websocket:\n        await websocket.logs_subscribe()\n        first_resp = await websocket.recv()\n        subscription_id = first_resp[0].result\n        async for idx, msg in enumerate(websocket):\n            if idx == 3:\n                break\n            print(msg)\n        await websocket.logs_unsubscribe(subscription_id)\n\nasyncio.run(main())\n```\n\n## 🔨 Development\n\n### Setup\n\n1. Install [poetry](https://python-poetry.org/docs/#installation)\n2. Install dev dependencies:\n\n```sh\npoetry install\n\n```\n\n3. Activate the poetry shell.\n\n```sh\npoetry shell\n```\n\n### Lint\n\n```sh\nmake lint\n```\n\n### Tests\n\n```sh\n# All tests\nmake tests\n# Unit tests only\nmake unit-tests\n# Integration tests only\nmake int-tests\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaelhly%2Fsolana-py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichaelhly%2Fsolana-py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaelhly%2Fsolana-py/lists"}