Skip to content

Commit

Permalink
Remove cores' information and release alpha version
Browse files Browse the repository at this point in the history
  • Loading branch information
dormant-user committed Jan 2, 2025
1 parent d3fac13 commit 856b234
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 12 deletions.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# PyArchitecture
PyArchitecture is a lightweight python module to get system architecture information.
PyArchitecture is a lightweight python module to get kernel information via OS specific CLI commands.

![Python][label-pyversion]

Expand All @@ -11,6 +11,20 @@ PyArchitecture is a lightweight python module to get system architecture informa
[![Pypi-format][label-pypi-format]][pypi-files]
[![Pypi-status][label-pypi-status]][pypi]

## Summary

PyArchitecture is designed to retrieve hard-to-find kernel information like CPU/GPU model name, physical disks,
and memory profiles without using any external dependencies.

> Although this project does not rely on external dependencies, it does use system tools, as outlined below.
| Datatype / Override key | Linux | Darwin (macOS) | Windows |
|-------------------------|------------------|-----------------------------|------------------------------------------|
| **CPU** - `cpu_lib` | `/proc/cpuinfo` | `/usr/sbin/sysctl` | `C:\Windows\System32\wbem\wmic.exe` |
| **PCI** - `gpu_lib` | `/usr/bin/lspci` | `/usr/sbin/system_profiler` | `C:\Windows\System32\wbem\wmic.exe` |
| **Memory** - `mem_lib` | `/proc/meminfo` | `/usr/sbin/sysctl` | N/A |
| **Disk** - `disk_lib` | `/usr/bin/lsblk` | `/usr/sbin/diskutil` | `C:\Program Files\PowerShell\7\pwsh.exe` |

## Installation

```shell
Expand Down
2 changes: 1 addition & 1 deletion pyarchitecture/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from pyarchitecture import cpu, disks, gpu, memory

version = "0.1.0"
version = "0.1.1a0"


def all_components() -> Dict[str, Any]:
Expand Down
12 changes: 3 additions & 9 deletions pyarchitecture/cpu/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,17 @@ def _get_cpu_lib(user_input: str | os.PathLike) -> str:
)


def get_cpu_info(cpu_lib: str | os.PathLike = None) -> Dict[str, int | str]:
def get_cpu_info(cpu_lib: str | os.PathLike = None) -> str:
"""OS-agnostic function to get all CPUs connected to the host system.
Args:
cpu_lib: Custom CPU library path.
Returns:
List[Dict[str, str]]:
str:
Returns CPU name.
"""
library_path = _get_cpu_lib(cpu_lib)
if os.path.isfile(library_path):
cpu_name = main.get_name(library_path)
cpu_count = os.cpu_count()
return {
"name": cpu_name,
"logical_cores": cpu_count,
"physical_cores": int(cpu_count / 2) if cpu_count >= 2 else 1,
}
return main.get_name(library_path)
LOGGER.error(f"CPU library {library_path!r} doesn't exist")
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
name = "PyArchitecture"
dynamic = ["version"]
description = "Python module to get physical drives connected to a host machine"
description = "Python module to get kernel information via OS specific CLI commands"
readme = "README.md"
authors = [{ name = "Vignesh Rao", email = "svignesh1793@gmail.com" }]
license = { file = "LICENSE" }
Expand Down

0 comments on commit 856b234

Please sign in to comment.