eventweave
Eventweave is a lightweight Python utility that groups overlapping events into chronological combinations. It is useful for temporal reasoning and event sourcing, allowing you to analyze and visualize the relationships between events that occur simultaneously.
Features
- Accepts any iterable of events with user-defined start and end times
- Yields sets of events that are simultaneously active at some point in time
- Handles edge cases for back-to-back, non-overlapping intervals
- Supports atomic events that start and end at the same time
- Runs in
O(n log n)time andO(n)space
Installation
This project is self-contained with no dependencies beyond the Python standard library.
You can install it using pip:
python -m pip install eventweave
Supported for Python 3.13 and above.
Example Usage
Define your events and a key function:
>>> from eventweave import interweave
>>>
>>> events = [
... ("A", (1, 4)),
... ("B", (2, 5)),
... ("C", (5, 6)),
... ]
>>>
>>> def key(event):
... return event[1]
Use interweave to iterate over overlapping combinations:
>>> result = list(interweave(events, key))
>>> expected = [
... {('A', (1, 4))},
... {('A', (1, 4)), ('B', (2, 5))},
... {('B', (2, 5))},
... {('C', (5, 6))},
... ]
>>> assert result == expected
Clarification of Overlapping Events
If one event ends at time T and another begins at time T, they are not
considered overlapping. The model assumes the starting event ends just after
T to preserve strict separation of events that merely touch.
Instantaneous events - where the start and end times are the same - are
considered to be active exactly at this point in time. If an event E starts
and ends at time T, it will overlap with any other event that ends at T.
However, it will not overlap with any event that starts at T, due to the
rule above.
Metadata
Release files for eventweave 0.5.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 | |
|---|---|---|---|
| eventweave-0.5.0.tar.gz | 17.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| eventweave-0.5.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 35.5 kB
Release files / eventweave-0.5.0.tar.gz
| Download URL | eventweave-0.5.0.tar.gz |
|---|---|
| Size | 17.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dcf6ed68ac4e7c17c2dd5974bea56f33e6ef969540864ed52264a91a1a9fa1a1
|
|
BLAKE2b-256 checksum How to use checksums |
c7e08f0f25a3720883df2ec486ecce72a54f458a8ac69daf0cc0132761090a19
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 11, 2025.
Transparency logRelease files / eventweave-0.5.0-py3-none-any.whl
| Download URL | eventweave-0.5.0-py3-none-any.whl |
|---|---|
| Size | 18.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9527ae5fa87aa8e1810136821df6ad2fcfcff8f107ad802f984f324c1cbb46bf
|
|
BLAKE2b-256 checksum How to use checksums |
2e862eac7e27bbf4a9ae4bc2c3b5d2b4f7c751e5b658a2f27adc8c5a588409a6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 11, 2025.
Transparency log