tinycommons
Small helpers for Python repos: logging, .env, sqlite, atomic JSON, slugs.
These helpers were copy-pasted between seven of my repos (tiktok-lazy-follower, get_cool_event, dialogue-lens, finance-insights, jobs, dental-parser, chat-watch) and drifted apart. This package is the one copy, with the bugs those copies had fixed.
Python 3.12+, stdlib only. rich is an optional extra for the console log.
Install
uv add tinycommons # or: pip install tinycommons
uv add "tinycommons[rich]" # rich console in setup_logging
Usage
from tinycommons import load_env, load_or_default, save_atomic, setup_logging, sqlite_session
log_path = setup_logging("myapp", "logs") # per-run DEBUG file + console, returns its Path
env = load_env(".env", {"WORK_TZ": "Asia/Almaty"})
SCHEMA = "CREATE TABLE IF NOT EXISTS videos (id TEXT PRIMARY KEY, author TEXT);"
with sqlite_session("data/cache.db", SCHEMA) as conn: # commits on clean exit
conn.execute("INSERT OR IGNORE INTO videos VALUES (?, ?)", ("id1", "bob"))
clinics = load_or_default("data/clinics.json", []) # [] only if the file is missing
save_atomic("data/clinics.json", clinics)
Modules
| module | what it is |
|---|---|
tinycommons.logsetup |
setup_logging: per-run log file, optional console, rotation, secret redaction |
tinycommons.env |
load_env: dependency-free KEY=VALUE .env reader |
tinycommons.db |
open_sqlite_db / sqlite_session: Row factory, idempotent schema, mkdir |
tinycommons.json_store |
load_or_default / save_atomic / merge_keep_nonempty |
tinycommons.text |
safe_filename / slugify |
Docs
- API: signatures of every function.
- Design notes: what changed from the copies, how
save_atomicwrites, specs, real output, more logging setups. - Migration notes: for the repos this was extracted from.
Tests
uv sync --all-extras
uv run pytest -q
105 tests, no network. CI runs them on Python 3.12 and 3.13.
License
Metadata
Release files for tinycommons 0.2.3
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 |
|---|---|---|---|---|
| tinycommons-0.2.3.tar.gz | 18.8 kB | With provenance | Details for tinycommons-0.2.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tinycommons-0.2.3-py3-none-any.whl | Python 3 | none | any | Details for tinycommons-0.2.3-py3-none-any.whl |
Total release size: 33.3 kB
Release files / tinycommons-0.2.3.tar.gz
| Download URL | tinycommons-0.2.3.tar.gz |
|---|---|
| Size | 18.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f3424fb8454bfbecdd5a2e63e03fafb05e89a696504ba1ee0bec2130b0c8c116
|
|
BLAKE2b-256 checksum How to use checksums |
9c0a7a3693974ba6114368cb0e87bb2d4cb5aff1eacc7d8dd0831fd2b27f128f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.
Transparency logRelease files / tinycommons-0.2.3-py3-none-any.whl
| Download URL | tinycommons-0.2.3-py3-none-any.whl |
|---|---|
| Size | 14.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ba178e66f5974afc2059d831940a72ebc742492788beb8c30364377c722276fd
|
|
BLAKE2b-256 checksum How to use checksums |
bd4a97ee20e13892fccc3339c03050960661c4752582681b1ae3a39c60f5997f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.
Transparency logSecurity for tinycommons 0.2.3
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for tinycommons-0.2.3.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.
Transparency logA 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.