HardView - Python Hardware Information Module
HardView is a high-performance, cross-platform Python module that provides detailed hardware and system information in structured JSON format. It supports both Windows (via WMI) and Linux (via sysfs/proc), and now includes advanced storage/SMART info and real-time performance monitoring.
π Key Features
- π₯οΈ Comprehensive Hardware Data: BIOS, System, Baseboard, Chassis, CPU, RAM, Disks, Network.
- ποΈ Advanced Storage & SMART: Detailed disk, partition, and SMART attributes.
- π Performance Monitoring: Real-time and interval-based CPU, RAM, and system performance.
- π₯οΈ Cross-Platform: Works on Windows (WMI) and Linux (sysfs/proc).
- β‘ C Implementation: High performance native code.
- π Python Integration: Easy-to-use Python API.
- π§© Modular Design: Extensible and well-documented.
- π Structured Output: All results are returned as JSON strings or Python objects.
HardView Installation Guide
This document explains how to install the HardView library on supported platforms.
Supported Platforms
- Windows:
- 32-bit and 64-bit (x86, x86_64)
- Linux:
- 32-bit and 64-bit (x86, x86_64)
Installation Methods
1. Install from PyPI (Recommended)
The easiest way to install HardView is via pip from the Python Package Index (PyPI):
pip install hardview
This will automatically download the correct prebuilt wheel for your platform and Python version (if available).
2. Install from Source
If you want to build HardView yourself (for development or unsupported Python versions):
git clone https://github.com/yourusername/hardview.git
cd hardview
pip install .
This will build the extension from source using your system's compiler.
Python Version Compatibility
- HardView provides wheels for multiple Python versions (see PyPI for the list).
- If your Python version is not supported by a prebuilt wheel, you can build from source as above.
Other Distribution Channels
- Currently, HardView is only distributed via PyPI or from the official GitHub repository.
- No other download or package sources are supported.
Troubleshooting
- If you encounter issues during installation, please check your Python version and platform compatibility.
- For Windows, ensure you have a working C compiler (Visual Studio Build Tools recommended for source builds).
- For Linux, ensure you have Python development headers and a C compiler installed.
For more help, see the FAQ section or open an issue on the project's GitHub page.
β‘ HardView Benchmarks & Comparisons
This document presents feature comparisons and qualitative performance notes between HardView and other popular Python hardware/system info libraries.
1. π Why is HardView Faster?
- Written entirely in C and interacts directly with system APIs (WMI/Win32 on Windows, sysfs/proc on Linux).
- Competing libraries (e.g.,
psutil
,wmi
,py-cpuinfo
) are Python-based or wrappers, adding overhead. - Optimized for batch queries and returns all results as JSON strings or Python objects.
- Performs especially well with large or repeated hardware queries.
2. π Feature Coverage Comparison
Feature / Library | HardView | psutil | wmi (pywin32) | py-cpuinfo | platform | dmidecode (Linux) |
---|---|---|---|---|---|---|
BIOS Info | β | β | β | β | β | β |
System Info | β | β | β | β | β | β |
Baseboard Info | β | β | β | β | β | β |
Chassis Info | β | β | β | β | β | β |
CPU Info (detailed) | β | β | β | β | β | β |
GPU Info (detailed) | β | β | β | β | β | β |
RAM Info (modules) | β | β | β | β | β | β |
Disk Info (detailed) | β | β | β | β | β | β |
Partitions Info | β | β | β | β | β | β |
SMART/Advanced Storage | β | β | β | β | β | β |
Network Info (detailed) | β | β | β | β | β | β |
Real-time CPU Usage | β | β | β | β | β | β |
Real-time RAM Usage | β | β | β | β | β | β |
System Performance Monitor | β | β | β | β | β | β |
JSON Output | β | β | β | β | β | β |
Python Object Output | β | β | β | β | β | β |
Cross-Platform | β | β | Windows only | All | All | Linux only |
Native C Speed | β | β | β | β | β | β |
3. π Qualitative Performance Notes
- HardView is consistently faster due to its C backend and direct system access.
- Most operations complete in < 0.5s, some even in < 1 ms.
- HardView and dmidecode are the only tools providing full BIOS/baseboard/chassis info on Linux.
- Only HardView offers SMART data, detailed GPU info, and real-time monitoring in one API.
- Supports both JSON and Python objects, making it easy to integrate.
4. β When to Use HardView?
Use HardView if:
- You need detailed and accurate hardware info (BIOS, SMART, GPU, etc.).
- You require fast queries and native C speed.
- You want real-time performance monitoring.
- You prefer structured JSON or Python object outputs.
- You want a single cross-platform solution for both Windows and Linux.
5. π See Also
- What.md: Full API and output examples
β HardView Frequently Asked Questions (FAQ)
This FAQ addresses common issues and questions about installing, using, and troubleshooting the HardView library.
Q1: pip install
fails or cannot find a suitable wheel
A:
- Ensure you are using a supported platform (Windows 32/64-bit or Linux x86/x86_64).
- Make sure your Python version is supported (check PyPI).
- Upgrade pip to the latest version:
pip install --upgrade pip
- If no wheel is available for your platform, try building from source (see INSTALL.md).
Q2: HardView does not work after installation
A:
- Confirm that your system architecture (32/64-bit) matches the installed wheel.
- Ensure you have the latest version of HardView.
- Unsupported platforms like Arch, Android, or macOS are not supported.
- Try reinstalling:
pip uninstall hardview
pip install hardview
Q3: ImportError
or cannot import HardView
A:
- Verify that the binary file is named exactly
HardView.pyd
orHardView.so
(uppercase H and V). - Upgrade to HardView >= 0.1.0 to fix import issues.
- Use correct casing in your import statement:
import HardView
Q4: Output data is missing or not displayed correctly
A:
- HardView can return JSON strings or native Python objects.
- For JSON:
import json
import HardView
data = json.loads(HardView.get_cpu_info(True))
print(data)
- For Python objects:
import HardView
data_obj = HardView.get_cpu_info_objects(False)
print(data_obj)
- If the output includes
{ "error": ... }
, check the message for details.
Q5: Does HardView support Linux, macOS, or other platforms?
A:
- HardView supports Windows (32/64-bit) and Linux (x86/x86_64) only.
- Not supported on Arch, Android, or macOS.
Q6: Which Python versions are supported?
A:
- See PyPI for available wheels.
- If your version is not listed, try building from source.
Q7: How do I get help or report a bug?
A:
- Check
docs/
first (especiallyWhat.md
). - If your issue persists, open a GitHub issue with OS, Python version, and error logs.
Q8: Is HardView thread-safe?
A:
- No. If used in multi-threaded code, ensure calls are serialized or GIL-protected.
Q9: How can I contribute to HardView?
A:
- See
CONTRIBUTING.md
or mainREADME.md
. - Pull requests and bug reports are welcome!
Q10: Why is HardView faster than other Python libraries?
A:
- It's written entirely in C and communicates directly with system APIs β minimal overhead.
Q11: How do I monitor hardware performance over time?
A:
- Use functions like
monitor_cpu_usage_duration(duration, interval)
. - Both JSON and Python object formats are available.
- Examples are in
docs/What.md
.
Q12: Can I use HardView in a virtual environment?
A:
- Yes. HardView works with standard virtual environments like
virtualenv
andvenv
.
For more details, check the full documentation in docs/
or open an issue if your question isnβt listed.
π Changelog
All notable changes to this project will be documented in this file.
[3.0.1] - Hotfix Release
- Fixed packaging issues that caused PyPI upload failures in version
3.0.0
. - Fix RECORD file missing error in pypi wheels.
- No changes to functionality or API.
[3.0.0] - Major Release
- Structural Change for Output:
- The library now supports returning data as native Python objects in addition to JSON strings.
- New
_objects
functions:- For each JSON-returning function, a corresponding
_objects
version has been added (e.g.,get_bios_info_objects()
).
- For each JSON-returning function, a corresponding
- GPU Information Support:
- New functions introduced:
get_gpu_info()
: GPU info as JSONget_gpu_info_objects()
: GPU info as Python objects
[2.0.3] - Hotfix Release
- Fixed
get_smart_info()
inconsistency:- Resolved an issue where the function occasionally returned zero for disk sectors, cylinders, and tracks.
- Ensured consistent and accurate SMART data retrieval.
- No functional/API changes.
[2.0.2] - Hotfix Release
- Fixed Typo in Output Binary Name:
- Resolved an issue where the output binary had inconsistent casing.
- Output is now consistently named
HardView.pyd
orHardView.so
.
- No functional/API changes.
[2.0.1] - Hotfix Release
- Critical JSON Serialization Fix:
- Fixed improper escaping of backslashes (
\
) in SMART disk JSON output. - Output is now fully JSON-compliant.
- Fixed improper escaping of backslashes (
- No other functional or API changes.
[2.0.0] - Major Release
- Refactor:
- Each function moved to a separate C source file.
- Improved memory safety and leak prevention.
- New Advanced Features:
get_partitions_info()
get_smart_info()
get_cpu_usage()
get_ram_usage()
get_system_performance()
monitor_cpu_usage(duration, interval)
monitor_ram_usage(duration, interval)
monitor_system_performance(duration, interval)
[1.1.2]
- Fixed several memory leak issues.
- No feature changes.
[1.0.0] - First Stable Release
- Initial stable release with all core features from
0.1.0
. - Improved import experience: binary is now
HardView.pyd
/HardView.so
.
[0.1.0] - Initial Release
get_bios_info()
get_system_info()
get_baseboard_info()
get_chassis_info()
get_cpu_info()
get_ram_info()
get_disk_info()
get_network_info()
get_partitions_info()
HardView Library Functions Guide
This document explains all functions in the HardView library, what they return, and how to use them from Python with example outputs.
Note: To see all functions working together in practice, refer to the test.py
file included in the project.
Table of Contents
- BIOS Info
- System Info
- Baseboard Info
- Chassis Info
- CPU Info
- RAM Info
- Disk Drives Info
- Network Adapters Info
- Partitions Info (Advanced Storage)
- SMART/Disk Info (Advanced)
- GPU Info
- Current Performance
- Performance Monitoring
- General Notes
- Quick Test
1. BIOS Info
C Function: get_bios_info(bool Json)
Python Functions:
HardView.get_bios_info(Json=True)
: Returns a JSON stringHardView.get_bios_info_objects(Json=False)
: Returns a Python object
Description:
BIOS information such as vendor, version, and release date.
Usage (JSON):
import HardView
import json
bios_json_str = HardView.get_bios_info(True) # Or HardView.get_bios_info()
bios_data = json.loads(bios_json_str)
print(bios_data)
Example JSON Output:
{
"manufacturer": "ACME Corp.",
"version": "1.0.0.1",
"release_date": "20230101000000.000000+000"
}
Usage (Python Object):
import HardView
bios_obj = HardView.get_bios_info_objects(False) # Or HardView.get_bios_info_objects()
print(bios_obj)
Example Python Object Output:
{
'manufacturer': 'ACME Corp.',
'version': '1.0.0.1',
'release_date': '20230101000000.000000+000'
}
Properties / JSON Keys:
- manufacturer (string): The name of the BIOS manufacturer
- version (string): The BIOS version
- release_date (string): The BIOS release date
2. System Info
C Function: get_system_info(bool Json)
Python Functions:
HardView.get_system_info(Json=True)
: Returns a JSON stringHardView.get_system_info_objects(Json=False)
: Returns a Python object
Description:
System information such as manufacturer, product name, UUID, and serial number.
Usage (JSON):
import HardView
import json
system_json_str = HardView.get_system_info(True) # Or HardView.get_system_info()
system_data = json.loads(system_json_str)
print(system_data)
Example JSON Output:
{
"manufacturer": "ExampleTech",
"product_name": "ProSystem X1",
"uuid": "A1B2C3D4-E5F6-7890-1234-567890ABCDEF",
"serial_number": "SN1234567890"
}
Usage (Python Object):
import HardView
system_obj = HardView.get_system_info_objects(False) # Or HardView.get_system_info_objects()
print(system_obj)
Example Python Object Output:
{
'manufacturer': 'ExampleTech',
'product_name': 'ProSystem X1',
'uuid': 'A1B2C3D4-E5F6-7890-1234-567890ABCDEF',
'serial_number': 'SN1234567890'
}
Properties / JSON Keys:
- manufacturer (string): The system manufacturer's name
- product_name (string): The system product name
- uuid (string): The system's UUID
- serial_number (string): The system's serial number
3. Baseboard Info
C Function: get_baseboard_info(bool Json)
Python Functions:
HardView.get_baseboard_info(Json=True)
: Returns a JSON stringHardView.get_baseboard_info_objects(Json=False)
: Returns a Python object
Description:
Motherboard information such as manufacturer, product, serial number, and version.
Usage (JSON):
import HardView
import json
baseboard_json_str = HardView.get_baseboard_info(True) # Or HardView.get_baseboard_info()
baseboard_data = json.loads(baseboard_json_str)
print(baseboard_data)
Example JSON Output:
{
"manufacturer": "MegaBoard Inc.",
"product": "MB-Z999",
"serial_number": "MB1234567890XYZ",
"version": "1.0"
}
Usage (Python Object):
import HardView
baseboard_obj = HardView.get_baseboard_info_objects(False) # Or HardView.get_baseboard_info_objects()
print(baseboard_obj)
Example Python Object Output:
{
'manufacturer': 'MegaBoard Inc.',
'product': 'MB-Z999',
'serial_number': 'MB1234567890XYZ',
'version': '1.0'
}
Properties / JSON Keys:
- manufacturer (string): The motherboard manufacturer's name
- product (string): The motherboard product name
- serial_number (string): The motherboard serial number
- version (string): The motherboard version
4. Chassis Info
C Function: get_chassis_info(bool Json)
Python Functions:
HardView.get_chassis_info(Json=True)
: Returns a JSON stringHardView.get_chassis_info_objects(Json=False)
: Returns a Python object
Description:
Computer chassis/case information such as manufacturer, model, serial number, and type.
Usage (JSON):
import HardView
import json
chassis_json_str = HardView.get_chassis_info(True) # Or HardView.get_chassis_info()
chassis_data = json.loads(chassis_json_str)
print(chassis_data)
Example JSON Output:
{
"manufacturer": "CaseWorks",
"model": "TowerMax 5000",
"serial_number": "CHAS987654321",
"chassis_type": "Tower"
}
Usage (Python Object):
import HardView
chassis_obj = HardView.get_chassis_info_objects(False) # Or HardView.get_chassis_info_objects()
print(chassis_obj)
Example Python Object Output:
{
'manufacturer': 'CaseWorks',
'model': 'TowerMax 5000',
'serial_number': 'CHAS987654321',
'chassis_type': 'Tower'
}
Properties / JSON Keys:
- manufacturer (string): The chassis manufacturer's name
- model (string): The chassis model
- serial_number (string): The chassis serial number
- chassis_type (string): The type of chassis (e.g., "Tower", "Laptop")
5. CPU Info
C Function: get_cpu_info(bool Json)
Python Functions:
HardView.get_cpu_info(Json=True)
: Returns a JSON stringHardView.get_cpu_info_objects(Json=False)
: Returns a Python object
Description:
Processor details such as name, manufacturer, architecture, number of cores, number of threads, max clock speed, and socket designation.
Usage (JSON):
import HardView
import json
cpu_json_str = HardView.get_cpu_info(True) # Or HardView.get_cpu_info()
cpu_data = json.loads(cpu_json_str)
print(cpu_data)
Example JSON Output:
{
"name": "Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz",
"manufacturer": "GenuineIntel",
"architecture": "9", // 9 = Γ64
"cores": 8,
"threads": 8,
"max_clock_speed": 4900,
"socket_designation": "LGA1151"
}
Usage (Python Object):
import HardView
cpu_obj = HardView.get_cpu_info_objects(False) # Or HardView.get_cpu_info_objects()
print(cpu_obj)
Example Python Object Output:
{
'name': 'Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz',
'manufacturer': 'GenuineIntel',
'architecture': '9',
'cores': 8,
'threads': 8,
'max_clock_speed': 4900.0,
'socket_designation': 'LGA1151'
}
Properties / JSON Keys:
- name (string): The CPU name
- manufacturer (string): The CPU manufacturer
- architecture (string): The CPU architecture
- cores (integer): The number of physical cores
- threads (integer): The number of logical threads
- max_clock_speed (float): The maximum clock speed of the CPU in MHz
- socket_designation (string): The CPU socket designation
6. RAM Info
C Function: get_ram_info(bool Json)
Python Functions:
HardView.get_ram_info(Json=True)
: Returns a JSON stringHardView.get_ram_info_objects(Json=False)
: Returns a Python object
Description:
Total physical memory and details of individual memory modules.
Usage (JSON):
import HardView
import json
ram_json_str = HardView.get_ram_info(True) # Or HardView.get_ram_info()
ram_data = json.loads(ram_json_str)
print(ram_data)
Example JSON Output:
{
"total_physical_memory_bytes": 17179869184,
"memory_modules": [
{
"capacity_bytes": 8589934592,
"speed_mhz": 3200,
"manufacturer": "Kingston",
"serial_number": "ABCDEF12",
"part_number": "KF432C16BB/8"
},
{
"capacity_bytes": 8589934592,
"speed_mhz": 3200,
"manufacturer": "Kingston",
"serial_number": "GHIJKL34",
"part_number": "KF432C16BB/8"
}
]
}
Usage (Python Object):
import HardView
ram_obj = HardView.get_ram_info_objects(False) # Or HardView.get_ram_info_objects()
print(ram_obj)
Example Python Object Output:
{
'total_physical_memory_bytes': 17179869184,
'memory_modules': [
{
'capacity_bytes': 8589934592,
'speed_mhz': 3200,
'manufacturer': 'Kingston',
'serial_number': 'ABCDEF12',
'part_number': 'KF432C16BB/8'
},
{
'capacity_bytes': 8589934592,
'speed_mhz': 3200,
'manufacturer': 'Kingston',
'serial_number': 'GHIJKL34',
'part_number': 'KF432C16BB/8'
}
]
}
Properties / JSON Keys:
- total_physical_memory_bytes (integer): Total physical memory size in bytes
- memory_modules (list): A list of individual memory modules, each containing:
- capacity_bytes (integer): Module capacity in bytes
- speed_mhz (integer): Module speed in MHz
- manufacturer (string): Module manufacturer
- serial_number (string): Module serial number
- part_number (string): Module part number
7. Disk Drives Info
C Function: get_disk_info(bool Json)
Python Functions:
HardView.get_disk_info(Json=True)
: Returns a JSON stringHardView.get_disk_info_objects(Json=False)
: Returns a Python object
Description:
Information about installed disk drives, including model, manufacturer, interface type, size, serial number, and media type.
Usage (JSON):
import HardView
import json
disk_json_str = HardView.get_disk_info(True) # Or HardView.get_disk_info()
disk_data = json.loads(disk_json_str)
print(disk_data)
Example JSON Output:
{
"disks": [
{
"model": "NVMe SSD 1TB",
"manufacturer": "SSDCorp",
"interface_type": "NVMe",
"size": 1000204886016,
"serial_number": "SSD123456789",
"media_type": "Solid State Drive"
}
]
}
Usage (Python Object):
import HardView
disk_obj = HardView.get_disk_info_objects(False) # Or HardView.get_disk_info_objects()
print(disk_obj)
Example Python Object Output:
[
{
'model': 'NVMe SSD 1TB',
'manufacturer': 'SSDCorp',
'interface_type': 'NVMe',
'size': 1000204886016,
'serial_number': 'SSD123456789',
'media_type': 'Solid State Drive'
}
]
Properties / JSON Keys (for each disk):
- model (string): The disk model
- manufacturer (string): The disk manufacturer
- interface_type (string): The disk interface type (e.g., "IDE", "SCSI", "SATA", "NVMe")
- size (integer): The disk size in bytes
- serial_number (string): The disk serial number
- media_type (string): The disk media type (e.g., "Fixed hard disk media", "Solid State Drive")
8. Network Adapters Info
C Function: get_network_info(bool Json)
Python Functions:
HardView.get_network_info(Json=True)
: Returns a JSON stringHardView.get_network_info_objects(Json=False)
: Returns a Python object
Description:
Information about network adapters, including description, MAC address, IP addresses (IPv4 and IPv6), and DNS hostname.
Usage (JSON):
import HardView
import json
net_json_str = HardView.get_network_info(True) # Or HardView.get_network_info()
net_data = json.loads(net_json_str)
print(net_data)
Example JSON Output:
{
"network_adapters": [
{
"description": "Gigabit Ethernet Adapter",
"mac_address": "00:1A:2B:3C:4D:5E",
"ip_addresses": [
"192.168.1.100",
"fe80::1234:5678:9abc:def0"
],
"dns_host_name": "MY-PC-NAME"
}
]
}
Usage (Python Object):
import HardView
net_obj = HardView.get_network_info_objects(False) # Or HardView.get_network_info_objects()
print(net_obj)
Example Python Object Output:
[
{
'description': 'Gigabit Ethernet Adapter',
'mac_address': '00:1A:2B:3C:4D:5E',
'ip_addresses': ['192.168.1.100', 'fe80::1234:5678:9abc:def0'],
'dns_host_name': 'MY-PC-NAME'
}
]
Properties / JSON Keys (for each adapter):
- description (string): The adapter description
- mac_address (string): The adapter's MAC address
- ip_addresses (list): A list of IP addresses (IPv4 and IPv6) assigned to the adapter
- dns_host_name (string): The DNS hostname associated with the adapter
9. Partitions Info (Advanced Storage)
C Function: get_partitions_info(bool Json)
Python Functions:
HardView.get_partitions_info(Json=True)
: Returns a JSON stringHardView.get_partitions_info_objects(Json=False)
: Returns a Python object
Description:
Detailed information about disk partitions, including disk model, serial number, interface type, disk size, media type, partition device ID, partition type, partition size, and partition index.
Usage (JSON):
import HardView
import json
parts_json_str = HardView.get_partitions_info(True) # Or HardView.get_partitions_info()
parts_data = json.loads(parts_json_str)
print(parts_data)
Example JSON Output:
{
"partitions": [
{
"disk_model": "NVMe SSD 1TB",
"disk_serial": "SSD123456789",
"disk_interface": "NVMe",
"disk_size": 1000204886016,
"disk_media": "Solid State Drive",
"partition_device_id": "Disk #0, Partition #0",
"partition_type": "NTFS",
"partition_size": 500000000000,
"partition_index": 0
}
]
}
Usage (Python Object):
import HardView
parts_obj = HardView.get_partitions_info_objects(False) # Or HardView.get_partitions_info_objects()
print(parts_obj)
Example Python Object Output:
[
{
'disk_model': 'NVMe SSD 1TB',
'disk_serial': 'SSD123456789',
'disk_interface': 'NVMe',
'disk_size': 1000204886016,
'disk_media': 'Solid State Drive',
'partition_device_id': 'Disk #0, Partition #0',
'partition_type': 'NTFS',
'partition_size': 500000000000,
'partition_index': 0
}
]
Properties / JSON Keys (for each partition):
- disk_model (string): The model of the disk the partition belongs to
- disk_serial (string): The serial number of the disk the partition belongs to
- disk_interface (string): The interface type of the disk
- disk_size (integer): The total size of the disk in bytes
- disk_media (string): The media type of the disk
- partition_device_id (string): The device ID of the partition
- partition_type (string): The file system type of the partition
- partition_size (integer): The size of the partition in bytes
- partition_index (integer): The index of the partition on the disk
10. SMART/Disk Info (Advanced)
C Function: get_smart_info(bool Json)
Python Functions:
HardView.get_smart_info(Json=True)
: Returns a JSON stringHardView.get_smart_info_objects(Json=False)
: Returns a Python object
Description:
Detailed disk drive information, including SMART status, device IDs, firmware revision, and sector/track information.
Usage (JSON):
import HardView
import json
smart_json_str = HardView.get_smart_info(True) # Or HardView.get_smart_info()
smart_data = json.loads(smart_json_str)
print(smart_data)
Example JSON Output:
{
"disks": [
{
"model": "NVMe SSD 1TB",
"serial_number": "SSD123456789",
"interface_type": "NVMe",
"size": "1000204886016",
"partitions": 2,
"manufacturer": "SSDCorp",
"media_type": "Solid State Drive",
"status": "OK",
"device_id": "\\\\.\\PHYSICALDRIVE0",
"caption": "NVMe SSD 1TB",
"firmware_revision": "FW1.0",
"pnp_device_id": "NVME\\SSD&VEN_1234&PROD_5678\\1&234567&0&000000",
"sectors_per_track": 63,
"total_cylinders": 0,
"total_heads": 255,
"total_sectors": 0,
"total_tracks": 0,
"tracks_per_cylinder": 255,
"bytes_per_sector": 512,
"index": 0,
"signature": 1234567890
}
]
}
Usage (Python Object):
import HardView
smart_obj = HardView.get_smart_info_objects(False) # Or HardView.get_smart_info_objects()
print(smart_obj)
Example Python Object Output:
[
{
'model': 'NVMe SSD 1TB',
'serial_number': 'SSD123456789',
'interface_type': 'NVMe',
'size': '1000204886016',
'partitions': 2,
'manufacturer': 'SSDCorp',
'media_type': 'Solid State Drive',
'status': 'OK',
'device_id': '\\\\.\\PHYSICALDRIVE0',
'caption': 'NVMe SSD 1TB',
'firmware_revision': 'FW1.0',
'pnp_device_id': 'NVME\\SSD&VEN_1234&PROD_5678\\1&234567&0&000000',
'sectors_per_track': 63,
'total_cylinders': 0,
'total_heads': 255,
'total_sectors': 0,
'total_tracks': 0,
'tracks_per_cylinder': 255,
'bytes_per_sector': 512,
'index': 0,
'signature': 1234567890
}
]
Properties / JSON Keys (for each disk):
- model (string): The disk model
- serial_number (string): The disk serial number
- interface_type (string): The disk interface type
- size (string): The disk size in bytes
- partitions (integer): The number of partitions on the disk
- manufacturer (string): The disk manufacturer
- media_type (string): The disk media type
- status (string): The disk status (e.g., "OK")
- device_id (string): The device ID of the disk
- caption (string): A description of the disk
- firmware_revision (string): The firmware revision of the disk
- pnp_device_id (string): The PnP device ID
- sectors_per_track (integer): The number of sectors per track
- total_cylinders (integer): The total number of cylinders
- total_heads (integer): The total number of heads
- total_sectors (integer): The total number of sectors
- total_tracks (integer): The total number of tracks
- tracks_per_cylinder (integer): The number of tracks per cylinder
- bytes_per_sector (integer): The number of bytes per sector
- index (integer): The disk index
- signature (integer): The disk signature
11. GPU Info
C Function: get_gpu_info(bool Json)
Python Functions:
HardView.get_gpu_info(Json=True)
: Returns a JSON stringHardView.get_gpu_info_objects(Json=False)
: Returns a Python object
Description:
GPU details such as name, manufacturer, driver version, memory size, video processor, and video mode description.
Usage (JSON):
import HardView
import json
gpu_json_str = HardView.get_gpu_info(True) # Or HardView.get_gpu_info()
gpu_data = json.loads(gpu_json_str)
print(gpu_data)
Example JSON Output:
{
"gpus": [
{
"name": "NVIDIA GeForce RTX 3080",
"manufacturer": "NVIDIA",
"driver_version": "536.99",
"memory_size": 10737418240,
"video_processor": "GeForce RTX 3080",
"video_mode_description": "2560 x 1440 x 16777216 colors"
}
]
}
Usage (Python Object):
import HardView
gpu_obj = HardView.get_gpu_info_objects(False) # Or HardView.get_gpu_info_objects()
print(gpu_obj)
Example Python Object Output:
[
{
'name': 'NVIDIA GeForce RTX 3080',
'manufacturer': 'NVIDIA',
'driver_version': '536.99',
'memory_size': 10737418240,
'video_processor': 'GeForce RTX 3080',
'video_mode_description': '2560 x 1440 x 16777216 colors'
}
]
Properties / JSON Keys (for each GPU):
- name (string): The GPU name
- manufacturer (string): The GPU manufacturer
- driver_version (string): The GPU driver version
- memory_size (integer): The GPU memory size in bytes
- video_processor (string): The video processor
- video_mode_description (string): The current video mode description
12. Current Performance
a. CPU Usage
C Function: get_cpu_usage(bool Json)
Python Functions:
HardView.get_cpu_usage(Json=True)
: Returns a JSON stringHardView.get_cpu_usage_objects(Json=False)
: Returns a Python object
Description:
Current CPU usage percentage.
Usage (JSON):
import HardView
import json
cpu_usage_json_str = HardView.get_cpu_usage(True) # Or HardView.get_cpu_usage()
cpu_usage_data = json.loads(cpu_usage_json_str)
print(cpu_usage_data)
Example JSON Output:
{
"cpu_usage": [
{
"load_percentage": 15
}
]
}
Usage (Python Object):
import HardView
cpu_usage_obj = HardView.get_cpu_usage_objects(False) # Or HardView.get_cpu_usage_objects()
print(cpu_usage_obj)
Example Python Object Output:
{
'cpu_usage': [
{
'load_percentage': 15
}
]
}
Properties / JSON Keys:
- cpu_usage (list): Contains:
- load_percentage (integer): The CPU load percentage
b. RAM Usage
C Function: get_ram_usage(bool Json)
Python Functions:
HardView.get_ram_usage(Json=True)
: Returns a JSON stringHardView.get_ram_usage_objects(Json=False)
: Returns a Python object
Description:
Current RAM usage statistics (total, available, used, usage percentage).
Usage (JSON):
import HardView
import json
ram_usage_json_str = HardView.get_ram_usage(True) # Or HardView.get_ram_usage()
ram_usage_data = json.loads(ram_usage_json_str)
print(ram_usage_data)
Example JSON Output:
{
"ram_usage": {
"total_memory_kb": 16777216,
"free_memory_kb": 8388608,
"used_memory_kb": 8388608,
"usage_percent": 50.0
}
}
Usage (Python Object):
import HardView
ram_usage_obj = HardView.get_ram_usage_objects(False) # Or HardView.get_ram_usage_objects()
print(ram_usage_obj)
Example Python Object Output:
{
'ram_usage': {
'total_memory_kb': 16777216,
'free_memory_kb': 8388608,
'used_memory_kb': 8388608,
'usage_percent': 50.0
}
}
Properties / JSON Keys:
- ram_usage (dict): Contains:
- total_memory_kb (integer): Total memory in KB
- free_memory_kb (integer): Free memory in KB
- used_memory_kb (integer): Used memory in KB
- usage_percent (float): Memory usage percentage
c. System Performance
C Function: get_system_performance(bool Json)
Python Functions:
HardView.get_system_performance(Json=True)
: Returns a JSON stringHardView.get_system_performance_objects(Json=False)
: Returns a Python object
Description:
Combined CPU and RAM usage.
Usage (JSON):
import HardView
import json
perf_json_str = HardView.get_system_performance(True) # Or HardView.get_system_performance()
perf_data = json.loads(perf_json_str)
print(perf_data)
Example JSON Output:
{
"system_performance": {
"cpu": {
"cpu_usage": [
{
"load_percentage": 20
}
]
},
"ram": {
"ram_usage": {
"total_memory_kb": 16777216,
"free_memory_kb": 8000000,
"used_memory_kb": 8777216,
"usage_percent": 52.31
}
}
}
}
Example Python Object Output:
{
'system_performance': {
'cpu': [
{
'load_percentage': 20
}
],
'ram': {
'total_memory_kb': 16777216,
'free_memory_kb': 8000000,
'used_memory_kb': 8777216,
'usage_percent': 52.31
}
}
}
Properties / JSON Keys:
- system_performance (dict): Contains:
- cpu (list): CPU usage info (same as in CPU Usage)
- ram (dict): RAM usage info (same as in RAM Usage)
13. Performance Monitoring
a. CPU Monitoring
C Function: monitor_cpu_usage_duration(int duration_seconds, int interval_ms)
Python Functions:
HardView.monitor_cpu_usage_duration(duration_sec, interval_ms)
: Returns a JSON stringHardView.monitor_cpu_usage_duration_objects(duration_sec, interval_ms)
: Returns a Python object
Description:
Monitors CPU usage over a specified time period.
Usage (JSON):
import HardView
import json
cpu_monitor_json_str = HardView.monitor_cpu_usage_duration(5, 1000)
cpu_monitor_data = json.loads(cpu_monitor_json_str)
print(cpu_monitor_data)
Example JSON Output:
{
"cpu_monitoring": {
"duration_seconds": 5,
"interval_ms": 1000,
"readings": [
{ "cpu_usage": [ { "load_percentage": 25 } ] },
{ "cpu_usage": [ { "load_percentage": 30 } ] },
{ "cpu_usage": [ { "load_percentage": 28 } ] }
]
}
}
Usage (Python Object):
import HardView
cpu_monitor_obj = HardView.monitor_cpu_usage_duration_objects(5, 1000)
print(cpu_monitor_obj)
```
Properties / JSON Keys:
- cpu_monitoring (dict): Contains:
- duration_seconds (int)
- interval_ms (int)
- readings (list): List of CPU usage readings
b. RAM Monitoring
C Function: monitor_ram_usage_duration(int duration_seconds, int interval_ms)
Python Functions:
HardView.monitor_ram_usage_duration(duration_sec, interval_ms)
: Returns a JSON stringHardView.monitor_ram_usage_duration_objects(duration_sec, interval_ms)
: Returns a Python object
Description:
Monitors RAM usage over a specified time period.
Usage (JSON):
import HardView
import json
ram_monitor_json_str = HardView.monitor_ram_usage_duration(5, 1000)
ram_monitor_data = json.loads(ram_monitor_json_str)
print(ram_monitor_data)
Example JSON Output:
{
"ram_monitoring": {
"duration_seconds": 5,
"interval_ms": 1000,
"readings": [
{ "ram_usage": { "total_memory_kb": 16777216, "free_memory_kb": 8300000, "used_memory_kb": 8477216, "usage_percent": 50.53 } },
{ "ram_usage": { "total_memory_kb": 16777216, "free_memory_kb": 8250000, "used_memory_kb": 8527216, "usage_percent": 50.82 } }
]
}
}
Usage (Python Object):
import HardView
ram_monitor_obj = HardView.monitor_ram_usage_duration_objects(5, 1000)
print(ram_monitor_obj)
```
Properties / JSON Keys:
- ram_monitoring (dict): Contains:
- duration_seconds (int)
- interval_ms (int)
- readings (list): RAM usage snapshots
c. System Performance Monitoring
C Function: monitor_system_performance_duration(int duration_seconds, int interval_ms)
Python Functions:
HardView.monitor_system_performance_duration(duration_sec, interval_ms)
: Returns a JSON stringHardView.monitor_system_performance_duration_objects(duration_sec, interval_ms)
: Returns a Python object
Description:
Monitors CPU and RAM usage together over a given duration.
Usage (JSON):
import HardView
import json
system_monitor_json_str = HardView.monitor_system_performance_duration(5, 1000)
system_monitor_data = json.loads(system_monitor_json_str)
print(system_monitor_data)
Example JSON Output:
{
"system_performance_monitoring": {
"duration_seconds": 5,
"interval_ms": 1000,
"readings": [
{
"system_performance": {
"cpu": { "cpu_usage": [ { "load_percentage": 20 } ] },
"ram": { "ram_usage": { "total_memory_kb": 16777216, "free_memory_kb": 8100000, "used_memory_kb": 8677216, "usage_percent": 51.72 } }
}
},
{
"system_performance": {
"cpu": { "cpu_usage": [ { "load_percentage": 22 } ] },
"ram": { "ram_usage": { "total_memory_kb": 16777216, "free_memory_kb": 8050000, "used_memory_kb": 8727216, "usage_percent": 52.02 } }
}
}
]
}
}
Usage (Python Object):
import HardView
system_monitor_obj = HardView.monitor_system_performance_duration_objects(5, 1000)
print(system_monitor_obj)
```
Properties / JSON Keys:
- system_performance_monitoring (dict): Contains:
- duration_seconds (int)
- interval_ms (int)
- readings (list): CPU and RAM readings over time
General Notes
- Dual Output Mode:
- Functions can return JSON strings or Python objects
- JSON mode:
HardView.func(True)
- Object mode:
HardView.func_objects(False)
- Errors:
- In case of failure, functions may return:
{ "error": "..." }
- In case of failure, functions may return:
- Performance:
- Most functions run under 0.1s on typical systems
- Warnings:
β οΈ Known Issue in WMI Data Retrieval
There is an issue affecting the return values of some hardware properties due to unexpected COM type inference from WMI queries.
In certain cases, data might appear as
"N/A"
even though the value is not actually empty. This behavior was especially common in versions prior to2.0.3
, and while most of the issues have been resolved, a known case still persists with the CPU'sarchitecture
property.We are actively working on a fix and it will be addressed in an upcoming release.
Quick Test
Run the following command to test all functions:
python test.py
This will:
- Call all HardView functions
- Print execution times
For more details, refer to files inside the docs/
folder.
π Project
GitHub Repository: [https://github.com/gafoo173/HardView/](https://github.com/gafoo173/HardView/)
π€ Contributing to HardView
Thank you for your interest in contributing to HardView! Your help is valuable in making this library robust, fast, and reliable across all supported platforms.
How You Can Contribute
- Test on Different Architectures & Environments
- Try HardView on various systems (Windows 32/64-bit, Linux x86/x86_64, different Python versions).
- Report any issues you encounter, especially those related to installation, import, or hardware detection.
- Share your results and environment details (OS, Python version, hardware specs).
- Report Bugs & Issues
- If you find a bug, please open an issue on GitHub.
- Include:
- Clear description of the problem
- Steps to reproduce
- Your OS, Python version, and HardView version
- Any error messages or logs
- Suggest Features & Improvements
- If you have an idea for a new feature or improvement, open an issue with the "enhancement" label.
- Describe the use case and why it would be helpful.
- Code Contributions (Pull Requests)
- Fork the repository and create a new branch for your changes.
- Follow the existing code style (C99 for C code, PEP8 for Python code).
- Add or update documentation and tests as needed.
- Make sure your code builds and passes all tests on supported platforms.
- Submit a pull request with a clear description of your changes.
- Share Benchmarks & Usage Examples
- If you run performance tests or use HardView in a real project, share your results and scripts.
- This helps others understand the library's capabilities and performance.
- Help with Documentation
- Improve or expand the documentation (in
docs/
). - Add new examples, clarify existing sections, or translate docs to other languages.
- Improve or expand the documentation (in
Code Style & Guidelines
- C code: Use C99 standard, 4-space indentation, and clear, descriptive names.
- Python code: Follow PEP8.
- Write comments for complex logic and public functions.
- Keep functions small and focused.
Running Tests
- (If available) Run the provided test scripts to verify your changes.
- Test on as many platforms and Python versions as possible.
Questions?
- If you have questions about contributing, open an issue or start a discussion on GitHub.
Thank you for helping make HardView better!