Skip to main content

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


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.3.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

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

sspart_py_lib-1.1.3-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file sspart_py_lib-1.1.3.tar.gz.

File metadata

  • Download URL: sspart_py_lib-1.1.3.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for sspart_py_lib-1.1.3.tar.gz
Algorithm Hash digest
SHA256 e71cb6d74df43bad9c1093f21df20114372aecad03cb704ccf548741725095da
MD5 6e5c40ca79e8e716e22aed45d831d060
BLAKE2b-256 65baba715ff0c1d50100ac9da625cdedaae875a1f0b79f58efdcbab93ed1eebd

See more details on using hashes here.

File details

Details for the file sspart_py_lib-1.1.3-py3-none-any.whl.

File metadata

  • Download URL: sspart_py_lib-1.1.3-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for sspart_py_lib-1.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 eabc1320193239991da63df25baf2d7d36d75287bc6813eaeef28c12ff1976f5
MD5 378cbbed514d33479cd5b53415432500
BLAKE2b-256 4845357c93154b8c657e762ebb0814ac11eba31d08f6dbb2f26b6ea4e3bb1644

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