The `infinity` library for Python provides a universal, all-in-one infinity value (`inf`) that can be compared to any other object, including numbers, lists, strings, and custom types, offering more flexible comparison behavior than `float('inf')`. It is currently at version 1.5 and has an infrequent release cadence for its stable feature set, reflecting its simple and focused utility.
Install & Compatibility
Where this runs
tested against v1.5 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 19.2MB
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 2.5s · import 0.000s · 20MB
17MB installed
● package 17MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
The 'inf' object is a singleton and should be imported directly, not instantiated.
from infinity import inf
Demonstrates importing `inf` and its universal comparison capabilities with various data types, including numbers, strings, and collections, as well as accessing negative infinity.
from infinity import inf
# Universal comparison
print(f"inf > 1000: {inf > 1000}")
print(f"inf < 1000: {inf < 1000}")
print(f"inf == float('inf'): {inf == float('inf')}")
# Compare with non-numeric types (unique feature of infinity.inf)
print(f"inf > 'hello': {inf > 'hello'}")
print(f"inf > []: {inf > []}")
print(f"inf > {'a': 1}: {inf > {'a': 1}}")
# Using negative infinity
neg_inf = -inf
print(f"neg_inf < -1000: {neg_inf < -1000}")
Upgrade
Version history
Breaking-change detection hasn't run for this library yet.
Audit
Security & dependencies
CVE tracking and dependency tree are planned for a later release.