Precompiled rules for User Agent Parser
raw JSON → 202603 verified Tue May 12 auth: no python install: draft
ua-parser-builtins provides a precompiled ruleset for the `ua-parser` library, aiming to decrease its initialization times. This package itself does not expose any API; it solely contains the data. The precompiled ruleset is released monthly, synchronized with the `uap-core` project's default branch. The current version is 202603, released March 2026.
pip install ua-parser-builtins Common errors
error ModuleNotFoundError: No module named 'ua_parser_builtins' ↓
cause The user attempted to import `ua_parser_builtins` directly, but this package is a data-only dependency for `ua-parser` and does not expose a public API for direct import and use.
fix
Ensure
ua-parser-builtins is installed (pip install ua-parser-builtins), then import and use ua-parser instead. The ua-parser library automatically leverages the builtins package if available.
# Incorrect attempt:
# import ua_parser_builtins
# ua_parser_builtins.parse('User-Agent string')
# Correct usage:
from ua_parser import user_agent_parser
result = user_agent_parser.Parse('User-Agent string') error AttributeError: module 'ua_parser_builtins' has no attribute 'Parse' ↓
cause The user incorrectly tried to call a parsing function directly on the `ua_parser_builtins` module, which is a data-only package and does not provide any callable API.
fix
Import and use the
ua-parser library for parsing functionality; it will automatically utilize ua-parser-builtins for faster initialization.
# Incorrect attempt:
# import ua_parser_builtins
# result = ua_parser_builtins.Parse('User-Agent string')
# Correct usage:
from ua_parser import user_agent_parser
result = user_agent_parser.Parse('User-Agent string') error ImportError: cannot import name 'user_agent_parser' from 'ua_parser_builtins' ↓
cause The user attempted to import a submodule or function (like `user_agent_parser`) directly from `ua_parser_builtins`, but this package is solely for data and does not expose any modules or functions for direct import.
fix
Import
user_agent_parser from the ua-parser library, which is the package that provides the parsing functionality. ua-parser will automatically use the data from ua-parser-builtins if it is installed.
# Incorrect attempt:
# from ua_parser_builtins import user_agent_parser
# result = user_agent_parser.Parse('User-Agent string')
# Correct usage:
from ua_parser import user_agent_parser
result = user_agent_parser.Parse('User-Agent string') Warnings
gotcha ua-parser-builtins has no direct API or functionality. It is purely a data package designed to be used by the 'ua-parser' library to speed up its initialization. Installing it alone will not provide user agent parsing capabilities. ↓
fix Always install 'ua-parser' (e.g., `pip install ua-parser ua-parser-builtins`) to utilize the provided data.
gotcha For optimal parsing performance, especially with high-volume user agent strings, consider installing 'ua-parser' with its optional 'regex' or 're2' dependencies. Even with 'ua-parser-builtins' reducing initialization time, the underlying parsing engine within 'ua-parser' affects speed. ↓
fix Install with `pip install 'ua-parser[regex]' ua-parser-builtins` or `pip install 'ua-parser[re2]' ua-parser-builtins`.
gotcha The versioning scheme for ua-parser-builtins is date-based (YYYYMM). This indicates a refresh of the underlying ruleset, but unlike semantic versioning, it doesn't directly signal API or functionality changes, as the package has no API. Users should be aware that frequent updates reflect new user-agent patterns. ↓
fix Keep `ua-parser-builtins` updated regularly (e.g., monthly) to ensure the `ua-parser` library benefits from the latest user agent detection rules.
breaking Installing 'ua-parser' (or its dependencies like 'ua-parser-rs') on Alpine Linux or similar minimal environments may fail due to missing build dependencies required by its underlying Rust component. Specifically, it requires a C compiler (providing 'libgcc_s.so.1') and the Rust toolchain, which are not included by default in minimal Python images. ↓
fix Before installing 'ua-parser', ensure the necessary build dependencies are installed in the environment. For Alpine Linux, this typically involves running `apk add build-base rust`.
Install
pip install 'ua-parser[regex]' ua-parser-builtins Install compatibility draft last tested: 2026-05-12 v0.18.0.post1 installed · v202605 latest
python os / libc variant status wheel install import disk mem side effects
3.10 alpine (musl) regex build_error - - - - - -
3.10 alpine (musl) regex - - - - - -
3.10 alpine (musl) ua-parser-builtins wheel - - 18.5M - broken
3.10 alpine (musl) ua-parser-builtins - - - - - -
3.10 slim (glibc) regex wheel 1.8s 0.04s 22M 2.4M clean
3.10 slim (glibc) regex - - 0.04s 22M 2.4M -
3.10 slim (glibc) ua-parser-builtins wheel 1.5s - 19M - broken
3.10 slim (glibc) ua-parser-builtins - - - - - -
3.11 alpine (musl) regex build_error - - - - - -
3.11 alpine (musl) regex - - - - - -
3.11 alpine (musl) ua-parser-builtins wheel - - 20.5M - broken
3.11 alpine (musl) ua-parser-builtins - - - - - -
3.11 slim (glibc) regex wheel 1.7s 0.09s 24M 2.5M clean
3.11 slim (glibc) regex - - 0.09s 24M 2.5M -
3.11 slim (glibc) ua-parser-builtins wheel 1.6s - 21M - broken
3.11 slim (glibc) ua-parser-builtins - - - - - -
3.12 alpine (musl) regex build_error - - - - - -
3.12 alpine (musl) regex - - - - - -
3.12 alpine (musl) ua-parser-builtins wheel - - 12.3M - broken
3.12 alpine (musl) ua-parser-builtins - - - - - -
3.12 slim (glibc) regex wheel 1.6s 0.09s 16M 2.4M clean
3.12 slim (glibc) regex - - 0.10s 16M 2.4M -
3.12 slim (glibc) ua-parser-builtins wheel 1.5s - 13M - broken
3.12 slim (glibc) ua-parser-builtins - - - - - -
3.13 alpine (musl) regex build_error - - - - - -
3.13 alpine (musl) regex - - - - - -
3.13 alpine (musl) ua-parser-builtins wheel - - 12.0M - broken
3.13 alpine (musl) ua-parser-builtins - - - - - -
3.13 slim (glibc) regex wheel 1.5s 0.08s 16M 2.4M clean
3.13 slim (glibc) regex - - 0.09s 16M 2.4M -
3.13 slim (glibc) ua-parser-builtins wheel 1.5s - 13M - broken
3.13 slim (glibc) ua-parser-builtins - - - - - -
3.9 alpine (musl) regex build_error - - - - - -
3.9 alpine (musl) regex - - - - - -
3.9 alpine (musl) ua-parser-builtins wheel - - 17.9M - broken
3.9 alpine (musl) ua-parser-builtins - - - - - -
3.9 slim (glibc) regex wheel 2.1s 0.05s 48M 2.4M clean
3.9 slim (glibc) regex - - 0.06s 48M 2.4M -
3.9 slim (glibc) ua-parser-builtins wheel 1.8s - 18M - broken
3.9 slim (glibc) ua-parser-builtins - - - - - -
Imports
- parse
from ua_parser import parse
Quickstart last tested: 2026-04-24
from ua_parser import parse
# ua-parser-builtins implicitly provides the data used by parse()
user_agent_string = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.104 Safari/537.36'
parsed_ua = parse(user_agent_string)
print(f"User Agent Family: {parsed_ua.user_agent.family}")
print(f"OS: {parsed_ua.os.family} {parsed_ua.os.major}.{parsed_ua.os.minor}")
print(f"Device Family: {parsed_ua.device.family}")