Registry / testing / mozinfo

mozinfo

JSON →
library1.2.3pypypi✓ verified 85d ago

mozinfo is a Python library designed to retrieve system information, primarily for use within Mozilla's testing infrastructure. It acts as a bridge to normalize diverse operating system and architecture details into a consistent set of values, such as 'os', 'version', 'bits', and 'processor'. The current version is 1.2.3, and it is actively maintained as part of the broader Mozilla ecosystem.

pip install mozinfo
INSTALL
IMPORT
SIG · MOZINFO
M
mozinfo
testingpythonv1.2.3
Install
1.8s avg
Import
104ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.2.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.102s · 18.1MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 1.8s · import 0.107s · 19MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

mozinfo
import mozinfo
The library is typically imported directly as a module to access its top-level attributes.

The quickstart demonstrates how to import the `mozinfo` module and access its primary system information attributes directly. It also shows how to retrieve all available information as a dictionary via `mozinfo.info`.

import mozinfo print(f"Operating System: {mozinfo.os}") print(f"OS Version: {mozinfo.version}") print(f"Architecture Bits: {mozinfo.bits}") print(f"Processor Type: {mozinfo.processor}") # Access all info as a dictionary print("\nAll mozinfo attributes:") for key, value in mozinfo.info.items(): print(f" {key}: {value}")
Debug
Known issues
gotchaThe `mozinfo.unknown` singleton, used when a value cannot be determined, evaluates as `False` in boolean contexts. This can lead to unexpected behavior if not explicitly checked for `mozinfo.unknown`.
fix
Explicitly check `if mozinfo.os is mozinfo.unknown:` or `if mozinfo.os == 'UNKNOWN':` instead of `if not mozinfo.os:` if differentiating between `None` and `UNKNOWN` is important.
affects: All versions
gotchaWhen not executed within a Mozilla build environment (i.e., where a `mozinfo.json` file is present in the object directory), some `mozinfo` attributes might return `mozinfo.unknown` or 'UNKNOWN'. The library's full capability is realized when used in its intended context.
fix
Ensure the test or script is run in a properly configured Mozilla build environment (`objdir`) if specific build-time information is expected. Alternatively, handle 'UNKNOWN' values gracefully in your code.
affects: All versions
Errors
Common errors & fixes
AttributeError: module 'mozinfo' has no attribute 'some_non_existent_attribute'
Attempting to access a system information attribute that `mozinfo` does not expose as a direct module-level variable.
fix
Refer to the documentation for available attributes (e.g., `os`, `version`, `bits`, `processor`). If you want to see all available keys, use `mozinfo.info.keys()`.
print(mozinfo.os) outputs 'UNKNOWN' even though my OS is clearly Windows/Linux/macOS.
The `mozinfo` library relies on detecting information from the environment, including potentially a `mozinfo.json` file generated during a Mozilla build. If this file isn't found or the environment isn't typical for Mozilla testing, certain attributes may default to `mozinfo.unknown` (string representation 'UNKNOWN').
fix
Understand that `mozinfo` provides a 'Mozilla-centric' view of system info. If you require general system information outside of a Mozilla build context, consider using standard Python modules like `platform` or `os` directly.
Upgrade
Version history
1.2.3latest on PyPI · released Jul 28, 2023
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
mozinfo — pip install mozinfo · libregistry