Skip to main content

cpumodel

A Python library to parse and return various attributes from the CPU string

It has only been tested on relatively modern AMD and Intel CPUs that are likely to still be in use, i.e. AMD Ryzen, AMD EPYC, Intel i-series, Intel Xeon E3/E5 and newer. Other CPUs may or may not produce useful output.

If you want to request support for an unsupported CPU or if you see a bug in the output, see the Contributing section.

Installation

pip install cpumodel

Usage

As a library

from cpumodel.cpumodel import get_cpu_model

info = get_cpu_model()

As a script

$ cpumodel
{'cpuVendor': 'AMD', 'cpuString': 'AMD Ryzen 7 5700G', 'cpuModel': 'Ryzen 7 5700G', 'cpuFamily': 'Ryzen 7', 'cpuGeneration': '5', 'cpuLetter': 'G'}

You can optionally supply a CPU string with -t or --test which will cause cpumodel to parse this CPU string rather than get the local system's CPU string. This is useful for testing the logic.

$ cpumodel -t "Intel(R) Xeon(R) Gold 6234 CPU @ 3.30GHz"
{'cpuVendor': 'Intel', 'cpuString': 'Intel Xeon Gold 6234', 'cpuModel': 'Xeon Gold 6234', 'cpuFamily': 'Xeon Gold', 'cpuGeneration': '6'}

Output

This library returns up to 6 values (it is possible for values to be None)

  • cpuVendor, the CPU vendor, e.g. Intel
  • cpuString, the full model string of the CPU, e.g. Intel Core i7-6700S
  • cpuModel, the shorter model name of the CPU, e.g. Core i7-6700S
  • cpuFamily, the concise family name of the CPU, e.g. Core i7
  • cpuGeneration, the numeric generation of the CPU, e.g. 6
  • cpuLetter, any trailing letter codes for this CPU, e.g. S

Examples

The best explanation of the data returned is probably by giving various examples.

cpuVendor cpuString cpuModel cpuFamily cpuGeneration cpuLetter
Intel Intel Xeon Platinum 8358 Xeon Platinum 8358 Xeon Platinum 8
Intel Intel Xeon Gold 6226R Xeon Gold 6226R Xeon Gold 6 R
Intel Intel Xeon E3-1220 v6 Xeon E3-1220 v6 Xeon E3 6
Intel Intel Celeron G1610 Celeron G1610 Celeron 1 G
Intel Intel Core i5-6500T Core i5-6500T Core i5 6 T
Intel Intel Core i9-9900K Core i9-9900K Core i9 9 K
Intel Intel Core i9-10900 Core i9-10900 Core i9 10
Intel 12th Gen Intel Core i7-1265U Core i7-1265U Core i7 12 U
Intel 12th Gen Intel Core i9-12900 Core i9-12900 Core i9 12
AMD AMD Ryzen 7 5700G Ryzen 7 5700G Ryzen 7 5 G
AMD AMD Ryzen 7 PRO 5850U Ryzen 7 PRO 5850U Ryzen 7 PRO 5 U
AMD AMD Ryzen 9 7950X Ryzen 9 7950X Ryzen 9 7 X
AMD AMD Ryzen Threadripper 3990X Ryzen Threadripper 3990X Ryzen Threadripper 3 X
AMD AMD Athlon 5350 APU Athlon 5350 APU Athlon 5
AMD AMD Opteron 6366 HE Opteron 6366 H Opteron 6366 H
AMD AMD EPYC 7551P EPYC 7551P EPYC 7 P

Contribution

If this library doesn't work properly on your CPU, it's probably because I've never tested on a CPU of that type.

Please open an issue, and describe what you would expect the output of this module to be, and include the output of this command:

grep 'model name' /proc/cpuinfo | sort -u

Metadata

Release files for cpumodel 0.0.4

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

Source distribution (sdist)

Source distribution for cpumodel 0.0.4
File Size Uploaded Provenance Actions
cpumodel-0.0.4.tar.gz 4.6 kB Without provenance Details for cpumodel-0.0.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cpumodel 0.0.4
File Interpreter ABI Platform Actions
cpumodel-0.0.4-py3-none-any.whl Python 3 none any Details for cpumodel-0.0.4-py3-none-any.whl

Total release size: 10.8 kB

Release files / cpumodel-0.0.4.tar.gz

Download URL cpumodel-0.0.4.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
7ef2f160d5f3136fe507922d128acdfcd940efa0025ee92fdc5c21d93a48e07a
BLAKE2b-256 checksum
How to use checksums
7ec170a644664286b3faa067066d8f53f134cbea7eb3a41398cbffeb0597d242
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.15.1 Linux/7.0.0-1017-azure

Release files / cpumodel-0.0.4-py3-none-any.whl

Download URL cpumodel-0.0.4-py3-none-any.whl
Size 6.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a2132e767448b1633ab33f4b9c690585ca02dc88445ab65a8f7079ea57956462
BLAKE2b-256 checksum
How to use checksums
2e0586a96678abde1faee25657410ebba86928e8dc2832ef6f2dfa8067eb8086
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.15.1 Linux/7.0.0-1017-azure

Security for cpumodel 0.0.4

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.

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