Precompiled rules for User Agent Parser

202603 · active · verified Sun Mar 29

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.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates the usage of the `ua-parser` library, which is the consumer of the precompiled rules provided by `ua-parser-builtins`. Installing `ua-parser-builtins` along with `ua-parser` will reduce the initialization time of the parser.

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}")

view raw JSON →