oh-my-common
Shared runtime for the oh-my-* Flask services. Extracted so each split-out
service (oh-my-rss / oh-my-msg / oh-my-write) shares one implementation instead
of drifting copies. Per the split design, each service keeps its own
settings DB — this package is the code layer, not a shared store.
Modules
settings— SQLite settings client + secret resolution.get_setting/put_setting/get_all, theprovider_tokenscache (get/set/clear_cached_token), andresolve_secret(key, env_key)with precedence service-namespace >global> env. Convenience:resolve_claude_token(),resolve_openai_key(). Config via env:SETTINGS_DB(path),OMI_SERVICE_NS(this service's namespace, e.g.clipboard).claude— Claude CLI gateway:resolve_claude_bin,claude_text,run_claude_capture,gate_ai,claude_status,extract_json,estimate_tokens,estimate_cost,MODEL_PRICING. Flask-free.tz—local_tz()/now_local()/today_local()fromOMI_TZ_OFFSET(hours, default +8).urls—request_base_url()(honorsX-Forwarded-Proto/Host). Imports flask lazily.scheduler—make_scheduler(ENABLED_ENV)→ a guardedBackgroundScheduler(returnsNonewhenENABLED_ENV=0, so extra gunicorn workers don't double-run). Imports apscheduler lazily.llm—complete(prompt, model='sonnet', backend='claude_cli'): backend-routed one-shot completion. Onlyclaude_cli(theclaude -pgateway) is wired today; Anthropic/OpenAI HTTP backends are a future add (the seam is in place).claude_textstays as the claude-cli shortcut.agent—dify_run(inputs, query, ...): shared client for a self-hosted Dify app (blocking). Creds (dify_url/dify_key) from per-service settings or args. Returns{connected, result|error}. Consolidates the hand-rolled Dify calls that lived in service route code.
Usage
import os
os.environ.setdefault('OMI_SERVICE_NS', 'clipboard')
from oh_my_common import get_setting, claude_text, resolve_openai_key, now_local
key, src = resolve_openai_key()
text = claude_text('Summarize: ...', model='sonnet')
Install
pip install oh-my-common # core (stdlib only)
pip install 'oh-my-common[flask,scheduler]' # + request_base_url + make_scheduler
Distribution into Docker services is TBD — see the migration plan. Options: publish to a registry, vendor into each monorepo, or a git dependency.
Metadata
Release files for oh-my-common 0.2.0
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 |
|---|---|---|---|---|
| oh_my_common-0.2.0.tar.gz | 8.4 kB | Without provenance | Details for oh_my_common-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| oh_my_common-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for oh_my_common-0.2.0-py3-none-any.whl |
Total release size: 17.4 kB
Release files / oh_my_common-0.2.0.tar.gz
| Download URL | oh_my_common-0.2.0.tar.gz |
|---|---|
| Size | 8.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c048dca7dc20e4241b5929494fc2e8cac00a588f6502b9b6b25a7a8b2f74368a
|
|
BLAKE2b-256 checksum How to use checksums |
f5d9be1f3b9b87ef356276883bc54706fd2e1081e557c91e2638a3913cb3a583
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.4
|
Release files / oh_my_common-0.2.0-py3-none-any.whl
| Download URL | oh_my_common-0.2.0-py3-none-any.whl |
|---|---|
| Size | 9.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b0bb4334f8e4fc5a8061addb5ddb8ce1d29d4632fc305262b0ecfceec820eeed
|
|
BLAKE2b-256 checksum How to use checksums |
9a0cf49c9f694d1861d70eedf0b357140c0f17d0ef245e4fda53dbd3e2f7f991
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.4
|
Security for oh-my-common 0.2.0
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.