--- id: geoip2fast version: "1.2.2" license: MIT license_treatment: permissive maintenance: active --- # geoip2fast — GeoIP2Fast is the fastest GeoIP2 country/city/asn lookup library that supports IPv4 and IPv6. A search takes less than 0.00003 seconds. It has its own data file updated twice a week with Maxmind-Geolite2-CSV, supports IPv4/IPv6 and is Pure Python! License: permissive · Maintenance: active · Downloads: 214.7K/mo ## What it is and what it does GeoIP2Fast is a pure-Python geolocation library that maps IP addresses to geographic and network information using local binary data files. It loads Maxmind GeoLite2 data into memory and performs lookups via binary search on ordered IP ranges, returning country codes, city names, ASN names, and CIDR blocks for both IPv4 and IPv6 addresses. The library requires no external dependencies or network calls—only the Python file and a .dat.gz data file. The package ships with a small country-level IPv4 database, but city and IPv6 variants must be downloaded separately or generated from Maxmind CSV files using the included geoip2dat.py tool. Data files are updated twice weekly. The library supports Python 3.7 through 3.13 and PyPy3, runs on Linux, Windows, and macOS, and is designed for applications that need fast, offline geolocation without external service dependencies. Use it for: - Geoblock or route traffic based on IP country origin in web applications or APIs. - Enrich server logs or analytics with geolocation data without making external API calls. - Identify ASN and network ownership for security monitoring or abuse detection. - Resolve city-level location for user analytics or localization features in high-throughput services. - Generate test data using the random IP address generation functions for unit or integration tests. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. GeoIP2Fast performs fast geolocation lookups for IPv4 and IPv6 addresses, returning country codes, city names, ASN information, and CIDR blocks from a local binary data file. Yes, with conditions. Install if you need fast, offline IP geolocation and are willing to manage data file downloads separately. The library is actively maintained, has no dependencies, and supports current Python versions. High install friction (separate data file requirement) and the need to choose between country/city and IPv4/IPv6 variants make it less suitable for quick prototyping, but it is well-suited for production systems where speed and offline operation matter. ## Install pip install geoip2fast uv add geoip2fast poetry add geoip2fast ## Installing geoip2fast Before you install: Installation friction is high because the package requires a separate binary data file (.dat.gz) to function; the pip package includes only country-level IPv4 data, and city or IPv6variants must be downloaded separately or generated manually. The library itself has no runtime dependencies and is actively maintained. License in practice: MIT license is permissive; you may use, modify, and distribute this package freely in commercial and private projects with minimal restrictions. Quickstart: pip install geoip2fast from geoip2fast import GeoIP2Fast geo = GeoIP2Fast() result = geo.lookup('8.8.8.8') print(result) A .dat.gz data file must be present in the library directory or application directory; the default geoip2fast.dat.gz (country IPv4 only) is included, but city or IPv6 databases require separate download. Verify before relying: - Whether the lookup speed claim of 'less than 0.00003 seconds' is measured under realistic application conditions or in controlled benchmarks. - Compatibility and performance behavior under PyPy3 compared to CPython across different data file sizes. - Whether the reduced versions (geoip2fastmin.py, geoip2fastminified.py) are production-ready or still in testing. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: high - Maintenance: active - Downloads: 214.7K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags geoip lookup library, ip geolocation ipv4 ipv6, fast country city asn lookup, maxmind geolite2 local database, pure python geoip, offline ip location lookup, asn country city resolver, geolocation, offline-lookup, pure-python [View on SkillFed](https://skillfed.io/packages/geoip2fast) · [View on PyPI](https://pypi.org/project/geoip2fast/)