skillfed

intervals

Python tools for handling intervals (ranges of comparable objects).

intervals v0.9.2 245.2K downloads/30d#8,737 on PyPI108
Permissive license BSD Abandoned released

What it is and what it does

intervals is a Python library for creating and working with mathematical intervals—ranges defined by lower and upper bounds with configurable inclusion rules. It supports multiple interval types (IntInterval, FloatInterval, DateInterval, DateTimeInterval, etc.) and allows you to define open intervals (excluding endpoints), closed intervals (including both), or half-open variants. You can initialize intervals via factory methods like closed(), open_closed(), or from string representations like '[1, 5]' or '1 - 5'.

The library provides properties to query interval characteristics (length, radius, centre, whether it's degenerate or empty) and supports standard operations like containment checks and comparisons. Its single runtime dependency is infinity, a lightweight package for representing infinite bounds. The package is pure Python and installs with low friction, but has been abandoned since mid-2022, so it receives no maintenance or updates.

Use it for:

  • Represent and validate time ranges or scheduling windows to check if a date falls within a booking or availability interval.
  • Define numeric ranges for data validation, filtering, or binning—for example, categorizing sensor readings into interval buckets.
  • Build interval trees or perform range queries to test membership, overlap, or containment of comparable values.
  • Parse and manipulate human-readable interval notation from configuration files or user input using from_string.
  • Model mathematical or scientific computations involving bounded domains, such as function domains or parameter ranges.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides Python classes for representing and manipulating intervals (ranges) of comparable objects with support for open, closed, and half-open bounds, and operations like intersection and containment checking.

Yes, if you need straightforward interval arithmetic and can accept an unmaintained package. The library is stable for its core use case and has no known vulnerabilities. However, do not adopt it for new projects requiring long-term support or compatibility with future Python versions—the last commit was 2022-05-05 and no maintenance is expected. Suitable for legacy codebases or internal tools where you control the Python version.

Install

intervals on PyPI

pip

pip install intervals

uv

uv add intervals

poetry

poetry add intervals

Installing intervals

Before you install

Low install friction with a pure-Python wheel. However, the package is abandoned—last commit was 2022-05-05 and no releases since 2021-07-02. While it has 108 repository stars, the lack of maintenance means bug fixes and compatibility updates are unlikely.

License in practice

BSD license is permissive, allowing commercial and private use with minimal restrictions. You may use, modify, and distribute the package freely provided you include the license notice.

Quickstart

pip install intervals

from intervals import IntInterval
interval = IntInterval.closed(1, 5)
print(interval.lower, interval.upper)

Verify before relying

  • Whether the package works reliably with Python versions released after 2022 (last commit date).
  • Current compatibility with modern versions of the infinity dependency.

Package facts

License BSD (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies 1 — infinity
Maintenance abandoned — 1,869 days since the last release
Last repo commit
First released
Downloads 245,244/month — #8,737 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: intervals-0.9.2-py3-none-any.whl

Environment :: Web EnvironmentIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Internet :: WWW/HTTP :: Dynamic ContentTopic :: Software Development :: Libraries :: Python Modules

Tags

interval range handlinginterval arithmeticrange operations pythonbounded rangesinterval intersectiondate range intervalsnumeric range library
rangesmathematics

More Python Modules packages