skillfed

cidr-trie

Store/search CIDR prefixes in a trie structure.

cidr-trie v3.1.2 91.2K downloads/30d#13,532 on PyPI10
Permissive license MIT Abandoned released

What it is and what it does

cidr-trie implements a Patricia trie (a space-efficient prefix tree) to store and query CIDR network blocks. You insert IP networks in CIDR notation along with arbitrary data, then query for all networks that contain a given IP address. It supports both IPv4 and IPv6 addresses and returns all matching prefixes from most specific to least specific.

The package has no external runtime dependencies and installs cleanly. However, it has been abandoned since mid-2019 with no active maintenance, so it receives no bug fixes, security updates, or compatibility improvements for newer Python versions. It remains stable for its intended use case if your Python environment is compatible.

Use it for:

  • Build a geolocation or ISP lookup table by storing CIDR blocks with associated metadata and querying IP addresses against it.
  • Implement IP-based access control lists by storing allowed or blocked CIDR ranges and checking incoming requests.
  • Organize network routing tables or firewall rules that need fast prefix matching on IP addresses.
  • Validate whether an IP address falls within a known set of CIDR ranges such as private networks.

Worth the install?

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

Stores and queries CIDR IP address blocks (IPv4 and IPv6) in a trie data structure for fast prefix matching and lookup.

Yes, if you need CIDR prefix matching and your Python environment is compatible. The package is stable, has no dependencies, and works for its core use case. However, verify Python version compatibility first (requires_python is unspecified), and be aware that no maintenance or updates are forthcoming—use it only if the existing codebase meets your needs without modification.

Install

cidr-trie on PyPI

pip

pip install cidr-trie

uv

uv add cidr-trie

poetry

poetry add cidr-trie

Installing cidr-trie

Before you install

Low friction installation with no runtime dependencies. However, the package is abandoned—last release was 2019-07-05 and last commit 2022-12-08, so no active maintenance or bug fixes should be expected.

License in practice

MIT license is permissive; you can use, modify, and distribute this package freely with minimal restrictions.

Quickstart

pip install cidr-trie

from cidr_trie import PatriciaTrie

trie = PatriciaTrie()
trie.insert("0.0.0.0/0", "Internet")
trie.insert("32.32.32.32/32", "example")
result = trie.find_all("32.32.32.32")
print([node.value for node in result])

Verify before relying

  • Whether the package works correctly with modern Python versions (requires_python is unspecified in the fact sheet)
  • Performance characteristics for large CIDR datasets or production-scale deployments
  • Any known issues or edge cases in the abandoned codebase that may affect reliability

Package facts

License MIT (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance abandoned — 2,597 days since the last release
Last repo commit
First released
Downloads 91,203/month — #13,532 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: cidr_trie-3.1.2-py3-none-any.whl

Keywords: cidr, ip, ipv4, ipv6, trie

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3 :: OnlyTopic :: InternetTopic :: Software Development :: Libraries :: Python Modules

Tags

CIDR IP address lookupIPv4 IPv6 trie storageIP prefix matchingnetwork address trieCIDR range queryIP network searchpatricia trie IP
ip-networkingdata-structures

More Python Modules packages