Skip to main content
Project generated with PyScaffold

python-cpuid

Call cpuid from Python code.

This module provides C bindings to call the cpuid instruction from Python code. Simply pass a MSR ID and the cpuid function will return the result as a tuple representing the eax, ebx, ecx and edx registers as integers.

from cpuid import cpuid

msr = 0x80000000    # example value
eax, ebx, ecx, edx = cpuid(msr)

CPU features

In addition to the raw cpuid functionality, this library provides helpers for commonly used CPUID registers.

from cpuid.features import prcessor_features, secure_encryption_info, vendor

vendor()   # returns the result of cpuid(0) as bytes, ex: b"GenuineIntel"
features = processor_features()    # A class with all the fields of cpuid(1)
secure_encryption_features = secure_encryption_info()   # AMD secure encryption features

Feel free to add more CPUID registers! You can find the specification in official Intel and AMD docs like this one: https://www.amd.com/system/files/TechDocs/24594.pdf.

Why?

Other projects already provide this functionality. To the best of our knowledge:

  • PyCPUID <https://github.com/ngnpope/pycpuid>_ is not compatible with Python 3. An open PR from 2015 proposes an upgrade.

  • cpuid.py looks fun, but ultimately is machine code injection. We wanted something more auditable.

Notes

We do not (yet) provide binary wheel distributions for this package, because of the added complexity of shipping compiled libraries for Linux. You will require GCC to compile the package for your system.

This project has been set up using PyScaffold 4.3. For details and usage information on PyScaffold see https://pyscaffold.org/.

Metadata

Release files for python-cpuid 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-cpuid 0.1.1
File Size Uploaded Provenance Actions
python_cpuid-0.1.1.tar.gz 21.3 kB Without provenance Details for python_cpuid-0.1.1.tar.gz

Release files / python_cpuid-0.1.1.tar.gz

Download URL python_cpuid-0.1.1.tar.gz
Size 21.3 kB
Tags Source
SHA-256 checksum
How to use checksums
092adf0d567a2ce068f10ff5b0b085b1be23cfa4ac5ac6890bc96b4f1539abbf
BLAKE2b-256 checksum
How to use checksums
237db96d5dd57557839fc54319d4e0cfdb508bafd7ac6702c60749df196a07ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.3

Security for python-cpuid 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page