maxminddb
Reader for the MaxMind DB format
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 on this page — 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
maxminddb on PyPI
pip
pip install maxminddbuv
uv add maxminddbpoetry
poetry add maxminddbInstalling 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 the current Python release (>=3.10) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 162 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 21,223,146/month — #1,007 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: maxminddb-3.1.1-cp310-cp310-macosx_10_9_universal2.whl; maxminddb-3.1.1-cp310-cp310-macosx_10_9_x86_64.whl; maxminddb-3.1.1-cp310-cp310-macosx_11_0_arm64.whl; maxminddb-3.1.1-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; maxminddb-3.1.1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; maxminddb-3.1.1-cp310-cp310-musllinux_1_2_aarch64.whl; maxminddb-3.1.1-cp310-cp310-musllinux_1_2_x86_64.whl; maxminddb-3.1.1-cp310-cp310-win32.whl; maxminddb-3.1.1-cp310-cp310-win_amd64.whl; maxminddb-3.1.1-cp310-cp310-win_arm64.whl; maxminddb-3.1.1-cp311-cp311-macosx_10_9_universal2.whl; maxminddb-3.1.1-cp311-cp311-macosx_10_9_x86_64.whl; maxminddb-3.1.1-cp311-cp311-macosx_11_0_arm64.whl; maxminddb-3.1.1-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; maxminddb-3.1.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; maxminddb-3.1.1-cp311-cp311-musllinux_1_2_aarch64.whl; maxminddb-3.1.1-cp311-cp311-musllinux_1_2_x86_64.whl; maxminddb-3.1.1-cp311-cp311-win32.whl; maxminddb-3.1.1-cp311-cp311-win_amd64.whl; maxminddb-3.1.1-cp311-cp311-win_arm64.whl
Tags
More Internet packages
Botocore provides low-level, data-driven access…
permissive · top 100 on PyPI
aiobotocoreProvides an async client for AWS services using…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
filelockProvides a platform-independent file locking…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
googleapis-common-protosProvides common Protocol Buffer message…
permissive · top 100 on PyPI
maxminddb-geolite2Provides geolocation lookups by IP address…
unclear · top 15,000 on PyPI
mmdb-writerGenerates MaxMind DB (MMDB) format files from…
permissive · top 15,000 on PyPI
geoip2fastGeoIP2Fast performs fast geolocation lookups…
permissive · top 15,000 on PyPI
minfraudPython client library for MaxMind's minFraud…
permissive · top 15,000 on PyPI
geoip2Queries MaxMind's GeoIP web services and…
permissive · top 5,000 on PyPI
geoip2-toolsAutomates downloading and updating of MaxMind…
permissive · top 15,000 on PyPI
IP2LocationLooks up geolocation data (country, region,…
permissive · top 15,000 on PyPI
types-maxminddbProvides type stubs for the maxminddb package,…
permissive · top 15,000 on PyPI
ip3countryLooks up the ISO 3166-1 alpha-2 country code…
permissive · top 5,000 on PyPI
ipwhoisRetrieves and parses whois and RDAP data for…
permissive · top 15,000 on PyPI