Skip to content

v0.2.0

Choose a tag to compare

@binyamin555 binyamin555 released this 07 Oct 04:53
· 1 commit to main since this release

pkl 0.2.0 - a rewrite around a four-concept core

This is a breaking release. pkl now only does two things: it knows which plugin is executing, and it knows which resources each plugin owns. A registry is a lifetime: you call registry.release(plugin) whenever you decide that lifetime ends (disable, uninstall, anything else). Everything else is an extension that depends on the core, never the other way around.

Core

  • Plugin: an identity (same iff is). Derive, compose or wrap it to attach your own data.
  • PluginTracker[P]: the currently executing plugin (per thread / asyncio task); bind(fn) runs a function as the plugin that was executing when it was bound.
  • Resource: anything with release().
  • ResourceRegistry[P]: plugin -> resources; thread-safe, releases newest first, keeps going after errors and raises an ExceptionGroup.

Extensions (pkl.tracking, events, syscall, timing, files, modules)

  • Tracked / ResourceTracker / Callback: resources that register themselves under the plugin that created them.
  • events: event_decorator(tracker) builds @event / @event(protected=False); events are invocable only by their owner by default; anyone can subscribe; subscriptions run as their subscriber.
  • syscall, Timer, File / Directory / TempFile / TempDirectory, ModuleResource.
  • No global state: a process can run any number of independent hosts.

See the README and the documentation.

Breaking changes

  • Python 3.11+ (was 3.9+).
  • Removed, to be rebuilt as extensions or in your application: plugin metadata/manifests and requires checks, the enable/disable lifecycle and __enable__, child plugins, plugin-aware logging, lifecycle/resource hooks, the global pkl.host, pkl.load_plugin, set_default_host, and the pkl.plugins virtual import.
  • protected on events now limits who may invoke (default True); subscribing is always open.

Also

  • CI on Python 3.11-3.13 x Linux/Windows (mypy --strict, 136 tests); publishing is gated on the same checks and on the tag matching the package version.