Registry / serialization / py-deviceid

py-deviceid

JSON →
library0.1.1pypypi✓ verified 26d ago

A simple Python library (current version 0.1.1, released March 2025) designed to retrieve or generate a unique device ID for a system. It adheres to the DevDeviceId specification, offering a consistent identifier across various platforms. The project's release cadence appears to be infrequent.

pip install py-deviceid
INSTALL
IMPORT
SIG · PY-DEVICEID
P
py-deviceid
serializationpythonv0.1.1
Install
1.5s avg
Import
48ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.1.1 · 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.95 runs
installs and imports cleanly · install 0.0s · import 0.052s · 17.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.5s · import 0.044s · 18MB
16MB installed
● package 16MB
Code
Verified usage

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

get_device_id
from deviceid import get_device_id
from py_deviceid import get_device_id
The PyPI package name is 'py-deviceid', but the top-level module to import is 'deviceid'.

This quickstart demonstrates how to retrieve the unique device ID for the current system using the `get_device_id` function.

from deviceid import get_device_id device_id = get_device_id() print(f"Device ID: {device_id}")
Debug
Known issues
gotchaThe library provides a device ID based on the DevDeviceId specification. This may differ from other device identifiers (e.g., MAC addresses, hardware serials, or UUIDs generated by Python's `uuid` module) and might not align with user expectations if a different 'device ID' definition is assumed.
fix
Understand the 'DevDeviceId' specification or consider alternative methods if a different type of device identifier is required.
affects: 0.1.0 and later
gotchaAs of version 0.1.1, the library's development appears to be in an early stage with infrequent updates since its last release in March 2025. This could imply limited platform coverage, or potential for future API changes in later major versions, though none are explicitly documented as breaking in the current version.
fix
Review the GitHub repository for recent activity and consider pinning the package version to avoid unexpected changes if future updates occur.
affects: 0.1.0 and later
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'py_deviceid'
The Python interpreter cannot find the 'py_deviceid' module because the package is either not installed, or the import statement uses the package name (`py-deviceid`) instead of the actual module name (`deviceid`).
fix
First, ensure the library is installed: `pip install py-deviceid`. Then, correct the import statement to use the module name: `from deviceid import DeviceID`.
AttributeError: module 'deviceid' has no attribute 'get_device_id'
The `get_device_id` method is called directly on the `deviceid` module, but it is an instance method of the `DeviceID` class, meaning an object of the class must be instantiated first.
fix
Create an instance of the `DeviceID` class before calling its method: `from deviceid import DeviceID
device_id_instance = DeviceID()
device_id = device_id_instance.get_device_id()`
ImportError: cannot import name 'DeviceID' from 'deviceid' (most likely due to an invalid import)
This error typically occurs if a user tries to import a non-existent object or a misnamed class from the 'deviceid' module, or if there's a circular import or a corrupted installation.
fix
Verify the correct class name is `DeviceID` (with capital 'D' and 'ID'). If the name is correct, try reinstalling the package: `pip uninstall py-deviceid && pip install py-deviceid`. Ensure no local file is named `deviceid.py` that might be shadowing the installed package.
Upgrade
Version history
0.1.1latest on PyPI · released Mar 7, 2025
Audit
Dependencies

No dependency data recorded yet.

Agent activity
10 hits · last 30 days
node
8
Resources
py-deviceid — pip install py-deviceid · libregistry