Common Module
Shared utilities and models for the TL;DR.tv platform.
Structure
common/
├── src/common/
│ ├── core/ # Core functionality (config, exceptions, dependencies)
│ ├── dao/ # Data Access Objects
│ ├── database/ # Database connectivity
│ ├── logging/ # Logging configuration
│ ├── message/ # Message queue models
│ ├── models/ # Domain models
│ ├── platform/ # Platform-specific APIs (Twitch, Kick)
│ └── utils/ # Utility functions
└── tests/
├── unit/ # Unit tests
└── integration/ # Integration tests
Installation
The common module is part of the uv workspace and is automatically available to other services.
For development:
uv pip install -e common
Usage
Data Access Objects (DAOs)
from common.dao import UserDAO, StreamDAO, ClipDAO
from common.database import Db, DBConfig
# Initialize database
db = Db(DBConfig())
# Create DAOs
user_dao = UserDAO(db)
stream_dao = StreamDAO(db)
clip_dao = ClipDAO(db)
Platform APIs
from common.platform.twitch import TwitchApi, TwitchApiConfig
from common.platform.kick import KickApi, KickApiConfig
# Initialize APIs
twitch_api = TwitchApi(config=TwitchApiConfig())
kick_api = KickApi(config=KickApiConfig())
Message Models
from common.message import StreamOnlineMessage, StreamOfflineMessage
# Create messages for RabbitMQ
message = StreamOnlineMessage(
stream_id="12345",
user_id=67890,
platform="twitch",
started_at=datetime.now()
)
Exception Handling
from common.core.exceptions import (
DatabaseError,
TwitchError,
KickError,
ValidationError,
RateLimitError
)
try:
# Database operation
user = await user_dao.get_user_by_id(user_id)
except DatabaseError as e:
logger.error(f"Database error: {e}")
Testing
Run all tests:
uv run pytest common/tests/
Run unit tests only:
uv run pytest common/tests/unit/
Run integration tests:
uv run pytest common/tests/integration/
Type Checking
The module includes type information (py.typed). Run type checking with:
uv run ty check common/
Metadata
Release files for tldr-common 2.0.16
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 |
|---|---|---|---|---|
| tldr_common-2.0.16.tar.gz | 135.2 kB | Without provenance | Details for tldr_common-2.0.16.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tldr_common-2.0.16-py3-none-any.whl | Python 3 | none | any | Details for tldr_common-2.0.16-py3-none-any.whl |
Total release size: 299.8 kB
Release files / tldr_common-2.0.16.tar.gz
| Download URL | tldr_common-2.0.16.tar.gz |
|---|---|
| Size | 135.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9bba490f6bf1a7f29941f3a9b5e3343e9f1a95e5c20b27541aaeb24d9637ba50
|
|
BLAKE2b-256 checksum How to use checksums |
341d9250e4e45bf2a841d849c3438eab1df6c6a27a485b02be02efad5f9e583a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / tldr_common-2.0.16-py3-none-any.whl
| Download URL | tldr_common-2.0.16-py3-none-any.whl |
|---|---|
| Size | 164.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
147e39dd700c91e85ea576678cda016498fbf57e7610035ac5abbd23a45ef67a
|
|
BLAKE2b-256 checksum How to use checksums |
0076716cb7614e18accf7f112a8b8f52b908aa5c9b8c5419d2de56f2987a8234
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for tldr-common 2.0.16
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.