AnchorPy is the gateway to interacting with Anchor programs in Python. It provides:
- A static client generator
- A dynamic client similar to
anchor-ts
- A Pytest plugin
- A CLI with various utilities for Anchor Python development.
Read the Documentation.
pip install anchorpy[cli, pytest]
Or, if you're not using the CLI or Pytest plugin features of AnchorPy you can just run pip install anchorpy
.
AnchorPy does not currently support Solana 2.0 or Anchor 0.30.0.
If you want to contribute to AnchorPy, you will require the following installed, in the following order:
-
Solana CLI for Solana 1.18.26
-
Anchor CLI for Anchor version 0.29.0
Now, follow these steps to get set up:
- Generate a new Solana keypair for local development and configure the Solana CLI to use a localnet for testing:
solana-keygen new --outfile ~/.config/solana/id.json
solana config set --url localhost
- Git clone the repo and initialise the submodules:
git clone https://github.com/kevinheavey/anchorpy.git
git submodule update --init
- Install dev dependencies:
poetry install
- Run the included tests:
poetry run pytest