Platform detection for use by libraries like Adafruit-Blinka.
Project description
Introduction
This library provides best-guess platform detection for a range of single-board computers and (potentially) other platforms. It was written primarily for use in Adafruit_Blinka, but may be useful in other contexts.
Platform detection is divided into “chip” and “board” detection, with the latter generally dependent on the former. Platform info is gathered from:
Python’s sys.platform
The /proc/cpuinfo file on Linux systems (for processor info, Raspberry Pi hardware revisions, etc.)
Beaglebone EEPROM board IDs
Distribution-specific files such as /etc/armbian-release.
The API is currently unstable and may change drastically in future releases.
Installation
On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally from PyPI. To install for current user:
pip3 install Adafruit-PlatformDetect
To install system-wide (this may be required in some cases):
sudo pip3 install Adafruit-PlatformDetect
To install in a virtual environment in your current project:
mkdir project-name && cd project-name
python3 -m venv .env
source .env/bin/activate
pip3 install Adafruit-PlatformDetect
Usage
from adafruit_platformdetect import Detector
detector = Detector()
print("Chip id: ", detector.chip.id)
print("Board id: ", detector.board.id)
# Check for specific board models:
print("Pi 3B+? ", detector.board.RASPBERRY_PI_3B_PLUS)
print("BBB? ", detector.board.BEAGLEBONE_BLACK)
print("Orange Pi PC? ", detector.board.ORANGE_PI_PC)
print("generic Linux PC? ", detector.board.GENERIC_LINUX_PC)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for Adafruit-PlatformDetect-0.0.6.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8bfd93459d2137bd51c64ba9d386ff84f312cd00ae71ddd8f0259aaeb48b1a29 |
|
MD5 | eed36ae56dc6ebaf2dc7ecaee7eb2bad |
|
BLAKE2b-256 | 1060df46bb5cec6cfaa10ef4235b15539f804f52a5b16b632915fc98724a29e4 |