skillfed

maxminddb

Reader for the MaxMind DB format

maxminddb v3.1.1 21.2M downloads/30d#1,007 on PyPI225
Permissive license Apache-2.0 Active released

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 maxminddb

uv

uv add maxminddb

poetry

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 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

Development Status :: 5 - Production/StableEnvironment :: Web EnvironmentIntended Audience :: DevelopersIntended Audience :: System AdministratorsProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: InternetTopic :: Internet :: Proxy Servers

Tags

IP geolocation lookupMaxMind DB readerIP address database queriesGeoIP2 GeoLite2 readerIPv4 IPv6 geolocationbinary IP database format
geolocationip-lookup

More Internet packages