Registry / devops / archspec

archspec

JSON →
library0.2.6pypypi✓ verified 85d ago

Archspec is a Python library designed to provide a standard set of human-understandable labels for system architectures, primarily focusing on CPU microarchitectures. It offers APIs to detect, query, and compare different CPU types. The project originated from Spack and is under active development. The current version is 0.2.5. While it does not follow a strict release cadence, its update history, including a significant release in October 2024, indicates ongoing maintenance and development.

pip install archspec
INSTALL
IMPORT
SIG · ARCHSPEC
A
archspec
devopspythonv0.2.6
Install
1.5s avg
Import
61ms
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.2.6 · 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.057s · 18.4MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 1.5s · import 0.065s · 19MB
16MB installed
● package 16MB
Code
Verified usage

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

host
from archspec.cpu.detect import host
The `host` function is the primary way to detect the current CPU microarchitecture.
Microarchitecture
from archspec.cpu import Microarchitecture
Used to represent and interact with CPU microarchitecture objects.

This quickstart code snippet demonstrates how to detect the host CPU microarchitecture using `archspec.cpu.detect.host()` and print its name. It also includes basic error handling for unsupported architectures.

import archspec.cpu.detect try: host_cpu = archspec.cpu.detect.host() if host_cpu: print(f"Detected host CPU microarchitecture: {host_cpu.name}") # Example of accessing properties # print(f"Vendor: {host_cpu.vendor}") # print(f"Ancestors: {[a.name for a in host_cpu.ancestors]}") else: print("Could not detect host CPU microarchitecture.") print(f"Reason: {archspec.cpu.detect.why_not('native')}") except archspec.cpu.UnsupportedMicroarchitecture: print("Host microarchitecture is not recognized or supported by archspec.") except Exception as e: print(f"An unexpected error occurred: {e}")
Debug
Known issues
breakingThe naming scheme for Graviton chips changed in v0.2. Graviton is now named 'cortex_a72', Graviton2 is 'neoverse_n1', and 'neoverse_v1' was introduced instead of Graviton3.
fix
Update references to Graviton microarchitectures to use the new naming scheme (e.g., 'cortex_a72' instead of 'graviton').
affects: >=0.2.0
breakingSupport for Python 2.7 and Python 3.5 was dropped in v0.2.
fix
Ensure your environment uses Python 3.6 or newer.
affects: >=0.2.0
gotchaInstalling directly from the GitHub repository for development requires Poetry.
fix
For development, install Poetry (e.g., `curl -sSL https://install.python-poetry.org | python3 -`) then clone the repository and run `poetry install`. For general use, `pip install archspec` is sufficient.
affects: All versions (development)
Errors
Common errors & fixes
archspec.cpu.UnsupportedMicroarchitecture: Host microarchitecture is not supported.
The CPU microarchitecture of the host system could not be identified by Archspec, or it is not present in its internal database.
fix
This often occurs on newer or less common architectures. Check the `archspec.cpu.detect.why_not()` function for a more detailed reason. You might need to update Archspec to a newer version or contribute your architecture's data.
archspec.cpu.InvalidCompilerVersion: Invalid format for compiler version.
An incorrect or unparseable string was provided for a compiler version when querying optimization flags or similar features.
fix
Ensure that compiler versions are provided as dot-separated digits (e.g., '10.0.0' for GCC 10.0.0).
Upgrade
Version history
0.2.6latest on PyPI · released May 14, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
44 hits · last 30 days
node
36
OpenAI (training)
1
Resources
archspec — pip install archspec · libregistry