$npx skillfedfor your agent

portion

Python data structure and operations for intervals

Worth itPyPI Scientific/EngineeringReleased Jun 20261.7M downloads / moLGPL-3.0-or-laterPure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — portion-2.6.2-py3-none-any.whl
v2.6.2 · released 2026-06-14 · Python >=3.10 · 1 runtime deps: sortedcontainers

Yes. portion is production-stable (Development Status 5), actively maintained, has no known vulnerabilities, and imposes minimal install friction. The copyleft license (LGPL-3.0-or-later) is a consideration for proprietary use but poses no barrier for open-source projects. Install it if you need interval arithmetic or range operations.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Requires Python 3.10 or later.
  • Low friction: pure Python wheel with a single runtime dependency (sortedcontainers).
  • Active maintenance with a release 61 days ago and 523 repository stars.

License · maintenance · safety

LGPL-3.0-or-later (copyleft) — LGPL-3.0-or-later (copyleft): derivative works and distributions must preserve the license and provide source code access; suitable for open-source projects but requires careful review in proprietary contexts.

last release 2026-06-14 (61 days) · last repo commit 2026-06-29 · 523 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 1,697,074 downloads/mo, #3,643 on PyPI

Verify before relying

pip install portion

import portion as P

# Create intervals
interval = P.closed(1, 2)
print(interval)  # [1,2]

# Perform operations
result = P.closed(0, 2) & P.closed(1, 3)
print(result)  # [1,2]
  • Whether discrete interval simplification (e.g., [0,1] | [2,3] → [0,3] for integers) is available via the customization API mentioned in the description.
  • Performance characteristics for very large interval sets or deeply nested operations.
  • Whether the dict-like interval mapping structure supports all standard dict operations.
Same gist for agents: .md · .json

What it is and what it does

portion is a Python library for creating and manipulating intervals—single ranges or unions of ranges—with automatic simplification and rich set operations. It handles any comparable objects as bounds (numbers, dates, strings) and supports both finite and infinite intervals with open or closed boundaries. The library provides intersection, union, complement, and difference operations, plus tests for emptiness, overlap, and adjacency.

Typical use cases include scheduling systems, range queries, temporal logic, and mathematical interval arithmetic. It includes a dict-like structure to map intervals to data, discrete iteration over interval values, and import/export to strings and Python built-in types. The library is actively maintained, well-tested, and requires only sortedcontainers as a runtime dependency.

Use it for

  • Scheduling and time-slot management: represent availability windows and find overlaps or gaps.
  • Range queries in databases or data structures: efficiently test membership and compute intersections.
  • Temporal logic and constraint solving: work with time intervals and their logical combinations.
  • Numerical analysis: represent and manipulate domains, ranges, and solution sets.
  • Interval mapping: associate data with ranges and query by interval containment.

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

Worth it

Yes.

portion is production-stable (Development Status 5), actively maintained, has no known vulnerabilities, and imposes minimal install friction. The copyleft license (LGPL-3.0-or-later) is a consideration for proprietary use but poses no barrier for open-source projects. Install it if you need interval arithmetic or range operations.

Install

portion on PyPI

Before you install

Low friction: pure Python wheel with a single runtime dependency (sortedcontainers). Active maintenance with a release 61 days ago and 523 repository stars.

Requires Python 3.10 or later.

License in practice

LGPL-3.0-or-later (copyleft): derivative works and distributions must preserve the license and provide source code access; suitable for open-source projects but requires careful review in proprietary contexts.

Quickstart

pip install portion

import portion as P

# Create intervals
interval = P.closed(1, 2)
print(interval)  # [1,2]

# Perform operations
result = P.closed(0, 2) & P.closed(1, 3)
print(result)  # [1,2]

Verify before relying

  • Whether discrete interval simplification (e.g., [0,1] | [2,3] → [0,3] for integers) is available via the customization API mentioned in the description.
  • Performance characteristics for very large interval sets or deeply nested operations.
  • Whether the dict-like interval mapping structure supports all standard dict operations.

Package facts

LicenseLGPL-3.0-or-later copyleft
Python supportSupports the current Python release >=3.10
Install frictionLow. Pure-Python wheel
Runtime dependencies
1 package
sortedcontainers
MaintenanceActively maintained 61 days since the last release
Last repo commit
First released
Downloads1,697,074 / month, #3,643 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Development Status :: 5 - Production/StableIntended Audience :: DevelopersIntended Audience :: EducationIntended Audience :: Information TechnologyIntended Audience :: Science/ResearchLicense :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Scientific/EngineeringTopic :: Scientific/Engineering :: Mathematics

Evidence: portion-2.6.2-py3-none-any.whl

Tags

Capabilities
interval data structureinterval operations union intersectionrange and span handlinginterval set arithmeticcomparable object intervalsinterval simplificationdiscrete interval iteration
Topics
interval-arithmeticrange-operationsset-theory
PyPI keywords
intervalinterval-setrangespan

Let your AI agent find packages like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.

wish › “interval data structure”

  • portionportion provides data structures and operations for working with…
  • igwn-segmentsProvides segment, segmentlist, and segmentlistdict objects for…
  • intervaltreeA self-balancing interval tree data structure that stores and queries…

Give your agent the search over MCP, or paste the wish link into any chat.

More Scientific/Engineering packages

numpy Worth it
PyPI · Software Development · released Aug 2026

NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.

BSD-3-Clause AND 0BSD AND MIT AND Zlib AND CC0-1.0compiled wheel · 3.12+
1.1Bdownloads / mo
pandas Worth it
PyPI · Scientific/Engineering · released Jul 2026

pandas provides fast, flexible data structures (Series and DataFrame) for loading, cleaning, transforming, and analyzing labeled or relational data in Python.

BSD-3-Clausecompiled wheel · 3.11+
769.1Mdownloads / mo
scipy Worth it
PyPI · Libraries · released Jun 2026

scipy provides numerical algorithms for mathematics, science, and engineering—including optimization, integration, linear algebra, Fourier transforms, signal and image processing, and ODE solvers—built on numpy arrays.

BSD-3-Clausecompiled wheel · 3.12+
449.0Mdownloads / mo
scikit-learn Worth it
PyPI · Software Development · released Jun 2026

scikit-learn provides a comprehensive Python library for supervised and unsupervised machine learning, including classification, regression, clustering, dimensionality reduction, and model evaluation tools built on NumPy and SciPy.

Install it if you need to train, evaluate, or deploy supervised or unsupervised learning models.

BSD-3-Clausecompiled wheel · 3.11+
235.5Mdownloads / mo
dill Worth it
PyPI · Software Development · released Jan 2026

dill extends Python's pickle module to serialize and deserialize a much wider range of Python objects, including functions, lambdas, classes, and interpreter sessions, to byte streams for storage or network transmission.

BSD-3-Clausepure Python · 3.9+
208.1Mdownloads / mo
multiprocess Worth it
PyPI · Software Development · released Jan 2026

Multiprocess is an enhanced fork of Python's standard multiprocessing library that uses dill for better serialization, allowing you to spawn processes with a threading-like API and share complex objects between them.

Install it if you use multiprocessing and encounter pickle serialization limits with lambdas or complex objects.

BSD-3-Clausepure Python · 3.9+
202.7Mdownloads / mo

See also intervals · intervaltree · ncls · igwn-segments · python-ranges · infinity · multiset · timeloop · skia-pathops