No project description provided
Project description
Python bindings for TupleLeap
>>> import asyncio
>>> from tupleleap_python_sdk import pdf_parse_async
>>> async def main():
... res = await pdf_parse_async("/Users/test_data/sample.pdf")
... print(res)
...
>>> asyncio.run(main())
===============================================================================
Steps to build python bindings
- [Optional]Create a virtual env for pyo3
pyenv virtualenv 3.10.15 pyo3-dev
- Activate virtual env.
pyenv activate pyo3-dev
-
[Optional]Install maturin if not installed
-
[Optional, only for new projects] Init maturin
maturin init
>> choose pyo3
- Generate Wheel , install the wheel for python developement
maturin develop #- wheel is generated.
python
>>> import tupleleap_python_sdk
>>> tupleleap_python_sdk.sum_as_string(3,4)
'7'
>>>
- Create a Wheel
maturin build
This command builds the wheel.
- To publish it please create an API token in pypi https://pypi.org/manage/account/ Run the below command
maturin publish
Enter the user name as __token__
For the password enter the api token that has been generated.
- To publish it to testpypi create an API token in testpypi https://test.pypi.org/manage/account Run the below command
maturin publish --repository testpypi
Enter the user name as __token__
For the password enter the api token that has been generated.
##Note:##
-
Steps 5 and 6 are automated in CI.yml and will generated python bindings for all architectures.
-
Async RUST functions to asyncio in Python mapping
sum_as_string_async() is an async RUST function. The python binding of it can be invoked as follows
import asyncio
from tupleleap_python_sdk import sum_as_string_async
async def main():
res = await sum_as_string_async(3,4)
print(res)
asyncio.run(main())
Steps to build and invoke RUST code directly.
- This code invokes the main.rs
RUST_LOG=info cargo run --bin server
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 Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tupleleapai-0.0.3b0.tar.gz.
File metadata
- Download URL: tupleleapai-0.0.3b0.tar.gz
- Upload date:
- Size: 421.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5dabad2f35881c42f1895c79f8cfb2473c517d70ce3429417ddc9c62587ea265
|
|
| MD5 |
414aafefa00480e4860bd565549bd3dd
|
|
| BLAKE2b-256 |
c4f186128719732749d5b15517535aab7913c28f2ba49e2418057c153a52b3e7
|
File details
Details for the file tupleleapai-0.0.3b0-cp310-cp310-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: tupleleapai-0.0.3b0-cp310-cp310-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 3.1 MB
- Tags: CPython 3.10, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
36f04e044c891c0595052e5634bc9f29debc41aa23dbddac7dd9347071573082
|
|
| MD5 |
e54e19ac5abd56a17769281b4b2696bb
|
|
| BLAKE2b-256 |
84c0c0b27483c3a5db54211ee8438f077c08b3e3949d89e5cc7ad82438192533
|