keeptabs.digest#
Answering “what’s new”, writing it up, and delivering it.
A digest is data first (whats_new() returns a JSON-ready dict) and text
second (a summarizer turns that dict into Markdown).
What the items say was written by other people. render_markdown() builds
every link from a stored item’s URL and escapes titles and summaries, so fetched
text cannot add a link, a tag or a mention of its own.
Functions
|
Send a digest to each channel reference, such as |
|
Text that renders as itself, on one line, in Markdown and in HTML: no link, tag, mention, heading or emphasis of its own. |
|
Build a digest, store it, and deliver it (for real only when |
|
A digest as Markdown, with no model involved. |
|
The |
|
The items acquired since |
- keeptabs.digest.deliver(text, channels, *, title, dry_run=True, senders=None)[source]#
Send a digest to each channel reference, such as
email:me@example.org,github:owner/repo#12(a discussion) orslack:.Dry-run by default: a real send reaches people and cannot be unsent. One failing channel does not stop the others.
- Return type:
- keeptabs.digest.escape_text(text)[source]#
Text that renders as itself, on one line, in Markdown and in HTML: no link, tag, mention, heading or emphasis of its own.
>>> print(escape_text('Sprout <!channel> [click](https://evil.example) & co')) Sprout <!channel> \[click\](https://evil.example) & co >>> print(escape_text('ping @someone about #12\n# A heading')) ping @someone about #12 # A heading
- Return type:
- keeptabs.digest.make_digest(spec, mall, *, since=None, now=None, summarizer=None, send=False, senders=None, mark_reported=None)[source]#
Build a digest, store it, and deliver it (for real only when
send).mark_reportedsays whether the items count as reported from now on, so the next digest leaves them out. It defaults tosend: a dry run changes nothing, and can be followed by the real send of the same digest. Items are never marked when a delivery failed, so a digest that did not arrive is sent again.- Return type:
- keeptabs.digest.render_markdown(digest)[source]#
A digest as Markdown, with no model involved.
>>> print(render_markdown({'title': 'Gen AI', 'since': '2026-01-01T00:00:00+00:00', ... 'until': '2026-01-08T00:00:00+00:00', 'total_new': 1, 'shown': 1, 'sections': [ ... {'id': 'video', 'title': 'Video', 'items': [{'title': 'A model', 'url': 'https://example.com/a', ... 'summary': 'It generates.', 'published': '2026-01-05T00:00:00+00:00', 'source': 'blog'}]}], ... 'new_entities': [], 'active_entities': [], 'failing_sources': []})) # What's new: Gen AI 2026-01-01 to 2026-01-08. 1 new item. ## Video - [A model](https://example.com/a) (blog, 2026-01-05). It generates.
- Return type:
- keeptabs.digest.scheduled_digest(*, summarizer=None, senders=None)[source]#
The
on_digest_duecallback forkeeptabs.engine.tick().A period with nothing new is skipped. Otherwise the digest is written to the
digestsstore, and:with
digest.auto_send: true, it is sent, and its items count as reported once every channel took it;with channels but no
auto_send, nothing is sent and nothing is marked: the items wait for the owner’sdigest --send;with no channel at all, the stored digest is the report.
- keeptabs.digest.whats_new(spec, mall, *, since=None, max_items=None, now=None)[source]#
The items acquired since
since, grouped by subtopic, best first.sinceis a time, or a duration ago ('3d'). It defaults to the time of the last digest, or to a week ago when there has been none. What the last digest already reported is not reported again.- Return type: