-
Notifications
You must be signed in to change notification settings - Fork 6
feat: algod_client python package #267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR creates a new algod_client
Python package to provide proper algod methods and types for the Python utils package. The implementation uses Rust-based FFI bindings through UniFFI to expose algod client functionality to Python users.
Key changes:
- Added a new Python package structure with FFI bindings for algod client functionality
- Updated build tooling to support building the new package with specific cargo features
- Corrected documentation comments by removing backslash escapes from field annotations
Reviewed Changes
Copilot reviewed 65 out of 69 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
tools/build_pkgs/src/python.rs | Added support for package-specific cargo build flags |
tools/build_pkgs/src/main.rs | Added AlgodClient package configuration and build flags |
packages/python/algod_client/ | Created new Python package with FFI bindings, tests, and configuration |
crates/algod_client/src/apis/client.rs | Moved network-specific constructors to non-FFI implementation block |
crates/indexer_client/src/apis/client.rs | Moved network-specific constructors to non-FFI implementation block |
crates/algokit_http_client/src/lib.rs | Updated parameter name for consistency |
api/oas_generator/ | Updated templates to fix documentation and constructor placement |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
||
@pytest.mark.asyncio | ||
async def test_algod_client(): | ||
client = AlgodClient(host="http://localhost:4001", token="a" * 64) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the end we get an intuitive way to instantiate the AlgodClient wihthout the developer needing to touch HttpClient at all
Creates an
algod_client
package for Python. The main driver for this is to give the Python utils package proper algod methods and types.It should be noted that I initially wanted to make
algokit_http_client
its own package as well, but that lead to some problems documented here: https://github.com/algorandfoundation/algokit-core/blob/debug/ext_foreign_pointer_not_set/packages/python/algod_client/tests/test_algod.py#L10The main problem with not having a separate HttpClient package is that all of the API client packages will need their own HttpClient that will be incompatible with others. For now this is fine because we will use a default implementation as seen in this PR anyways. Even without using the default client a user can still make a custom http client implementation, they will just need to make a separate one for each API client (which might be desirable anyway)