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.2b0.tar.gz (425.5 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.2b0-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.2b0.tar.gz.

File metadata

  • Download URL: tupleleapai-0.0.2b0.tar.gz
  • Upload date:
  • Size: 425.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.7.8

File hashes

Hashes for tupleleapai-0.0.2b0.tar.gz
Algorithm Hash digest
SHA256 6340a1be32fc2bf984156c6d79cad3169667102cc439637d19b5e79f5771f0f8
MD5 1ccc75f86731d55ab7b9f33f3b4b60c7
BLAKE2b-256 1aaffcdc515b11b2d35fa80e8188c42f3576b3ee54ebb768be736af1fdd2773a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tupleleapai-0.0.2b0-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 b61a34ab925b71186b34021abab987dd7daa1efd4efe146e2ef1bb76bf9c7fbb
MD5 fbc5167d7e0dba7da3cabbdfd2bde6be
BLAKE2b-256 e7ad2147d1ecb3056c956ff97fd0e39885ed9721e9335963b1aedb9ec8bf56ce

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