--- id: python-ranges version: "1.2.2" license: unclear license_treatment: permissive maintenance: abandoned --- # python-ranges — Continuous Range, RangeSet, and RangeDict data structures License: permissive · Maintenance: abandoned · Downloads: 77.7K/mo ## What it is and what it does python-ranges fills a gap in Python's standard library by providing proper continuous range data structures. The built-in range() only works with integers and doesn't support continuous values like floats or dates. This package introduces Range (a single continuous interval), RangeSet (a collection of non-overlapping ranges), and RangeDict (a dictionary that uses ranges as keys). These structures let you replace verbose if/elif/else chains and boundary-checking logic with cleaner, more readable code. For example, instead of writing multiple conditional branches to determine which tax bracket an income falls into, you can use a RangeDict to map income ranges directly to tax calculations. The Range class supports any comparable data type—numbers, strings, dates—and can represent bounded or unbounded intervals with inclusive or exclusive endpoints. RangeSet provides set-like operations (union, intersection, difference) on collections of ranges. The package has zero runtime dependencies and installs easily, but development has stalled since early 2023, so it receives no active maintenance or updates. Use it for: - Implement tax bracket or tiered pricing logic by mapping income or price ranges to corresponding rates or fees. - Validate user input by checking if a value falls within acceptable bounds using membership testing. - Clamp numeric or comparable values to a range without verbose min/max nesting. - Build interval-based queries or lookups where you need to find which range a value belongs to. - Perform set operations on date ranges, version ranges, or other comparable intervals. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides Range, RangeSet, and RangeDict data structures for representing continuous and non-continuous ranges of values, and for using ranges as dictionary keys. Yes, if you need range data structures and can accept abandoned maintenance. The package is stable, has no known vulnerabilities, and solves a real problem with clean syntax. However, do not rely on it for active bug fixes or compatibility updates beyond Python 3.9. It is suitable for self-contained projects where you control the Python version and can tolerate no future support. ## Install pip install python-ranges uv add python-ranges poetry add python-ranges ## Installing python-ranges Before you install: Low install friction with no runtime dependencies. However, the project is abandoned—last commit was 2023-07-25 and no releases since 2023-02-15. Requires Python 3.9 or higher. License in practice: Licensed under MIT (permissive), so you can use, modify, and distribute this package freely with minimal restrictions. Quickstart: pip install python-ranges from ranges import Range, RangeDict # Check membership if 5 in Range(1, 10): print("Value in range") # Use ranges as dictionary keys tax_brackets = RangeDict({ Range(0, 9701): 0.10, Range(9701, 39476): 0.12, }) rate = tax_brackets[15000] Requires Python 3.9 or higher. Verify before relying: - Whether the package handles edge cases with non-numeric types (strings, dates) as thoroughly as the description suggests. - Performance characteristics when working with very large ranges or RangeSets. - Compatibility with Python versions after 3.9, given the abandoned maintenance status. ## Package facts - License: not declared (permissive) - Python support: supports_current - Install friction: low - Maintenance: abandoned - Downloads: 77.7K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags range data structure, continuous ranges python, range dictionary, range set operations, interval arithmetic, range membership testing, range-based lookups, data-structures, interval-arithmetic [View on SkillFed](https://skillfed.io/packages/python-ranges) · [View on PyPI](https://pypi.org/project/python-ranges/)