Metadata-Version: 2.5
Name: SystemDetector
Version: 0.0.1a0
Summary: Cross-platform system information collector for Python.
Project-URL: Homepage, https://github.com/PlayGames-2020/SystemDetector
Project-URL: Repository, https://github.com/PlayGames-2020/SystemDetector.git
Project-URL: Documentation, https://github.com/PlayGames-2020/SystemDetector/blob/main/README.md
Project-URL: Authors, https://github.com/PlayGames-2020
Author-email: PlayGames-2020 <playgames16.01.2020@gmail.com>
License: MIT License
        
        Copyright (c) 2026 PlayGames-2020
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: cross-platform,hardware,information,system
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Python: >=3.9
Requires-Dist: psutil>=7.2.2
Provides-Extra: dev
Requires-Dist: pytest>=8.4.2; extra == 'dev'
Provides-Extra: windows
Requires-Dist: pywin32>=312; extra == 'windows'
Requires-Dist: wmi>=1.5.1; extra == 'windows'
Description-Content-Type: text/markdown

# SystemDetector

A cross-platform system and hardware information collector for Python. The package gathers data on the CPU, memory, disks, network, Bluetooth, firmware, GPU,
battery, operating system, and Python version.

> **Project status:** alpha (`0.0.1`). Data collection is performed to the best of its ability, and some fields
> may be `None`, `0`, or empty lists when the system does not provide certain information.

## Requirements

- Python **3.9 or higher**
- [`psutil`](https://github.com/giampaolo/psutil), installed automatically
- Windows: the `windows` extra installs [`WMI`](https://pypi.org/project/WMI/)
  for additional hardware queries

The package also uses native tools when available, such as PowerShell,
`bluetoothctl`, `lspci`, `system_profiler`, `pmset`, and files from `/sys` and
`/proc` on Linux. The absence of these tools does not prevent the package from being imported,
but may reduce the amount of information collected.

## Instalation

### GitHub

``` bash
pip install git+https://github.com/PlayGames-2020/SystemDetector.git
```

or

``` bash
pip install git+https://github.com/PlayGames-2020/SystemDetector.git@main
```

## Quick Start

```python
from SystemDetector.detector import SystemDetector


detector = SystemDetector()

cpu = detector.get_cpu_info()
print(f"CPU: {cpu.Brand or 'Desconhecida'}")
print(f"Uso: {cpu.Usage:.1f}%")

memory = detector.get_memory_info()
print(f"RAM total: {memory.Total} bytes")

snapshot = detector.get_all_info
print(snapshot["OS"])
```

The class accepts an optional TTL for the internal cache:

```python
from SystemDetector.detector import SystemDetector


detector = SystemDetector(ttl_seconds=10)
# Clears all values ​​stored in the cache when necessary.
detector.clear_cache()
```

Singleton access compatible with the legacy API is also available:

```python
from SystemDetector.detector import ConfigSystemDetector


detector = ConfigSystemDetector()
```

## Main API

All of the methods listed below return dataclasses defined in
`SystemDetector.metadata`, except for methods that return lists or dictionaries.

| Method | Return | Content |
| --- | --- | --- |
| `get_cpu_info()` | `CPU` | Cores, frequency, usage, temperature, and brand |
| `get_memory_info()` | `Memory` | RAM and swap, in bytes |
| `get_disk_info(path=“/”)` | `Disk` | Space, file system, and disk type |
| `get_all_disks()` | `dict[str, Disk]` | Mounted partitions indexed by mount point |
| `get_network_info()` | `Network` | IP addresses, MAC addresses, interface, connectivity, and speed |
| `get_bluetooth_info()` | `BluetoothInfo` | Bluetooth adapters and devices |
| `get_bios_info()` | `BIOS` | Manufacturer, version, date, and serial number |
| `get_motherboard_info()` | `Motherboard` | Manufacturer, model, and serial number |
| `get_gpu_info()` | `list[GPU]` | Detected graphics drivers |
| `get_battery_info()` | `Battery` | Percentage, status, capacity, and cycles |
| `get_system_info()` | `SystemInfo` | Operating system, kernel, architecture, and uptime |
| `get_all_info()` | `dict[str, Any]` | Aggregated snapshot of all categories |
| `clear_cache()` | `None` | Removes cached values |

The PascalCase names from the legacy API are still available, for example
`GetCPUInfo()`, `GetMemoryInfo()`, `GetAllDisks()`, and `GetAllInfo()`.

## Snapshot Structure

`get_all_info()` returns a dictionary with these keys:

```text
OS, CPU, Memory, Disks, Network, BIOS, Motherboard,
GPU, Battery, Bluetooth, Python
```

To convert a single dataclass into a dictionary:

```python
cpu_dict = detector.get_cpu_info().as_dict()
```

The main metrics are:

- CPU: frequency in MHz, usage and temperature in percentage and degrees Celsius
- Memory and disks: bytes
- GPU: memory in bytes when available
- Battery: percentage from 0 to 100 and voltage in volts when available
- Uptime: seconds since startup

## Notes on networking and privacy

`get_network_info()` attempts to determine the local IP address via a UDP connection and
checks Internet availability with a TCP connection to `8.8.8.8:53`.
This check may take a few seconds or fail on restricted networks.

The package does not send the collected data to an external service; the result is
returned only to the code that calls the methods. Nevertheless, applications that
expose or store the snapshot should treat fields such as serial numbers and
network addresses as potentially sensitive data.

## Development and Testing

The tests are located in `tests/` and use mocks so they do not depend on actual hardware,
system commands, or a network connection.

```bash
python -m unittest discover -s tests -v
```

If the development add-on is installed, you can also run:

```bash
python -m pytest
```

## License

Distributed under the license [MIT](LICENSE).

## Links

- [Repository](https://github.com/PlayGames-2020/SystemDetector)
- [Documentation](https://github.com/PlayGames-2020/SystemDetector/blob/main/README.md)
