Skip to content

Installation

miniproto supports standard CPython 3.13, 3.14 and 3.15, plus free-threaded CPython 3.14t and 3.15t.

Install miniproto from PyPI in an application project with uv:

Terminal window
uv add miniproto

Or install it with pip:

Terminal window
python -m pip install miniproto

For development, clone the repository and install its toolchain dependencies. The source checkout requires Python 3.13 or newer and Rust 1.100 or newer to build the bundled Rust/PyO3 extension.

git clone https://github.com/EDM115/miniproto.git
Set-Location miniproto
uv sync --group docs
uv run python -c "from miniproto import Client, ClientConfig; print('miniproto import OK')"

This builds the local package and installs the default dev group along with docs. Include --group docs on subsequent syncs to keep the reference generators available.

ClientConfig requires a positive Telegram application ID and a non-empty API hash. Get both from Telegram’s official API development tools. Keep them out of source control, command-line arguments and logs.

Use environment variables or a deployment secret manager for credentials. A minimal PowerShell setup for an interactive local shell is:

$env:MINIPROTO_API_ID = '<your Telegram API ID>'
$env:MINIPROTO_API_HASH = '<your Telegram API hash>'
$env:MINIPROTO_BOT_TOKEN = '<bot token when using bot authorization>'

The names above are an application convention for the examples, not configuration keys read automatically by ClientConfig. Pass their values explicitly when constructing the configuration.

Client(ClientConfig(...)) uses encrypted SQLite storage at miniproto.session.sqlite unless you supply session_storage=. Set a constructor key or MINIPROTO_SESSION_KEY before creating a client with the default backend. For a disposable experiment, pass InMemorySessionStorage() explicitly. It loses authorization state when the process ends.

from miniproto import Client, ClientConfig, InMemorySessionStorage
client = Client(
ClientConfig(api_id=12345, api_hash="read this from a secret manager", session_storage=InMemorySessionStorage())
)

Use a distinct durable session path per account or deployment and read Session Security before exporting, importing or sharing a session string.

Continue with the five-minute quickstart. For contributor commands, native builds, wheel coverage and supported free-threaded verification, use Development Commands.