skillfed

mmdb-writer

Make `mmdb` format ip library file which can be read by maxmind official language reader

mmdb-writer v0.2.7 534.1K downloads/30d#6,138 on PyPI42
Permissive license Active released

What it is and what it does

mmdb-writer is a Python library that creates MaxMind DB (MMDB) format files—the binary database format used by MaxMind's GeoIP and other IP-based lookup services. It takes IP networks (specified using netaddr's IPSet) and associates them with arbitrary data (country codes, ISP names, etc.), then writes them to a .mmdb file that can be read by MaxMind's official readers in any supported language.

The library handles MMDB's type system, which includes multiple integer and float types (int32, uint16, uint32, uint64, uint128, float, double). Since Python has only one integer and one float type, mmdb-writer lets you specify how integers should be encoded (auto-detection by value size, or explicit types like i32, u16, u32, u64, u128) and provides type wrappers (MmdbI32, MmdbF32) for fine-grained control. This is especially important when Java clients will read the resulting database, as Java's deserialization depends on correct MMDB type metadata.

Use it for:

  • Build a custom IP geolocation database by mapping IP ranges to country codes, cities, or ISP information.
  • Create a private IP-to-metadata lookup service for internal network management or security applications.
  • Convert CSV or other structured IP data sources into MMDB format for distribution to MaxMind reader clients.
  • Generate test MMDB files with specific IP ranges and data for unit testing geolocation-dependent code.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Generates MaxMind DB (MMDB) format files from IP networks and associated data, compatible with MaxMind's official language readers.

Yes, if you need to create or customize MMDB files in Python. The library is actively maintained, has low install friction, carries a permissive MIT license, and supports current Python versions (3.9–3.13). No known vulnerabilities. Consider the pure-Python performance baseline before committing to large-scale database generation; the Rust beta branch is available if speed becomes a bottleneck.

Install

mmdb-writer on PyPI

pip

pip install mmdb-writer

uv

uv add mmdb-writer

poetry

poetry add mmdb-writer

Installing mmdb-writer

Before you install

Low friction install with a single runtime dependency (netaddr). Active maintenance with recent releases; last commit 2026-06-01 and marked Production/Stable.

License in practice

MIT license (permissive) — you can use, modify, and distribute this package freely with minimal restrictions.

Quickstart

pip install mmdb_writer

from netaddr import IPSet
from mmdb_writer import MMDBWriter

writer = MMDBWriter()
writer.insert_network(IPSet(['1.1.0.0/24']), {'country': 'US'})
writer.to_db_file('output.mmdb')

Verify before relying

  • Whether the pure-Python version's performance is acceptable for your use case, given the Rust beta branch claims 6–8× speedup.
  • Compatibility guarantees with specific MaxMind reader versions across different languages.

Package facts

License not declared (permissive)
Python support supports the current Python release (>=3.9)
Install friction low — pure-Python wheel
Runtime dependencies 1 — netaddr
Maintenance actively maintained — 74 days since the last release
Last repo commit
First released
Downloads 534,139/month — #6,138 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: mmdb_writer-0.2.7-py3-none-any.whl

Keywords: mmdb, maxmind

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Build Tools

Tags

mmdb file generatormaxmind db writerip geolocation database creationcreate mmdb format filesip network data storage
ip-geolocationdatabase-generation

More Build Tools packages