Changelog
June 29, 2026 ยท View on GitHub
2.7.0-pre1 (not yet released)
Added
IntervalDict.popacceptsNoneas default value.
2.6.2 (2026-06-14)
Changed
- Drop official support for Python 3.9 (EoL).
- Improve performance of
Intervalcreation and union for large disjunctions of overlapping intervals. - Improve performance of
Interval.__contains__for values. - Improve performance of
Interval.overlaps,__and__, and__contains__for large, complex intervals when applied to small subintervals (see #107, Henry Tung). - Improve performance of
IntervalDict.updateandIntervalDictconstructor for hashable values (see #108).
2.6.1 (2025-05-25)
Added
- A
__version__attribute relying onimportlib.metadata. - A
uv.locklock-file for reproducible builds.
Changed
- Drop official support for Python 3.8.
- Switch from
blacktorufffor code style. - Fully migrate to a
pyproject.toml-based project. - Ensure code style consistency (see selected rules in
pyproject.toml). - Extra dependencies are part of the
devdependency group (PEP 735). - Switch from
setuptoolstohatchlingfor buildingportion. - Switch from
coveragetopytest-covfor test coverage.
2.6.0 (2024-10-17)
Added
- The
howfunction ofcombinecan access the current interval ifpass_intervalis set (see #97).
2.5.0 (2024-09-18)
Added
- The
combinemethod of anIntervalDictaccepts amissingparameter to fill values for non-overlapping keys (see #96). - A recipe to
combinemore than twoIntervalDict(see #95).
Changed
- Drop official support for Python 3.7.
2.4.2 (2023-12-06)
Fixed
- Import error when using
create_apiin Python 3.10+ (see #87).
2.4.1 (2023-07-19)
Fixed
- Import error when using
create_apioutside a REPL (see #85).
2.4.0 (2023-03-13)
Added
- An
AbstractDiscreteIntervalclass to ease the creation of specialized discrete intervals (experimental). - A
create_apifunction to generate an API similar to the one ofportionbut configured to use a given subclass ofInterval(experimental, see Specialize & customize intervals).
Changed
- Speed up
reprandto_stringforIntervalinstances (see #76, adm271828). - Some internal changes to ease subclassing:
from_stringandfrom_dataaccepts aklassparameter to specify which class should be used to createIntervalinstances (default isInterval).- Add a
klassparameter foropen,closed,openclosed,closedopen,singletonandempty(default isInterval). - Add a
_klassclass attribute inIntervalDictto specify how to createIntervalinstances (default isInterval). IntervalDictusesself.__class__to preserve subclasses when creating new instances.
2.3.1 (2023-01-28)
Changed
- Speed up lookups in
IntervalDictfor non-interval keys. - Speed up
iterateby no longer creating singleton instances under the hood. - Drop official support for Python 3.6.
Fixed
- Infinite recursion when a subclass of an
Intervalis compared using>with anIntervalinstance (see #75).
2.3.0 (2022-08-31)
Added
- Support for Python 3.10.
IntervalDict.as_dicthas an optionalatomic=Falseparameter that, if set toTrue, returns intervals that are atomic.- Experimental support for structural pattern matching (on
left,lower,upperandright).
Fixed
- (breaking) Set
list(P.empty()) == [], i.e., the empty interval is a disjunction of no interval (see #72). - (breaking) For consistency, the empty interval is never
<,>,<=, nor>=when compared to another interval. - Comparing an interval and a value is deprecated since it is ill-defined when the value is on the left of
<=or>=. Convert values to singletons first.
2.2.0 (2021-09-14)
Added
- Support PEP 517.
Changed
- Some internal changes to ease subclassing
Interval(see #58):- Use
self.__class__instead ofIntervalto create new instances; - Deprecate and move
mergeablefunction toInterval._mergeableclass method; Interval.from_atomicis now a class method instead of a static method.
- Use
- Speed up lookups in
IntervalDict(#65, Jeff Trull). - Speed up removals in
IntervalDict. - Speed up intersection for non-overlapping intervals (#66, Jeff Trull).
- Speed up
.overlapsand.containsfor non-overlapping intervals/items.
2.1.6 (2021-04-17)
Changed
- Drop official support for Python 3.5.
- Use
blackas official code formatting.
Fixed
from_stringraises aValueErrorif given string cannot be parsed to an interval (#57).
2.1.5 (2021-02-28)
Fixed
- Getting items from an
Intervalusing a slice does no longer return alistbut anIntervalinstance. - Intervals are properly pretty-printed by
pandas(#54).
2.1.4 (2020-11-26)
Changed
- Much faster
get,copyand|operations forIntervalDict.
2.1.3 (2020-09-18)
Fixed
- Empty intervals are contained in all intervals (#41).
2.1.2 (2020-09-16)
Added
IntervalDictsupports|and|=, the same waydictwill do starting from Python 3.9 (#37).
Fixed
- Fix invalid simplification of 3+ intervals when a closed interval shares the lower bound of an open one (#38).
- Fix the order in which items are returned from an
IntervalDictwhen a closed interval shares the lower bound of an open one (#39).
2.1.1 (2020-08-21)
Fixed
- Fix a regression introduced in 2.1.0 for
IntervalDict(#36).
2.1.0 (2020-08-09)
Added
IntervalDict.as_dict()to export its content to a classical Pythondict.
Changed
IntervalDict.keys(),values()anditems()return view objects instead of lists.
Fixed
IntervalDict.popitem()now returns a (key, value) pair instead of anIntervalDict.- The documentation of
IntervalDict.pop()now correctly states that the value (and not the key) is returned.
2.0.2 (2020-05-09)
Fixed
- Fix occasional
StopIterationexception when checking for containment (#28).
2.0.1 (2020-03-15)
Fixed
- Fix invalid representations of non-atomic intervals composed of a singleton (#22).
2.0.0 (2020-03-06)
Added
i.emptyto check for interval emptiness.i.atomicto check for interval atomicity.- An
adjacentmethod to test whether two intervals are adjacent. i.__getitem__supports slices.- Infinities define a hash value.
- Static method
Interval.from_atomic(left, lower, upper, right)to create an interval composed of a single atomic interval (replacesAtomicInterval(left, lower, upper, right)).
Changed
- (breaking)
python-intervalshas been renamedportion. - (breaking) Many (optional) parameters are converted to keyword-only arguments:
- for
from_stringandto_string:bound,disj,sep,left_open,left_closed,right_open,right_closed,pinfandninf; - for
from_dataandto_data:pinfandninf; - for
iterate:baseandreverse; - for
Interval.replace:ignore_inf.
- for
- (breaking)
incris replaced bystepiniterate. - (breaking) For consistency with
range, thestepparameter initerateis always added even ifreverse=True. - (breaking)
i.enclosureis a property and no longer a method. - (breaking) Indexing or iterating on the atomic intervals of an
IntervalreturnsIntervalinstances instead ofAtomicIntervalones. - (breaking) An interval is hashable if and only if its bounds are hashable.
- Huge performance increase for creation, union, intersection, complement and difference of intervals (#21).
CLOSEDandOPENare members of theBoundenumeration.- Large refactoring to encapsulate
AtomicIntervaland all its operations inInterval. - Restructure package in modules instead of a flat file.
- Reorganise tests in modules and classes instead of a flat file.
- Reorganise changelog with explicit categories.
Removed
- (breaking) Drop support for Python 2.7 and 3.4 since they reached end-of-life.
- (breaking)
AtomicIntervalis anamedtupleand is no longer part of the public API. - (breaking) Remove
i.to_atomic()(usei.enclosureinstead). - (breaking) Remove
i.is_empty()(usei.emptyinstead). - (breaking) Remove
i.is_atomic()(usei.atomicinstead). - (breaking)
CLOSEDandOPENdo no longer define an implicit Boolean value. Use~instead ofnotto invert a bound. - (breaking) Remove deprecated
permissiveini.overlaps. - (breaking) Remove
adjacentini.overlaps, usei.adjacentmethod instead.
Fixed
- Fix an issue where an interval can be composed of duplicated empty intervals (#19).
- Fix performance issues when intervals composed of hundreds of atomic intervals are complemented (#20)
1.10.0 (2019-09-26)
Added
IntervalDicthas a.combinemethod to merge its keys and values with anotherIntervalDict.
1.9.0 (2019-09-13)
Added
- Discrete iteration on the values of an interval with
iterate. - Map intervals to data with the dict-like
IntervalDictstructure.
Changed
- Faster comparisons between arbitrary values and intervals.
- Deprecate
permissivein.overlapsin favour ofadjacent.
Fixed
.unionwhen intervals share a bound, one inclusive and one exclusive (#12)..overlapswhen intervals share a lower bound, and one interval is contained within the other one (#13).
1.8.0 (2018-12-15)
Added
- Intervals have a
.left,.lower,.upper, and.rightattribute that refer to its enclosure. - Intervals have a
.replacemethod to create new intervals based on the current one. This method accepts both values and functions. - Intervals have an
.applymethod to apply a function on the underlying atomic intervals. - Intervals can be compared with single values as well.
Changed
P.empty()returns the same instance to save memory.- Infinities are singleton objects.
- Set
len(P.empty()) = 1andP.empty()[0] == P.empty().to_atomic()for consistency.
1.7.0 (2018-12-06)
Added
- Import from and export to Python built-in data types (a list of 4-uples) with
from_dataandto_data(#6). - Examples for arbitrary interval transformations.
1.6.0 (2018-08-29)
Added
- Support for customized infinity representation in
to_stringandfrom_string(#3).
1.5.4 (2018-07-29)
Fixed
.overlaps(#2).
1.5.3 (2018-06-21)
Fixed
- Invalid
reprfor atomic singleton intervals.
1.5.2 (2018-06-15)
Fixed
- Invalid comparisons when both
IntervalandAtomicIntervalare compared.
1.5.1 (2018-04-25)
Fixed
- #1 by making empty intervals always resolving to
(P.inf, -P.inf).
1.5.0 (2018-04-17)
Added
Interval.__init__acceptsIntervalinstances in addition toAtomicIntervalones.
1.4.0 (2018-04-17)
Added
- Function
P.to_stringto export an interval to a string, with many options to customize the representation. - Function
P.from_stringto create an interval from a string, with many options to customize the parsing.
1.3.2 (2018-04-13)
Added
- Support for Python 2.7.
1.3.1 (2018-04-12)
Fixed
- More tests to cover all comparisons.
- Define
__slots__to lower memory usage, and to speed up attribute access. - Define
Interval.__rand__(and other magic methods) to supportIntervalfromAtomicIntervalinstead of having a dedicated piece of code inAtomicInterval. __all__properly defined.
1.3.0 (2018-04-04)
Added
- Meaningful
<=and>=comparisons for intervals.
1.2.0 (2018-04-04)
Added
Intervalsupports indexing to retrieve the underlyingAtomicIntervalobjects.
1.1.0 (2018-04-04)
Added
- Both
AtomicIntervalandIntervalare fully comparable. singleton(x)to create a singleton interval [x].empty()to create an empty interval.Interval.enclosure()that returns the smallest interval that includes the current one.
Changed
- Interval simplification is in O(n) instead of O(n*m).
AtomicIntervalobjects in anIntervalare sorted by lower and upper bounds.
1.0.4 (2018-04-03)
Fixed
- All operations of
AtomicInterval(except overlaps) acceptInterval. - Raise
TypeErrorinstead ofValueErrorif type is not supported (coherent withNotImplemented).
1.0.3 (2018-04-03)
- Initial release on PyPP.
1.0.0 (2018-04-03)
- Initial release.