{"id":21038,"library":"cidr-trie","title":"cidr-trie","description":"A Python library for storing and searching CIDR prefixes in a trie structure. It enables efficient longest-prefix matching of IP addresses against a set of CIDR blocks. The current version is 3.1.2. Release cadence is intermittent.","status":"active","version":"3.1.2","language":"python","source_language":"en","source_url":"https://github.com/Figglewatts/cidr-trie","tags":["cidr","trie","networking","ip","prefix-matching"],"install":[{"cmd":"pip install cidr-trie","lang":"bash","label":"Install"}],"dependencies":[],"imports":[{"wrong":"from cidr_trie import CidrTrie","symbol":"PatriciaTrie","correct":"from cidr_trie import PatriciaTrie"},{"symbol":"PatriciaNode","correct":"from cidr_trie import PatriciaNode"},{"symbol":"cidr_atoi","correct":"from cidr_trie import cidr_atoi"}],"quickstart":{"code":"from cidr_trie import CidrTrie, IpNetwork\n\ntrie = CidrTrie()\ntrie.insert(IpNetwork('10.0.0.0/8'))\ntrie.insert(IpNetwork('10.0.0.0/16'))\nresult = trie['10.0.0.5']\nprint(result)  # IpNetwork('10.0.0.0/16')","lang":"python","description":"Create a trie, insert CIDR prefixes, and perform longest-prefix matching."},"warnings":[{"fix":"Replace `trie.find_longest_prefix(ip)` with `trie[ip]`","message":"The method `find_longest_prefix` is deprecated since v3.0.0; use `trie[ip]` instead.","severity":"deprecated","affected_versions":">=3.0.0"},{"fix":"Replace `trie.no_prefix(ip)` with `try: result = trie[ip]; except KeyError: # handle missing`","message":"CidrTrie.no_prefix() was removed in v3.0.0. Use `trie[ip]` and catch KeyError or pre-check with `ip in trie`.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Use a threading lock when modifying the trie from multiple threads.","message":"CidrTrie is not threadsafe. Concurrent modifications may corrupt internal state.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"search_vec":"'3.1.2':37 'address':26 'block':32 'cadenc':39 'cidr':2,11,31,42 'cidr-tri':1 'current':34 'effici':19 'enabl':18 'intermitt':41 'ip':25,45 'librari':6 'longest':21 'longest-prefix':20 'match':23,48 'network':44 'prefix':12,22,47 'prefix-match':46 'python':5 'releas':38 'search':10 'set':29 'store':8 'structur':16 'trie':3,15,43 'version':35","created_at":"2026-04-27T16:57:45.600434+00:00","updated_at":"2026-04-27T16:57:45.600434+00:00","problems":null,"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"3.1.2","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/Figglewatts/cidr-trie","docs":null,"changelog":null,"pypi":"https://pypi.org/project/cidr-trie/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["http-networking","data"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-30","last_verified":"2026-06-30","next_check":"2026-07-30","install_tag":null}}