Skip to content
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

PyBinary interface type #112

Merged
merged 8 commits into from
Oct 26, 2024
Merged

PyBinary interface type #112

merged 8 commits into from
Oct 26, 2024

Conversation

smartgoo
Copy link
Collaborator

@smartgoo smartgoo commented Oct 26, 2024

Added crate kaspa-python-core (similar to kaspa-wasm-core) to store certain Python specific interface types.

New Rust struct PyBinary to help provide a standard/flexible interface to Python for binary data. PyBinary itself is not exposed to Python as a Python class. Rather, it is used as a parameter type in functions exposed to Python. Specifically for parameters that are of a binary type such as hex string or byte array. PyBinary implements pyo3::conversion::FromPyObject and allows the Python user to pass three different Python types:

  • str (of what should be valid hex, will cause error if not)
  • list[int] (where int is u8, will cause error if not)
  • bytes

This is modeled after BinaryT WASM interface type.

@smartgoo smartgoo merged commit bdc2198 into aspectron:python Oct 26, 2024
6 checks passed
@smartgoo smartgoo deleted the py-binary branch October 26, 2024 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant