Registry / http-networking / ua-parser-rs

ua-parser-rs

JSON →
library0.1.5pypypiunverified

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.

pip install ua-parser-rs
INSTALL
IMPORT
SIG · UA-PARSER-RS
U
ua-parser-rs
http-networkingpythonv0.1.5
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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.

# ua-parser-rs is primarily an accelerator for the 'ua-parser' library. # Direct import of ua_parser_rs is not typically done or recommended. # To leverage the Rust acceleration, use the 'ua-parser' library: # Ensure 'ua-parser[regex]' is installed to utilize the Rust backend # pip install 'ua-parser[regex]' from ua_parser import parse ua_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' result = parse(ua_string) print(f"Browser: {result.user_agent.family} {result.user_agent.major}.{result.user_agent.minor}") print(f"OS: {result.os.family} {result.os.major}.{result.os.minor}") print(f"Device: {result.device.family}")
Debug
Known issues
breakingVersion 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.
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).
affects: >=0.1.4
gotchaThe `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.
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.
affects: All versions
Errors
Common errors & fixes
error: command 'cargo' failed with exit code 1
The Rust toolchain (specifically `cargo`) is not installed or not accessible in your system's PATH, which is required to compile the `ua-parser-rs` Rust extension during installation.
fix
Install Rustup, the official Rust toolchain installer, by following the instructions on `https://rustup.rs/`.
AttributeError: module 'ua_parser_rs' has no attribute 'parse'
The `ua-parser-rs` package is an internal Rust accelerator backend, not designed for direct function calls; its public interface is intended to be used by the `ua-parser` Python library.
fix
Use the `ua-parser` library, which automatically leverages `ua-parser-rs` if it's installed correctly:
```python
from ua_parser import user_agent_parser
ua_string = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36"
parsed_ua = user_agent_parser.Parse(ua_string)
print(parsed_ua)
```
ModuleNotFoundError: No module named 'ua_parser_rs'
The `ua-parser-rs` package or its compiled components were not successfully installed in the current Python environment, often due to underlying compilation issues during `pip install`.
fix
Ensure the Rust toolchain is installed (see the fix for the `cargo` error), then attempt to reinstall `ua-parser-rs`:
```bash
pip install ua-parser-rs
```
If installation issues persist, review the detailed output of the `pip install` command for more specific error messages.
Upgrade
Version history
0.1.5latest on PyPI · released Apr 5, 2026
Audit
Dependencies
pythonrequiredRequires Python 3.10 or newer due to abi3-py310 wheels.
Agent activity
22 hits · last 30 days
node
18
OpenAI (training)
1
Resources
ua-parser-rs — pip install ua-parser-rs · libregistry