{"id":2837,"library":"ua-parser-rs","title":"User-Agent Parser (Rust Accelerated)","description":"ua-parser-rs is a Python package that provides a native Rust accelerator for user-agent string parsing. It is not intended for direct use, but rather serves as a high-performance backend for the `ua-parser` Python library. Currently at version 0.1.5, its releases are tied to the upstream `uap-rust` project, with semi-regular updates reflecting performance improvements and bug fixes in the core Rust library.","status":"active","version":"0.1.5","language":"en","source_language":"en","source_url":"https://github.com/ua-parser/uap-rust/blob/main/ua-parser/","tags":["user-agent","parser","rust","performance","accelerator","backend"],"install":[{"cmd":"pip install ua-parser-rs","lang":"bash","label":"Install ua-parser-rs (backend accelerator)"},{"cmd":"pip install 'ua-parser[regex]'","lang":"bash","label":"Install ua-parser (user-facing library with Rust acceleration)"}],"dependencies":[{"reason":"Requires Python 3.10 or newer due to abi3-py310 wheels.","package":"python","optional":false}],"imports":[],"quickstart":{"code":"# ua-parser-rs is primarily an accelerator for the 'ua-parser' library.\n# Direct import of ua_parser_rs is not typically done or recommended.\n# To leverage the Rust acceleration, use the 'ua-parser' library:\n\n# Ensure 'ua-parser[regex]' is installed to utilize the Rust backend\n# pip install 'ua-parser[regex]'\n\nfrom ua_parser import parse\n\nua_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'\n\nresult = parse(ua_string)\n\nprint(f\"Browser: {result.user_agent.family} {result.user_agent.major}.{result.user_agent.minor}\")\nprint(f\"OS: {result.os.family} {result.os.major}.{result.os.minor}\")\nprint(f\"Device: {result.device.family}\")\n","lang":"python","description":"This quickstart demonstrates how to use the `ua-parser` library, which internally utilizes `ua-parser-rs` for accelerated user-agent string parsing when installed with the `[regex]` extra. `ua-parser-rs` itself does not expose a direct Python API for end-users."},"warnings":[{"fix":"Upgrade to Python 3.10 or newer. For projects dependent on specific Python versions, pin `ua-parser-rs` to `<0.1.4` (though this is not recommended as it will prevent access to performance and bug fixes).","message":"Version 0.1.4 (and subsequent versions) removed support for Python versions older than 3.10. This is due to the adoption of abi3-py310 wheels and the end-of-life status of Python 3.9 and PyPy 3.10.","severity":"breaking","affected_versions":">=0.1.4"},{"fix":"Always interact with user-agent parsing functionality through the `ua-parser` library, ensuring `ua-parser-rs` is installed as a dependency (typically via `pip install 'ua-parser[regex]'`) to enable Rust acceleration.","message":"The `ua-parser-rs` package is designed as a native accelerator and is not intended for direct use. It provides the Rust backend for the `ua-parser` Python library. Its API is considered simplistic and lacks formal stability guarantees for direct consumer use.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-10T00:00:00.000Z","next_check":"2026-07-09T00:00:00.000Z"}