Skip to main content

PiHardwareInfo

image Python Version from PEP 621 TOML image

Get Raspberry Pi hardware info from /proc/cpuinfo and /sys/class/net/*

Try

run

curl -s https://raw.githubusercontent.com/rexzhang/pi-hardware-info/master/pi_hardware_info/__init__.py | python3

This one-liner depends on pi_hardware_info/__init__.py staying self-contained (no relative imports).

result

PiHardwareInfo(
 {'revision_code': '0x0',
 'model_type': <ModelType.RPI_3B_PLUS: 13>,
 'model_name': 'Raspberry Pi 3 Model B Plus Rev 1.3',
 'processor': <Processor.BCM2837: 2>,
 'memory': 1024,
 'manufacturer': <Manufacturer.SONY_UK: 0>,
 'revision': '1.3',
 'serial_number': '00000000d855943b',
 'mac_address': {'eth0': 'B8:27:EB:55:94:3B', 'wlan0': 'B8:27:EB:00:C1:6E'},
 'overvoltage': False,
 'otp_program': False,
 'otp_read': False}
)

Install

pip install PiHardwareInfo

Usage as library

from pi_hardware_info import ModelType, PiHardwareInfo

info = PiHardwareInfo()
if info.model_type == ModelType.MODEL_3B_PLUS:
    print('5G Wifi ready')

elif info.model_type == ModelType.MODEL_3B:
    print('only 2.4G Wifi')

Usage as tool

python -m pi_hardware_info

Note

  • For a memory size of "0/Other", the actual memory capacity can be determined from the rpi-sdram-size-gbit firmware parameter

History

0.8.0 - 20261019

  • Convert single module to package layout, add py.typed marker (PEP 561)
  • Downstream mypy users no longer need follow_untyped_imports
  • Drop Python 3.9/3.10 support; add Python 3.15 to the test matrix
  • Add full type hints; enable strict mypy checking for package and tests
  • Keep curl | python3, python -m pi_hardware_info, and direct-file execution working

0.7.0 - 20260805

  • Support RPI_500, RPI_CM0
  • Support memory size code:7(Other), output 0
  • Fix RPI_CM5_LITE
  • Fix .otp_program/.otp_program
  • Add more unittest
  • Add file pi-hardware-info.desktop for run in RPi GUI

0.6.1 - 20250225

  • Add, network interface MAC address info
  • Refactor

0.5.0 - 20250224

  • Add, Support to raspberry pi 5
  • Codebase modernization Updates
    • Drop py3.5 py3.6 py3.7 py3.8
    • Add type hints
    • Add unit test
    • Add pyproject.toml
    • Add pre-commit

0.4.0 - 20220810

  • Add, support Zero2W/400/CM4
  • Add, Overvoltage/OTP Program/OTP Read support

0.3.3 - 20190709

  • Support raspberry pi 4B
  • Rewrite some code

0.2.0 - 20190302

  • Add old style revision code support, support 1A/1B

0.1.0 - 20190301

  • First release

Alternative

Ref

Metadata

Release files for PiHardwareInfo 0.8.0

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

Source distribution (sdist)

Source distribution for PiHardwareInfo 0.8.0
File Size Uploaded
pihardwareinfo-0.8.0.tar.gz 5.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for PiHardwareInfo 0.8.0
File Interpreter ABI Platform
pihardwareinfo-0.8.0-py3-none-any.whl Python 3 none any Details

Total release size: 12.0 kB

Release files / pihardwareinfo-0.8.0.tar.gz

Download URL pihardwareinfo-0.8.0.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
cfeef3e008243784a5a32bea50d1d16d6d9e080b9ee27c798c9703a8471090cf
BLAKE2b-256 checksum
How to use checksums
110b95491d7eede94d3cac26436bb155a0a3066bb6cf464c6c5b90427b23306b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

Release files / pihardwareinfo-0.8.0-py3-none-any.whl

Download URL pihardwareinfo-0.8.0-py3-none-any.whl
Size 6.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5d189eac6b6f9ff3d495e2aff841f478548964b063c277f94fe6d874b077732f
BLAKE2b-256 checksum
How to use checksums
0d44a42441209e68218006eeeca06e17f2c87521d792e43eac847a00c5fdabfe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.8.0 This release

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

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