Async Python Client to The RTEX API Server
Installation
pip install rtex
Usage
The API surface of Rtex is spartan so this is basically the whole thing.
import asyncio
from rtex.client import AsyncRtexClient
async def amain():
async with AsyncRtexClient() as rtex:
res = rtex.create_render("\(x^2 + x - 1\)")
if res.status == "success":
with open("equation.png") as output_fd:
await res.save_render(
res.filename,
output_fd
)
def main():
asyncio.run(amain())
if __name__ == "__main__":
main()
No Thoughts, Just Render
async def amain():
async with AsyncRtexClient() as rtex:
buf = await rtex.render_math("e^x + 1")
# `buf` now contains the bytes of the PNG
Do I look like I know what a Jay-Peg is?
async def amain():
async with AsyncRtexClient() as rtex:
# The render methods accept a format parameter.
# Supported values are "png", "jpg" and "pdf"
buf = await rtex.render_math("e^x + 1", format="jpg")
Self-Hoster
Set the environment variable RTEX_API_HOST or do the following.
async def amain():
async with AsyncRtexClient(api_host="https://myserver.ru") as rtex:
buf = await rtex.render_math("e^x + 1")
I Can Tell By The Pixels
quality in Rtex speak is an abstract notion of compression for the given
format where 100 is the least compressed and 0 is the most. At the time of
writing the default is 85.
density in Rtex speak is how much to sample the rendered PDF when generating
an image. This has no effect on the "pdf" format. At the time of writing the
default is 200.
async def amain():
async with AsyncRtexClient(api_host="https://myserver.ru") as rtex:
needs_more_jpeg = await rtex.render_math(
"e^x + 1",
density=50,
quality=1
)
Metadata
Release files for rtex 0.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| rtex-0.0.7.tar.gz | 7.3 kB | Without provenance | Details for rtex-0.0.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rtex-0.0.7-py3-none-any.whl | Python 3 | none | any | Details for rtex-0.0.7-py3-none-any.whl |
Total release size: 12.8 kB
Release files / rtex-0.0.7.tar.gz
| Download URL | rtex-0.0.7.tar.gz |
|---|---|
| Size | 7.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
41a7aa1185419d188b0c935bfc09b05e82aab32ffff8e1312333d1969a456424
|
|
BLAKE2b-256 checksum How to use checksums |
1c4fc86fdcabcec74b11c57e85abe4db026cea5b64c24dc842c444888222bb99
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / rtex-0.0.7-py3-none-any.whl
| Download URL | rtex-0.0.7-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d64137eff4475e400fd6e66f8c31cdde6826ecbc1ce2a1795bddefac450be1ba
|
|
BLAKE2b-256 checksum How to use checksums |
df63718c263623e9c59258a32c8ec7173e4b351ea45964759f90b000a6c7283a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Security for rtex 0.0.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.