Scan your whole stack
From OX Research Newsroom
Are you using minevent?
Find out what’s in your code.
Scan your apps free in minutes (opens in a new tab)Latest version: v0.6.0a0
minevent was last scanned on 27 Nov 2026 at version 0.6.0a0. Risk score 0 of 100. No malicious behavior was detected.
| Version | Published | Status |
|---|---|---|
| 0.6.0a0 LATEST | 27 Nov 2026 | No rules fired |
Findings for v0.6.0a0. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.
The score describes 0.6.0a0; other versions have their own rules, not their own score.
The publisher’s own README, as collected from the registry.
minevent is a Python library that provides a minimal event system for Machine Learning.
It allows you to customize code by adding pieces of code that are executed when an event is
fired.
minevent is organized around three main concepts:
EventManager) which stores the event handlers and triggers the events.A typical use is a training loop that triggers events such as epoch_end: logging, checkpointing
or monitoring is then added by registering handlers, without changing the loop.
The library provides a built-in condition (PeriodicCondition) to control when a handler runs, and
it is easy to extend: a handler is a callable and a condition is any
function that returns a boolean, so there is no base class to extend.
It is possible to use all the components or just a subset based on the need.
For example, a handler is a plain callable, so it can be tested without the event manager.
:information_source: This page describes the main branch. Version 0.5.0 and older have a
different API: see Installation.
ContextPeriodicCondition or any function that
returns a booleanSubscription, or are scoped with a
with blockatrigger_eventThe loop triggers events and knows nothing about the handlers. Logging and checkpointing are added by the code that calls it:
>>> from minevent import EventManager, PeriodicCondition
>>> def train(manager: EventManager, epochs: int) -> None:
... for epoch in range(epochs):
... loss = 1.0 / (epoch + 1)
... manager.trigger_event("epoch_end", {"epoch": epoch, "loss": loss})
... manager.trigger_event("training_end")
>>> manager = EventManager()
>>> _ = manager.add_event_handler(
... "epoch_end", lambda context: print(f"epoch {context['epoch']}: loss={context['loss']}")
... )
>>> _ = manager.add_event_handler(
... "epoch_end", lambda _: print("checkpoint"), condition=PeriodicCondition(freq=2)
... )
>>> _ = manager.add_event_handler("training_end", lambda _: print("Training ended"))
>>> train(manager, epochs=3)
epoch 0: loss=1.0
checkpoint
epoch 1: loss=0.5
epoch 2: loss=0.3333333333333333
checkpoint
Training ended
>>> from minevent import Context, EventManager
>>> manager = EventManager()
>>> @manager.on("epoch_end")
... def log_epoch(context: Context) -> None:
... print(f"epoch {context['epoch']}, loss {context.get('loss', 'unknown')}")
>>> _ = manager.add_event_handler("epoch_end", lambda _: print("done"))
>>> manager.trigger_event("epoch_end", {"epoch": 1, "loss": 0.5})
epoch 1, loss 0.5
done
A handler is always called with the context of the trigger (see
the calling rule),
which holds the data given to trigger_event.
A condition is a function of the context that returns a boolean. With once=True, a handler runs at
most once:
>>> from minevent import EventManager, PeriodicCondition
>>> manager = EventManager()
>>> _ = manager.add_event_handler(
... "epoch_end", lambda _: print("checkpoint"), condition=PeriodicCondition(freq=2)
... )
>>> _ = manager.add_event_handler("epoch_end", lambda _: print("first epoch"), once=True)
>>> _ = manager.add_event_handler(
... "epoch_end",
... lambda _: print("low loss"),
... condition=lambda context: context["loss"] < 0.5,
... )
>>> for loss in [0.9, 0.6, 0.4]:
... manager.trigger_event("epoch_end", {"loss": loss})
checkpoint
first epoch
checkpoint
low loss
add_event_handler returns a Subscription. Call its remove method, or use it in a with block
to scope the registration:
>>> from minevent import EventManager
>>> manager = EventManager()
>>> subscription = manager.add_event_handler("batch_end", lambda _: print("batch"))
>>> subscription.remove()
True
>>> with manager.add_event_handler("batch_end", lambda _: print("profile the batch")):
... manager.trigger_event("batch_end")
profile the batch
>>> manager
EventManager(events={})
events lists the events that have a handler, and get_subscriptions the registrations of one, in
the order they run. clear_event removes the handlers of an event, and reset all of them:
>>> from minevent import Context, EventManager
>>> def save(_: Context) -> None:
... print("save")
>>> manager = EventManager()
>>> _ = manager.add_event_handler("epoch_end", save)
>>> _ = manager.add_event_handler("training_end", save, once=True)
>>> manager.events
['epoch_end', 'training_end']
>>> manager.get_subscriptions("training_end")
(Subscription(event='training_end', handler='save', once=True),)
>>> manager.clear_event("epoch_end")
>>> manager
EventManager(events={'training_end': 1})
>>> manager.reset()
>>> manager
EventManager(events={})
atrigger_event awaits the coroutine handlers, one after the other, and runs the synchronous ones:
>>> import asyncio
>>> from minevent import Context, EventManager
>>> async def upload(context: Context) -> None:
... await asyncio.sleep(0)
... print(f"uploaded {context['path']}")
>>> manager = EventManager()
>>> _ = manager.add_event_handler("checkpoint_saved", upload)
>>> asyncio.run(manager.atrigger_event("checkpoint_saved", {"path": "model.pt"}))
uploaded model.pt
An exception of a handler or a condition reaches the caller of the trigger, with a note that names what raised it. The next handlers are skipped:
>>> from minevent import Context, EventManager
>>> def log_loss(context: Context) -> None:
... print(context["loss"])
>>> manager = EventManager()
>>> _ = manager.add_event_handler("epoch_end", log_loss)
>>> try:
... manager.trigger_event("epoch_end", {"epoch": 1})
... except KeyError as exc:
... print(exc.__notes__[0])
raised by log_loss while handling the event 'epoch_end'
The quickstart shows each feature, and the examples combine them, for example to:
The documentation of the main branch has the
following pages:
The documentation of the latest release is also available.
We highly recommend installing
a virtual environment.
minevent can be installed from pip using the following command:
pip install minevent
minevent has no dependency, so no optional dependencies or extras are required. It supports Linux
and macOS: Windows is not supported.
This command installs the latest release. To use the API described on this page before it is
released, install the main branch:
pip install git+https://github.com/durandtibo/minevent.git
Please check the get started page for
other alternatives to install the library.
The following is the corresponding minevent versions and supported Python versions. The older
versions are listed on the releases page and
the changes, with the migration from 0.5.0, are listed in the
changelog.
minevent |
python |
|---|---|
main |
>=3.11 |
0.5.0 |
>=3.10 |
0.4.0 |
>=3.10 |
We welcome contributions from the community! Whether you're fixing bugs, adding features, improving documentation, or creating examples, your help is appreciated.
mineventPlease check the instructions in CONTRIBUTING.md for detailed information.
:warning: While minevent is in development stage, no API is guaranteed to be stable from one
release to the next.
In fact, it is very likely that the API will change multiple times before a stable 1.0.0 release.
In practice, this means that upgrading minevent to a new version will possibly break any code that
was using the old version of minevent.
minevent is licensed under BSD 3-Clause "New" or "Revised" license available in LICENSE
file.
Find threats in your stack.
OX Radar can check high-priority threats, like critical package CVEs, against your context.
Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.
The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).
The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.