Skip to main content

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

  1. [Optional]Create a virtual env for pyo3
pyenv virtualenv 3.10.15 pyo3-dev
  1. Activate virtual env.
pyenv activate pyo3-dev
  1. [Optional]Install maturin if not installed

  2. [Optional, only for new projects] Init maturin

maturin init
>> choose pyo3
  1. 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'
>>>
  1. Create a Wheel
maturin build

This command builds the wheel.

  1. 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.

  1. 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:##

  1. Steps 5 and 6 are automated in CI.yml and will generated python bindings for all architectures.

  2. 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.

  1. This code invokes the main.rs
RUST_LOG=info cargo run --bin server

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tupleleapai-0.0.3b0.tar.gz (421.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tupleleapai-0.0.3b0-cp310-cp310-manylinux_2_34_x86_64.whl (3.1 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ x86-64

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

Hashes for tupleleapai-0.0.3b0.tar.gz
Algorithm Hash digest
SHA256 5dabad2f35881c42f1895c79f8cfb2473c517d70ce3429417ddc9c62587ea265
MD5 414aafefa00480e4860bd565549bd3dd
BLAKE2b-256 c4f186128719732749d5b15517535aab7913c28f2ba49e2418057c153a52b3e7

See more details on using hashes here.

File details

Details for the file tupleleapai-0.0.3b0-cp310-cp310-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for tupleleapai-0.0.3b0-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 36f04e044c891c0595052e5634bc9f29debc41aa23dbddac7dd9347071573082
MD5 e54e19ac5abd56a17769281b4b2696bb
BLAKE2b-256 84c0c0b27483c3a5db54211ee8438f077c08b3e3949d89e5cc7ad82438192533

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page