No project description provided
Project description
Python Rust Session
This module provides a bridge between Python and Rust, enabling Python code to interact with Rust-implemented functionality related to session and capsule management. It is part of the antimatter
project and leverages PyO3 for seamless Python-Rust interoperability.
Deps
Python:
On Mac: maturin
python3 -m pip install maturin
On Linux: maturin[patchelf]
python3 -m pip install maturin[patchelf]
Rust:
Cargo will handle these for you.
To build, install and run example.
make
To just build and install.
make build
make install
To remove.
make uninstall
Limitations of this version.
It does build and run on Linux, but you will need to change the name of the .whl file that the Makefile looks at for the install target.
Example use.
An example of how to encapsulate and read data from Python is given in the example folder. A short example :
To import.
To use this wrapper, you will need to import the built library.
import antimatter_engine
Create a new session.
Before any operations can be performed, one needs to create a session in which to perform capsule related requests with. This is currently done by providing the Domain ID
to the PySession
constructor.
antimatter_engine.create_session(str) -> PySession
Upon success, this returns a valid PySession
that can be used to create, read and write capsules with.
Encapsulate data.
To encapsulate data, one must call the encapsulate
method on a valid session. When encapsulating one will need to provide the following:
- col_defns - A list of
PyColumnDefinition
containing the name and tags for each column. - data_elems - A 2D list of
PyDataElement
containing the data to be encapsulated, as well as each elements span tags. - write_context_name - Is the name of the write context used to perform this encapsulate operation with.
- path - The path to write the capsule to upon successful encapsulation.
- capsule_tags - A list of
PyTag
that are used as the capsule's tags. - extra - A
string
used to store any extra information about the capsule. This is freeform and can be used to store anything that can be represented as astring
.
valid_session.encapsulate(col_defns=List[PyColumnDefinition], data_elems=List[List[PyDataElement]], write_context_name=str, path=str, capsule_tags=List[PyTag], extra=str) -> None
Upon success, this will return no error.
Open a capsule.
To open a capsule for reading, needs to first open the capsule using a valid session. This is done by calling the open_capsule
method on a valid session with the following:
- path - The resource path to the capsule's blob.
- read_context_name - Is the name of the read context used to read data from the capsule.
valid_session.open_capsule(path=str, read_context_name=str) -> PyCapsuleSession
Upon success, this returns a PyCapsuleSession
which represents a valid opened capsule that can be read from.
Read from an opened capsule.
To read all redacted data from a capsule one can call the read_all
method on a valid session. When doing so, one must provide the following:
read_parameters - A dictionary with all required read parameters for reading the capsule (this can be empty if none are required).
valid_py_capsule_session.read_all(read_parameters=Dict) -> (List[str], List[List[PyTag]], List[List[str]], str)
Upon success, this returns back the following in order:
- col_names - A list of
string
with column information, normally the name of the column. - col_tags - A list of
List[PyTag]
containing tags for each column. - redacted_data - A 2D list of
string
containing the redacted data read from the capsule. - extra - A
string
used to store any extra information about the capsule. This is freeform and can be used to store anything that can be represented as astring
.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for antimatter_engine-0.1.3-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b024c6deb320eede55c70400a6f6549a3fafad2b59f690b81441a6e2ab17923 |
|
MD5 | 3f34295c2c1045cde9b75463694951fb |
|
BLAKE2b-256 | 2fc0585911ded1ba608cde890bbd427ab8aaf4e4280d67a64a6e4d98e1c9251d |
Hashes for antimatter_engine-0.1.3-cp311-cp311-manylinux_2_34_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f91d46c93989aafd7defef8a98fec90f598b39d1dc5056a702381adbb35635d |
|
MD5 | 4b1b36fa06f02d8f5a0c2097ae2d1045 |
|
BLAKE2b-256 | 5500b247a436b4efc512d606ca7b8f4e5ab44117af8854310f1c6abc38e5cd08 |
Hashes for antimatter_engine-0.1.3-cp311-cp311-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 68fb76721c89dcc3aab16bff47175a1eedd163316860b4e02e41bb4b8ec2dfe0 |
|
MD5 | abcfe50cbea69bbd05b8f4e2b295e640 |
|
BLAKE2b-256 | 468e56897be3caf68b8615c917913dd7aa8d79895d52342bbddcbc6b5403c05a |
Hashes for antimatter_engine-0.1.3-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2949fcabcb3e35fccb65e7b98620bcc3e6436ec268f4b4c359168709f0d6f94f |
|
MD5 | 3e601448a913563a2a2e14600a022d76 |
|
BLAKE2b-256 | 57f46e72d76cd8663297de87a978c0eea1ffb7703b070a52824f77a9a688ba19 |
Hashes for antimatter_engine-0.1.3-cp310-cp310-manylinux_2_34_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1022bef9a05298a5a068a97c31d5cd9721a1d6ad0456456b31e14ef6f11ea582 |
|
MD5 | 510a82b90642e1354b13842b86e4f7dc |
|
BLAKE2b-256 | 235f39c1fa7d9f848f3fe17eb262aa3273d23276fb66005b35b0f70323370a5a |
Hashes for antimatter_engine-0.1.3-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 643bfffeed1b0adf08227089123ed0746bb962bda5ef50112379602293772b74 |
|
MD5 | 1908b2bfbdffe5643f14364c5036eb8f |
|
BLAKE2b-256 | 7b61028cb39957ffda255460e1ac613a41b79e7433b8b12594c43e4c598e41a2 |