Sol.College

Full lesson

solana-py

Solana Python SDK

What it does

From the project README:

[](https://github.com/michaelhly/solana-py/actions?query=workflow%3ACI) [](https://badge.fury.io/py/solana) [](https://pypi.python.org/pypi/solana) [](https://codecov.io/gh/michaelhly/solana-py/branch/master) [](https://github.com/michaelhly/solana-py/blob/master/LICENSE) [](https://clickpy.clickhouse.com/dashboard/solana)
Original
michaelhly/solana-py
SuperStack fork
Blockchains/solana-py @ 6ba0a56
Stars
1,443
Last push (original)
2026-11-01
Languages
Python, Shell, Makefile
Detected stack
solana-py
Categories
Infrastructure & Tooling
Licence
MIT
Homepage
https://michaelhly.github.io/solana-py

Architecture

50 source files. By extension: .py ×50.

Top-level directorySource files
src31
tests19

Dapp: deploying

This fork is queued for its own live dapp on Sol.College, with a Devnet/Mainnet switch. It appears here, at /dapps/solana-py/, once it is deployed and checked on devnet. Until then, run it locally with the commands below.

Key code, explained

Excerpts chosen automatically where the code uses the most Solana concepts, pinned to the fork's commit.

michaelhly/solana-py · src/spl/token/instructions.py L1381–1402 @ 6ba0a56 · MIT · original
def get_associated_token_address(owner: Pubkey, mint: Pubkey, token_program_id: Pubkey = TOKEN_PROGRAM_ID) -> Pubkey:    """Derives the associated token address for the given wallet address and token mint.     Args:        owner (Pubkey): Owner's wallet address.        mint (Pubkey): The token mint address.        token_program_id (Pubkey, optional): The token program ID. Must be either `spl.token.constants.TOKEN_PROGRAM_ID`            or `spl.token.constants.TOKEN_2022_PROGRAM_ID` (default is `TOKEN_PROGRAM_ID`).     Returns:        The public key of the derived associated token address.     Raises:        ValueError: If an invalid `token_program_id` is provided.    """    if token_program_id not in [TOKEN_PROGRAM_ID, TOKEN_2022_PROGRAM_ID]:        raise ValueError("token_program_id must be one of TOKEN_PROGRAM_ID or TOKEN_2022_PROGRAM_ID.")    key, _ = Pubkey.find_program_address(        seeds=[bytes(owner), bytes(token_program_id), bytes(mint)],        program_id=ASSOCIATED_TOKEN_PROGRAM_ID,    )    return key
  1. Line 1388 or `spl.token.constants.TOKEN_2022_PROGRAM_ID` (default is `TOKEN_PROGRAM_ID`).: Targets the Token-2022 program instead of the original Token Program.
  2. Line 1398 key, _ = Pubkey.find_program_address(: Derives a PDA from seeds and the program ID and returns the address with its canonical bump.
  3. Line 1399 seeds=[bytes(owner), bytes(token_program_id), bytes(mint)],: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match.

How to run, build and test

These commands come from the repo's own manifests (package.json scripts, Anchor.toml, Cargo, go.mod, Makefile). Check the README for prerequisites and environment variables.

DirectoryCommandRuns
.make cleanMakefile target
.make formatMakefile target
.make lintMakefile target
.make publishMakefile target
.make test-publishMakefile target
.make testsMakefile target
.make tests-parallelMakefile target
.make unit-testsMakefile target

What you could build from it