cidrtrie is a simplistic implementation of a prefix tree and a library for classifying IP addresses based on prefix matching. Unlike other implementations (such as [py-radix](http://www.mindrot.org/projects/py-radix/)), this is pure-Python and aims to be as simple as possible.
## Why? ## This implementation offers asymptotic performance improvement for problems that look like Internet routing.
bench.py contains a simple and used-elsewhere _O(n)_ implementation (”NaiveCidrClassifier) of this same functionalify. Some sample numbers for inserting 100,000 cidrs into the tree and then looking up 10,000 IPs on a 3GHz Intel i7-4578U:
insert CidrClassifier 5.16s insert NaiveCidrClassifier 0.11s lookup CidrClassifier 0.25s lookup NaiveCidrClassifier 92.11s
An example use case would be to efficiently map IP addresses (from logs or some other source) to the originating network (and, eventually, to the owner) without using a commercial library like MaxMind or bringing in any native-code dependencies.
Metadata
Release files for cidrtrie 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cidrtrie-0.1.tar.gz | 4.1 kB | Without provenance | Details for cidrtrie-0.1.tar.gz |
Release files / cidrtrie-0.1.tar.gz
| Download URL | cidrtrie-0.1.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3e9bb94eb0ff5587f8ea161c7bf3c9d1000fb1c833fd7f5993cc667ac2904b50
|
|
BLAKE2b-256 checksum How to use checksums |
7a497f5580a4984843923ca61f1a9db17aa98749b75497c5a2af09d9499c9d6e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for cidrtrie 0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.