Skip to main content

abstraction-watch, in Python

Be told what is true now, and be told when nothing has changed for a while. A Notice carries the present; quiet says nothing visible has moved for at least the budget, and silence says for how long. One module, standard library only, importing nothing of ours.

Quiet is the half that is normally missing. A progress bar that stops moving and a transfer nobody is performing look identical to a listener that is only told about changes.

This page is the Python package. The contract, the Go and C++ implementations, what is measured and what is UNPROVEN are on the repository.

Install

Not on PyPI, and the name on PyPI is not ours.

git clone https://github.com/openabstractions/abstraction-watch
pip install ./abstraction-watch/python

Python 3.9 or later. abstraction_watch.py is one file with no imports of ours, so copying it into a _vendor/ directory of your own is an equally complete installation.

An example that runs

A source that says when it moved, and a listener that hears both the change and the quiet after it:

import abstraction_watch as watch

progress = watch.push({"done": 0}, stamp="0", budget=0.5)
progress.post({"done": 1 << 20}, stamp="1")

notice = progress.next()
print("now:", notice.now)

notice = progress.next()
print("quiet:", notice.quiet, "after", round(notice.silence, 1), "s of nothing")
progress.close()

budget=0.5 is the quiet budget and the only timer here: the listener's own wait decides when silence counts, so a change the source already made is always delivered ahead of a quiet that would postdate it.

What an application calls

call what it does
push(first, stamp, budget) a subscription over a source that reports its own changes through post
poll(read, every, budget) a subscription over a source that has to be asked. read returns (value, stamp); every is the interval between asks while a listener waits
Subscription.next(timeout=None) the next Notice: a change, or quiet once the budget passed with none
Subscription.current() what is true now, without waiting
Subscription.post(value, stamp) tell a push subscription the source moved
Subscription.close() end it. A waiting next raises Closed
settle(events, period, settled) call settled once a queue of platform notifications has been still for period, because one edit produces several of them

A subscription is iterable: for notice in subscription: ..., ending on close(). stamp is what decides whether a value is a change; two reads with the same stamp are one.

abstraction_job.watch(store, kind, budget) is this primitive with a job store as the source, which is what a download progress view binds to.

What may break

  • No conformance verdict, in any language. No scenario in the suite cites this layer yet — what is proven and what is not. Anything that depends on this layer inherits that.
  • Not on any package index, and no release carries an API stability promise. Pin a commit you have read.
  • poll asks; it does not subscribe to the platform. There is no inotify, no ReadDirectoryChangesW and no FSEvents under it. settle is the seam where a caller supplies those.
  • Every published transcript was produced on Windows or Linux. macOS is UNPROVEN throughout.

Apache-2.0. See LICENSE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

abstraction_watch-0.1.0.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

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

abstraction_watch-0.1.0-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file abstraction_watch-0.1.0.tar.gz.

File metadata

  • Download URL: abstraction_watch-0.1.0.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for abstraction_watch-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3afed7e325d4aaa165891dcc9db364879cc72fbabb16a109279f7e2196ad803a
MD5 862df8addfb452455d047fa7089e7d55
BLAKE2b-256 bbd03f5045b50286af302b4123337f62ee1d8667a37b4c0df5b80dd5ba91f8d3

See more details on using hashes here.

Provenance

The following attestation bundles were made for abstraction_watch-0.1.0.tar.gz:

Publisher: publish.yml on openabstractions/abstraction-watch

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file abstraction_watch-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for abstraction_watch-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 253eed30bd117b8a836fba2f1a5fc18676695eb35f7425456833bf10b524e159
MD5 4038488e3a4192f534d106907f02da0f
BLAKE2b-256 8205055a32b20bc478fcf89354afb7e85a54093753700013b4344b5b55fd4a97

See more details on using hashes here.

Provenance

The following attestation bundles were made for abstraction_watch-0.1.0-py3-none-any.whl:

Publisher: publish.yml on openabstractions/abstraction-watch

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page