Reusable Python library with PostgreSQL, ClickHouse, and Telegram helpers.
Project description
sspart-py-lib
Reusable Python library package for:
- PostgreSQL
- ClickHouse
- Telegram
1) Create virtual environment and install locally
python -m venv .venv
source .venv/bin/activate
pip install -U pip
pip install -e .
2) Use in another project
Option A: install from local path
pip install /absolute/path/to/sspart-py-lib
Option B: install in editable mode during development
pip install -e /absolute/path/to/sspart-py-lib
3) Quick usage
from sspart_py_lib import PostgresClient, ClickHouseClient, TelegramClient
pg = PostgresClient("postgresql://user:pass@localhost:5432/app")
result = pg.execute("INSERT INTO events(name) VALUES (%s)", ("boot",))
print(result.rowcount, result.status_message)
rows = pg.fetch_all("SELECT NOW()")
ch = ClickHouseClient(host="localhost", port=8123, username="default", password="")
result = ch.query("SELECT version()")
bot = TelegramClient("<telegram-bot-token>")
# await bot.send_text(chat_id=123456, text="Hello from sspart-py-lib")
Project structure
sspart-py-lib/
pyproject.toml
README.md
src/
sspart_py_lib/
__init__.py
postgres.py
clickhouse.py
telegram.py
Next improvements (later)
- Add retries / timeouts configuration
- Add connection pooling
- Add structured logging
- Add integration tests with Docker
rm -rf dist build .egg-info(N) python -m build twine upload dist/
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
sspart_py_lib-1.1.2.tar.gz
(7.5 kB
view details)
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 sspart_py_lib-1.1.2.tar.gz.
File metadata
- Download URL: sspart_py_lib-1.1.2.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2644fd4de686c48dfd6b8cd6fd5d88a7c577d8f290e857b42c9af239b13f9197
|
|
| MD5 |
c21afe63a726663ab1d270d3ad610ca4
|
|
| BLAKE2b-256 |
683d41a7d56685f15d9c45229b19ec3be45b5a695b66ca104cd406549be2954b
|
File details
Details for the file sspart_py_lib-1.1.2-py3-none-any.whl.
File metadata
- Download URL: sspart_py_lib-1.1.2-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7af5edcbe0989ab9fed1561f1509fd4025146bcb6adf99ee8299f7a0fd4e937d
|
|
| MD5 |
ae640bf7cf29d44555d02c87db7bf4b4
|
|
| BLAKE2b-256 |
f26217cf20a5dcccfa82096e8350994ef913746c4ca54672cc83f5afee361265
|