--- id: maxminddb version: "3.1.1" license: Apache-2.0 license_treatment: permissive maintenance: active --- # maxminddb — Reader for the MaxMind DB format License: permissive · Maintenance: active · Downloads: 21.2M/mo ## What it is and what it does maxminddb is a Python reader for the MaxMind DB binary format, a file format designed to store geolocation and other data indexed by IP address subnets. The package provides a Reader interface that accepts a MaxMind DB file path and returns lookup results for IPv4 or IPv6 addresses. It offers multiple read modes—including memory-mapped access, in-memory loading, and file-based reading—and includes an optional C extension for performance; if compilation fails, the module automatically falls back to a pure Python implementation. Typical usage involves opening a database file (such as the free GeoLite2 databases from MaxMind), then calling get() or get_with_prefix_len() to retrieve data for a given IP address. The package also supports iteration over the entire database and is thread-safe for concurrent reads, including support for Python 3.13+ free-threading. Use it for: - Determine the country, city, or ASN of an incoming request by looking up its IP address in a GeoLite2 database. - Build IP-based access control or geofencing rules by querying MaxMind DB files in a web application. - Analyze traffic logs or network data by batch-looking up IP addresses against a MaxMind database. - Serve geolocation metadata to clients based on their IP, without external API calls. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Reads MaxMind DB files to look up geolocation and other data indexed by IP address, with both pure Python and optional C extension implementations. Yes. The package is production-stable, actively maintained, has no known vulnerabilities, supports current Python versions (3.10+), and is widely used (top 5000 on PyPI). Install friction is manageable due to graceful fallback from C extension to pure Python. Use it if you need to query MaxMind DB files locally. ## Install pip install maxminddb uv add maxminddb poetry add maxminddb ## Installing maxminddb Before you install: Medium install friction due to optional C extension compilation, but the package gracefully falls back to pure Python if the build fails. Active maintenance with recent releases and no known vulnerabilities. License in practice: Apache-2.0 permissive license allows use in commercial and open-source projects with minimal restrictions; attribution required. Quickstart: pip install maxminddb import maxminddb with maxminddb.open_database('GeoLite2-City.mmdb') as reader: result = reader.get('152.216.7.110') print(result) You must obtain a MaxMind DB file (e.g., GeoLite2 databases) and decompress it with gunzip before use. Verify before relying: - Performance characteristics and lookup speed compared to direct file I/O or other geolocation libraries. - Memory footprint when loading large databases into memory via Mode.MEMORY. ## Package facts - License: Apache-2.0 (permissive) - Python support: supports_current - Install friction: medium - Maintenance: active - Downloads: 21.2M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags IP geolocation lookup, MaxMind DB reader, IP address database queries, GeoIP2 GeoLite2 reader, IPv4 IPv6 geolocation, binary IP database format, geolocation, ip-lookup [View on SkillFed](https://skillfed.io/packages/maxminddb) · [View on PyPI](https://pypi.org/project/maxminddb/)