A lightweight Python package to detect environment details like OS, CPU, memory, GPU, and Python runtime.
Project description
EnvDetect
EnvDetect is a lightweight Python library for detecting detailed system environment information, including OS, CPU, memory, GPU, Python runtime, and installed packages.
It can be used for debugging, reproducibility, environment validation, or as part of ML/AI pipelines where knowing the exact system setup is crucial.
Features
- OS Information: Name, version, release, architecture, and more.
- CPU Information: Count, frequency, brand, cores, cache sizes, etc.
- Memory Information: Total, available, used, swap, and percentages.
- GPU Information: Vendor, name, driver version, VRAM, and more (if available).
- Python Runtime: Version, implementation, executable path, installed packages.
- Environment Summary: Aggregates all details into one dictionary for easy export/logging.
Installation
pip install envdetect
Usage
from envdetect import os_info, cpu_info, memory_info, gpu_info, python_info, environment_summary
print("=== OS Info ===")
print(os_info())
print("=== CPU Info ===")
print(cpu_info())
print("=== Memory Info ===")
print(memory_info())
print("=== GPU Info ===")
print(gpu_info())
print("=== Python Info ===")
print(python_info())
print("=== Full Environment Summary ===")
print(environment_summary())
CLI
python -m envdetect
This will print a full environment summary in JSON format.
Example Output
{
"os": {
"system": "Linux",
"release": "5.15.0-78-generic",
"version": "#85-Ubuntu SMP Tue Jun 6 23:34:54 UTC 2023",
"architecture": ["64bit", "ELF"],
"machine": "x86_64",
"processor": "Intel(R) Xeon(R) CPU"
},
"cpu": {
"physical_cores": 4,
"total_cores": 8,
"cpu_freq_mhz_max": 4200.0,
"cpu_freq_mhz_min": 800.0,
"cpu_freq_mhz_current": 2300.0,
"l1_cache_kb": 256,
"l2_cache_kb": 1024,
"l3_cache_kb": 8192,
"brand": "Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz"
},
"memory": {
"total": 16,
"available": 10.5,
"used": 5.3,
"percent": 34.5,
"swap_total": 2,
"swap_used": 0.1,
"swap_free": 1.9
},
"gpu": [
{
"id": "GPU-0",
"name": "NVIDIA GeForce RTX 3070",
"driver_version": "535.54",
"memory_total_MB": 8000,
"memory_free_MB": 6500,
"memory_used_MB": 1500
}
],
"python": {
"version": "3.10.12",
"implementation": "CPython",
"executable": "/usr/bin/python3",
"packages_count": 240
}
}
Running Tests
python -m unittest discover -s tests
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file envdetect-0.1.0.tar.gz.
File metadata
- Download URL: envdetect-0.1.0.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1615893045b3102f9a801bcd47967ead2a336a85c5db13e8795c57135d915e3f
|
|
| MD5 |
8bff24272baa70b5e4ece3108a498cc7
|
|
| BLAKE2b-256 |
9df0867ce3c44ac764659c68bb35c63d7ac30aaa18839cfe8560febbb4670a21
|
File details
Details for the file envdetect-0.1.0-py3-none-any.whl.
File metadata
- Download URL: envdetect-0.1.0-py3-none-any.whl
- Upload date:
- Size: 2.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
160658c58b9cf6c678b857862262cb893a2bf3b19869c614d0fbf787c470b960
|
|
| MD5 |
e7d9890a1e4b6c44a5fb062a6cfd1a55
|
|
| BLAKE2b-256 |
14a417ea36c8f287f4789151cc8eedb912d262eb94f5592f947a34a2c4344419
|