This project is an example of how to use a Range Tree to find overlapping intervals, where each interval represent a start and end epoch value.
In Postgres, this can be implemented in a fairly straightforward way using tsrange.
A range's interface can be thought of a Relation of a partially ordered set.
The infimum of the set should be a direct mapping to models.partial_interval.
For instance, on the set with keys (K1, K2, ...Kn), where K1 <= K2 <=...<=Kn, and values (V1, V2, ...Vn), a relation would
be a mapping R(k): k -> v.
The relation is encapuslated in PartialInverval through the open_interval and label values, where open_interval is the infimum of (K1, K2, ...Kn).
This project uses poetry for package management.
This project includes a tox.ini file to automate tasks such as
- invoking pytest
- linting
- formatting
- type-checking
- distribution building.
A fresh tox build can be invoked via tox -r, which whill invoke each task.
See https://github.com/tox-dev/tox for more info.
A local distribution of the package can be created either through
poetry buildor
tos -e distSince the build is dependent on poetry, the commands are equivalent.
This project uses pytest. You can invoke tests in a poetry environment, via
poetry run pytest testsThis project uses black to enforce PEP-8 formatting rules.
You can format any file with
poetry run black <target>where <target> is the directory or file to run the tool on.
With tox, you can also check formatting any time with
tox -e formatNote that since tox is intended to be invoked as part of a CI pipeline, we will never rewrite files.
This project (somewhat) enforces static typing through mypy.