pyhw 0.8.0__tar.gz → 0.10.0__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {pyhw-0.8.0/src/pyhw.egg-info → pyhw-0.10.0}/PKG-INFO +41 -28
- {pyhw-0.8.0 → pyhw-0.10.0}/README.md +38 -25
- {pyhw-0.8.0 → pyhw-0.10.0}/pyproject.toml +3 -3
- pyhw-0.10.0/src/pyhw/__init__.py +1 -0
- pyhw-0.10.0/src/pyhw/__main__.py +135 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/cpu/linux.py +3 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/gpu/linux.py +1 -1
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/host/linux.py +1 -1
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/kernel/windows.py +11 -2
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/nic/linux.py +2 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/npu/linux.py +18 -2
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/os/windows.py +11 -3
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/pyhwUtil/pyhwUtil.py +3 -1
- {pyhw-0.8.0 → pyhw-0.10.0/src/pyhw.egg-info}/PKG-INFO +41 -28
- pyhw-0.10.0/src/pyhw.egg-info/requires.txt +1 -0
- pyhw-0.8.0/src/pyhw/__init__.py +0 -1
- pyhw-0.8.0/src/pyhw/__main__.py +0 -46
- pyhw-0.8.0/src/pyhw.egg-info/requires.txt +0 -1
- {pyhw-0.8.0 → pyhw-0.10.0}/LICENSE +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/setup.cfg +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/__init__.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/backendBase.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/cpu/__init__.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/cpu/bsd.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/cpu/cpuBase.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/cpu/cpuInfo.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/cpu/macos.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/cpu/windows.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/gpu/__init__.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/gpu/bsd.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/gpu/gpuBase.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/gpu/gpuInfo.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/gpu/macos.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/gpu/windows.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/host/__init__.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/host/bsd.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/host/hostBase.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/host/hostInfo.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/host/macos.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/host/windows.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/kernel/__init__.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/kernel/kernelBase.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/kernel/kernelInfo.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/kernel/unix.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/memory/__init__.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/memory/bsd.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/memory/linux.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/memory/macos.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/memory/memoryBase.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/memory/memoryInfo.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/memory/windows.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/metal/t.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/nic/__init__.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/nic/bsd.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/nic/macos.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/nic/nicBase.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/nic/nicInfo.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/nic/windows.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/npu/__init__.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/npu/bsd.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/npu/macos.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/npu/npuBase.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/npu/npuInfo.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/npu/windows.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/os/__init__.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/os/bsd.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/os/linux.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/os/macos.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/os/osBase.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/os/osInfo.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/shell/__init__.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/shell/shellBase.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/shell/shellInfo.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/shell/unix.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/shell/windows.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/title/__init__.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/title/titleBase.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/title/titleInfo.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/title/unix.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/title/windows.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/uptime/__init__.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/uptime/bsd.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/uptime/linux.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/uptime/macos.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/uptime/uptimeBase.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/uptime/uptimeInfo.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/backend/uptime/windows.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/frontend/__init__.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/frontend/color/__init__.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/frontend/color/colorConfig.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/frontend/color/colorSet.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/frontend/color/colorUtil.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/frontend/frontendBase.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/frontend/logo/__init__.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/frontend/logo/ascii/alpine.pyhw +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/frontend/logo/ascii/arch.pyhw +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/frontend/logo/ascii/armbian.pyhw +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/frontend/logo/ascii/centos.pyhw +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/frontend/logo/ascii/debian.pyhw +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/frontend/logo/ascii/fedora.pyhw +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/frontend/logo/ascii/fedora_small.pyhw +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/frontend/logo/ascii/freebsd.pyhw +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/frontend/logo/ascii/linux.pyhw +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/frontend/logo/ascii/macOS.pyhw +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/frontend/logo/ascii/raspbian.pyhw +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/frontend/logo/ascii/ubuntu.pyhw +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/frontend/logo/ascii/ubuntu_small.pyhw +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/frontend/logo/ascii/windows_10.pyhw +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/frontend/logo/ascii/windows_11.pyhw +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/frontend/logo/ascii/windows_2025.pyhw +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/frontend/logo/ascii/windows_old.pyhw +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/frontend/logo/logoBase.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/library/lib/iokitGPULib.dylib +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/pyhwException/__init__.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/pyhwException/pyhwException.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/pyhwUtil/__init__.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw/pyhwUtil/sysctlUtil.py +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw.egg-info/SOURCES.txt +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw.egg-info/dependency_links.txt +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw.egg-info/entry_points.txt +0 -0
- {pyhw-0.8.0 → pyhw-0.10.0}/src/pyhw.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: pyhw
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.10.0
|
4
4
|
Summary: PyHw, a neofetch-like command line tool for fetching system information but written mostly in python.
|
5
5
|
Author-email: Xiao Ran <xiaoran.007@icloud.com>
|
6
6
|
License: BSD-3-Clause
|
@@ -10,10 +10,10 @@ Classifier: Development Status :: 4 - Beta
|
|
10
10
|
Classifier: Programming Language :: Python :: 3
|
11
11
|
Classifier: License :: OSI Approved :: BSD License
|
12
12
|
Classifier: Operating System :: OS Independent
|
13
|
-
Requires-Python: >=3.
|
13
|
+
Requires-Python: >=3.8
|
14
14
|
Description-Content-Type: text/markdown
|
15
15
|
License-File: LICENSE
|
16
|
-
Requires-Dist: pypci-ng>=0.1.
|
16
|
+
Requires-Dist: pypci-ng>=0.1.3
|
17
17
|
|
18
18
|
# PyHw
|
19
19
|
[](https://pepy.tech/project/pyhw)
|
@@ -27,6 +27,7 @@ Requires-Dist: pypci-ng>=0.1.2
|
|
27
27
|
|
28
28
|

|
29
29
|

|
30
|
+

|
30
31
|
|
31
32
|
|
32
33
|
PyHw, a neofetch-like command line tool for fetching system information but written mostly in Python. **Currently, this project is still in the initial stage, only Linux, macOS, FreeBSD and Windows are supported.**
|
@@ -41,8 +42,23 @@ This project is a Python reimplementation of [neofetch](https://github.com/dylan
|
|
41
42
|
|
42
43
|
|
43
44
|
|
44
|
-
## Install
|
45
|
-
There are already a lot of similar tools so you can choose any of them; they're all essentially no different. If you want to try this tool,
|
45
|
+
## 1. Install
|
46
|
+
There are already a lot of similar tools so you can choose any of them; they're all essentially no different. If you want to try this tool, There are two convenient ways to install it.
|
47
|
+
|
48
|
+
### 1.1 Install by pipx
|
49
|
+
**pipx** is an amazing tool to help you install and run applications written in Python. It is more like **brew** or **apt**. You can find more information about it here [pipx](https://github.com/pypa/pipx). **pipx** is available on almost all major platforms and is usually provided by the corresponding package manager. If you haven't used pipx before, you can refer to this [document](https://pipx.pypa.io/stable/installation/) to install it.
|
50
|
+
|
51
|
+
You can install pyhw by the following command:
|
52
|
+
```shell
|
53
|
+
pipx install pyhw
|
54
|
+
```
|
55
|
+
You can then use this tool directly from the command line with the following command, just like neofetch.
|
56
|
+
```shell
|
57
|
+
pyhw
|
58
|
+
```
|
59
|
+
|
60
|
+
### 1.2 Install by pip
|
61
|
+
In any case, pip is always available, so if you can't install this program using **pipx**, you can install pyhw by the following command:
|
46
62
|
```shell
|
47
63
|
pip install pyhw
|
48
64
|
```
|
@@ -60,19 +76,8 @@ python -m pyhw
|
|
60
76
|
```
|
61
77
|
Please note that the command line entry for __pyhw__ is created by pip, and depending on the user, this entry may not in the __system PATH__. If you encounter this problem, pip will give you a prompt, follow the prompts to add entry to the __system PATH__.
|
62
78
|
|
63
|
-
### Install by pipx
|
64
|
-
**pipx** is an amazing tool to help you install and run applications written in Python. It is more like **brew** or **apt**. You can find more information about it here [pipx](https://github.com/pypa/pipx).
|
65
|
-
|
66
|
-
You can install pyhw by the following command:
|
67
|
-
```shell
|
68
|
-
pipx install pyhw
|
69
|
-
```
|
70
|
-
You can then use this tool directly from the command line with the following command, just like neofetch.
|
71
|
-
```shell
|
72
|
-
pyhw
|
73
|
-
```
|
74
79
|
|
75
|
-
### Important note about debian 12:
|
80
|
+
### 1.3 Important note about debian 12:
|
76
81
|
If you use system pip to install pyhw, you will encounter this problem on debian12 and some related distributions (like Ubuntu 24.04):
|
77
82
|
```text
|
78
83
|
error: externally-managed-environment
|
@@ -92,32 +97,34 @@ error: externally-managed-environment
|
|
92
97
|
note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
|
93
98
|
hint: See PEP 668 for the detailed specification.
|
94
99
|
```
|
95
|
-
This is due to the fact that system python is not supposed to be managed by pip. You can simply use **pipx** to install **pyhw**. Or you can use a virtual environment (venv) or force remove this restriction (not recommended).
|
100
|
+
This is due to the fact that system python is not supposed to be managed by pip. You can simply use **pipx** to install **pyhw**. Or you can use a virtual environment (venv), conda environment or force remove this restriction (not recommended).
|
96
101
|
|
97
|
-
## Tested OS
|
102
|
+
## 2. Tested OS
|
98
103
|
* macOS arm64, x86_64
|
99
|
-
* Linux arm64, x86_64
|
104
|
+
* Linux arm64, x86_64, riscv64
|
100
105
|
* FreeBSD arm64
|
101
|
-
* Windows 10
|
106
|
+
* Windows 10 x86_64
|
107
|
+
* Windows 11 arm64, x86_64
|
108
|
+
|
109
|
+
For more detailed information, please refer to [Tested Platform](docs/tested_platform.md).
|
102
110
|
|
103
|
-
## Add Logo
|
111
|
+
## 3. Add Logo
|
104
112
|
1. Create a file named **\<os>.pyhw** in **logo/ascii** folder
|
105
113
|
2. Modify **colorConfig.py** file to add a new logo style
|
106
114
|
3. Update **pyhwUtil.py** to enable new logo style.
|
107
115
|
|
108
|
-
## Build from source
|
109
|
-
Currently, build process relay on swiftc and macOS IOKit framework. To build package from source, you need a Mac machine with macOS 11 and newer.
|
116
|
+
## 4. Build from source
|
110
117
|
|
111
|
-
### Dependencies
|
118
|
+
### 4.1 Dependencies
|
112
119
|
This package was originally implemented in pure python and only depends on the python standard library. However, in subsequent development, the code for the pci part was separated into a separate package **pypci-ng**, which can be obtained using pip (or check out [this](https://github.com/xiaoran007/pypci) GitHub repository).
|
113
120
|
|
114
|
-
### Build tools
|
121
|
+
### 4.2 Build tools
|
115
122
|
Make sure the following Python build tools are already installed.
|
116
123
|
* setuptools
|
117
124
|
* build
|
118
125
|
* twine
|
119
126
|
|
120
|
-
### Build package
|
127
|
+
### 4.3 Build package
|
121
128
|
clone the project, and run:
|
122
129
|
```shell
|
123
130
|
python -m build
|
@@ -126,11 +133,17 @@ After the build process, the source package and the binary whl package can be fo
|
|
126
133
|
```shell
|
127
134
|
pip install dist/*.whl --force-reinstall
|
128
135
|
```
|
129
|
-
|
136
|
+
|
137
|
+
### 4.4 Build Full Feature package
|
138
|
+
Currently, build process relay on swiftc and macOS IOKit framework. To build Full Feature Package from source, you need a Mac machine with macOS 11 and newer.
|
139
|
+
|
140
|
+
Simply type:
|
130
141
|
```shell
|
131
142
|
make build
|
132
143
|
make install
|
133
144
|
```
|
145
|
+
|
146
|
+
## 5. Test Package
|
134
147
|
If you have docker installed, you can test this package through docker by type:
|
135
148
|
```shell
|
136
149
|
make test # local build
|
@@ -10,6 +10,7 @@
|
|
10
10
|
|
11
11
|

|
12
12
|

|
13
|
+

|
13
14
|
|
14
15
|
|
15
16
|
PyHw, a neofetch-like command line tool for fetching system information but written mostly in Python. **Currently, this project is still in the initial stage, only Linux, macOS, FreeBSD and Windows are supported.**
|
@@ -24,8 +25,23 @@ This project is a Python reimplementation of [neofetch](https://github.com/dylan
|
|
24
25
|
|
25
26
|
|
26
27
|
|
27
|
-
## Install
|
28
|
-
There are already a lot of similar tools so you can choose any of them; they're all essentially no different. If you want to try this tool,
|
28
|
+
## 1. Install
|
29
|
+
There are already a lot of similar tools so you can choose any of them; they're all essentially no different. If you want to try this tool, There are two convenient ways to install it.
|
30
|
+
|
31
|
+
### 1.1 Install by pipx
|
32
|
+
**pipx** is an amazing tool to help you install and run applications written in Python. It is more like **brew** or **apt**. You can find more information about it here [pipx](https://github.com/pypa/pipx). **pipx** is available on almost all major platforms and is usually provided by the corresponding package manager. If you haven't used pipx before, you can refer to this [document](https://pipx.pypa.io/stable/installation/) to install it.
|
33
|
+
|
34
|
+
You can install pyhw by the following command:
|
35
|
+
```shell
|
36
|
+
pipx install pyhw
|
37
|
+
```
|
38
|
+
You can then use this tool directly from the command line with the following command, just like neofetch.
|
39
|
+
```shell
|
40
|
+
pyhw
|
41
|
+
```
|
42
|
+
|
43
|
+
### 1.2 Install by pip
|
44
|
+
In any case, pip is always available, so if you can't install this program using **pipx**, you can install pyhw by the following command:
|
29
45
|
```shell
|
30
46
|
pip install pyhw
|
31
47
|
```
|
@@ -43,19 +59,8 @@ python -m pyhw
|
|
43
59
|
```
|
44
60
|
Please note that the command line entry for __pyhw__ is created by pip, and depending on the user, this entry may not in the __system PATH__. If you encounter this problem, pip will give you a prompt, follow the prompts to add entry to the __system PATH__.
|
45
61
|
|
46
|
-
### Install by pipx
|
47
|
-
**pipx** is an amazing tool to help you install and run applications written in Python. It is more like **brew** or **apt**. You can find more information about it here [pipx](https://github.com/pypa/pipx).
|
48
|
-
|
49
|
-
You can install pyhw by the following command:
|
50
|
-
```shell
|
51
|
-
pipx install pyhw
|
52
|
-
```
|
53
|
-
You can then use this tool directly from the command line with the following command, just like neofetch.
|
54
|
-
```shell
|
55
|
-
pyhw
|
56
|
-
```
|
57
62
|
|
58
|
-
### Important note about debian 12:
|
63
|
+
### 1.3 Important note about debian 12:
|
59
64
|
If you use system pip to install pyhw, you will encounter this problem on debian12 and some related distributions (like Ubuntu 24.04):
|
60
65
|
```text
|
61
66
|
error: externally-managed-environment
|
@@ -75,32 +80,34 @@ error: externally-managed-environment
|
|
75
80
|
note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
|
76
81
|
hint: See PEP 668 for the detailed specification.
|
77
82
|
```
|
78
|
-
This is due to the fact that system python is not supposed to be managed by pip. You can simply use **pipx** to install **pyhw**. Or you can use a virtual environment (venv) or force remove this restriction (not recommended).
|
83
|
+
This is due to the fact that system python is not supposed to be managed by pip. You can simply use **pipx** to install **pyhw**. Or you can use a virtual environment (venv), conda environment or force remove this restriction (not recommended).
|
79
84
|
|
80
|
-
## Tested OS
|
85
|
+
## 2. Tested OS
|
81
86
|
* macOS arm64, x86_64
|
82
|
-
* Linux arm64, x86_64
|
87
|
+
* Linux arm64, x86_64, riscv64
|
83
88
|
* FreeBSD arm64
|
84
|
-
* Windows 10
|
89
|
+
* Windows 10 x86_64
|
90
|
+
* Windows 11 arm64, x86_64
|
91
|
+
|
92
|
+
For more detailed information, please refer to [Tested Platform](docs/tested_platform.md).
|
85
93
|
|
86
|
-
## Add Logo
|
94
|
+
## 3. Add Logo
|
87
95
|
1. Create a file named **\<os>.pyhw** in **logo/ascii** folder
|
88
96
|
2. Modify **colorConfig.py** file to add a new logo style
|
89
97
|
3. Update **pyhwUtil.py** to enable new logo style.
|
90
98
|
|
91
|
-
## Build from source
|
92
|
-
Currently, build process relay on swiftc and macOS IOKit framework. To build package from source, you need a Mac machine with macOS 11 and newer.
|
99
|
+
## 4. Build from source
|
93
100
|
|
94
|
-
### Dependencies
|
101
|
+
### 4.1 Dependencies
|
95
102
|
This package was originally implemented in pure python and only depends on the python standard library. However, in subsequent development, the code for the pci part was separated into a separate package **pypci-ng**, which can be obtained using pip (or check out [this](https://github.com/xiaoran007/pypci) GitHub repository).
|
96
103
|
|
97
|
-
### Build tools
|
104
|
+
### 4.2 Build tools
|
98
105
|
Make sure the following Python build tools are already installed.
|
99
106
|
* setuptools
|
100
107
|
* build
|
101
108
|
* twine
|
102
109
|
|
103
|
-
### Build package
|
110
|
+
### 4.3 Build package
|
104
111
|
clone the project, and run:
|
105
112
|
```shell
|
106
113
|
python -m build
|
@@ -109,11 +116,17 @@ After the build process, the source package and the binary whl package can be fo
|
|
109
116
|
```shell
|
110
117
|
pip install dist/*.whl --force-reinstall
|
111
118
|
```
|
112
|
-
|
119
|
+
|
120
|
+
### 4.4 Build Full Feature package
|
121
|
+
Currently, build process relay on swiftc and macOS IOKit framework. To build Full Feature Package from source, you need a Mac machine with macOS 11 and newer.
|
122
|
+
|
123
|
+
Simply type:
|
113
124
|
```shell
|
114
125
|
make build
|
115
126
|
make install
|
116
127
|
```
|
128
|
+
|
129
|
+
## 5. Test Package
|
117
130
|
If you have docker installed, you can test this package through docker by type:
|
118
131
|
```shell
|
119
132
|
make test # local build
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
4
4
|
|
5
5
|
[project]
|
6
6
|
name = "pyhw"
|
7
|
-
version = "0.
|
7
|
+
version = "0.10.0"
|
8
8
|
description = "PyHw, a neofetch-like command line tool for fetching system information but written mostly in python."
|
9
9
|
keywords = ["neofetch", "system information", "command line tool", "python", "hardware information", "fastfetch", "fetching"]
|
10
10
|
authors = [
|
@@ -12,9 +12,9 @@ authors = [
|
|
12
12
|
]
|
13
13
|
readme = "README.md"
|
14
14
|
license = {text = "BSD-3-Clause"}
|
15
|
-
requires-python = ">=3.
|
15
|
+
requires-python = ">=3.8"
|
16
16
|
dependencies = [
|
17
|
-
"pypci-ng>=0.1.
|
17
|
+
"pypci-ng>=0.1.3"
|
18
18
|
]
|
19
19
|
classifiers = [
|
20
20
|
"Development Status :: 4 - Beta",
|
@@ -0,0 +1 @@
|
|
1
|
+
__version__ = '0.10.0'
|
@@ -0,0 +1,135 @@
|
|
1
|
+
from .frontend import Printer
|
2
|
+
from .backend import Data
|
3
|
+
from .backend.title import TitleDetect
|
4
|
+
from .backend.host import HostDetect
|
5
|
+
from .backend.kernel import KernelDetect
|
6
|
+
from .backend.shell import ShellDetect
|
7
|
+
from .backend.uptime import UptimeDetect
|
8
|
+
from .backend.os import OSDetect
|
9
|
+
from .backend.cpu import CPUDetect
|
10
|
+
from .backend.gpu import GPUDetect
|
11
|
+
from .backend.memory import MemoryDetect
|
12
|
+
from .backend.nic import NICDetect
|
13
|
+
from .backend.npu import NPUDetect
|
14
|
+
from .pyhwUtil import createDataString
|
15
|
+
from .pyhwUtil import getOS, selectOSLogo
|
16
|
+
import multiprocessing
|
17
|
+
|
18
|
+
|
19
|
+
def detect_title(os, result_dict):
|
20
|
+
result_dict["title"] = TitleDetect(os=os).getTitle().title
|
21
|
+
|
22
|
+
|
23
|
+
def detect_host(os, result_dict):
|
24
|
+
result_dict["Host"] = HostDetect(os=os).getHostInfo().model
|
25
|
+
|
26
|
+
|
27
|
+
def detect_kernel(os, result_dict):
|
28
|
+
result_dict["Kernel"] = KernelDetect(os=os).getKernelInfo().kernel
|
29
|
+
|
30
|
+
|
31
|
+
def detect_shell(os, result_dict):
|
32
|
+
result_dict["Shell"] = ShellDetect(os=os).getShellInfo().info
|
33
|
+
|
34
|
+
|
35
|
+
def detect_uptime(os, result_dict):
|
36
|
+
result_dict["Uptime"] = UptimeDetect(os=os).getUptime().uptime
|
37
|
+
|
38
|
+
|
39
|
+
def detect_os(os, result_dict):
|
40
|
+
result_dict["OS"] = OSDetect(os=os).getOSInfo().prettyName
|
41
|
+
|
42
|
+
|
43
|
+
def detect_cpu(os, result_dict):
|
44
|
+
result_dict["CPU"] = CPUDetect(os=os).getCPUInfo().cpu
|
45
|
+
|
46
|
+
|
47
|
+
def detect_gpu(os, result_dict):
|
48
|
+
gpu_info = GPUDetect(os=os).getGPUInfo()
|
49
|
+
if gpu_info.number > 0:
|
50
|
+
result_dict["GPU"] = gpu_info.gpus
|
51
|
+
|
52
|
+
|
53
|
+
def detect_memory(os, result_dict):
|
54
|
+
result_dict["Memory"] = MemoryDetect(os=os).getMemoryInfo().memory
|
55
|
+
|
56
|
+
|
57
|
+
def detect_nic(os, result_dict):
|
58
|
+
nic_info = NICDetect(os=os).getNICInfo()
|
59
|
+
if nic_info.number > 0:
|
60
|
+
result_dict["NIC"] = nic_info.nics
|
61
|
+
|
62
|
+
|
63
|
+
def detect_npu(os, result_dict):
|
64
|
+
npu_info = NPUDetect(os=os).getNPUInfo()
|
65
|
+
if npu_info.number > 0:
|
66
|
+
result_dict["NPU"] = npu_info.npus
|
67
|
+
|
68
|
+
|
69
|
+
def main():
|
70
|
+
current_os = getOS()
|
71
|
+
if current_os not in ["linux", "macos", "freebsd", "windows"]:
|
72
|
+
print(f"Only Linux, macOS, FreeBSD, and Windows are supported for now. Current OS: {current_os}")
|
73
|
+
return
|
74
|
+
|
75
|
+
data = Data()
|
76
|
+
|
77
|
+
manager = multiprocessing.Manager()
|
78
|
+
result_dict = manager.dict()
|
79
|
+
|
80
|
+
processes = [
|
81
|
+
multiprocessing.Process(target=detect_title, args=(current_os, result_dict)),
|
82
|
+
multiprocessing.Process(target=detect_host, args=(current_os, result_dict)),
|
83
|
+
multiprocessing.Process(target=detect_kernel, args=(current_os, result_dict)),
|
84
|
+
multiprocessing.Process(target=detect_shell, args=(current_os, result_dict)),
|
85
|
+
multiprocessing.Process(target=detect_uptime, args=(current_os, result_dict)),
|
86
|
+
multiprocessing.Process(target=detect_os, args=(current_os, result_dict)),
|
87
|
+
multiprocessing.Process(target=detect_cpu, args=(current_os, result_dict)),
|
88
|
+
multiprocessing.Process(target=detect_gpu, args=(current_os, result_dict)),
|
89
|
+
multiprocessing.Process(target=detect_memory, args=(current_os, result_dict)),
|
90
|
+
multiprocessing.Process(target=detect_nic, args=(current_os, result_dict)),
|
91
|
+
multiprocessing.Process(target=detect_npu, args=(current_os, result_dict)),
|
92
|
+
]
|
93
|
+
|
94
|
+
for process in processes:
|
95
|
+
process.start()
|
96
|
+
|
97
|
+
for process in processes:
|
98
|
+
process.join()
|
99
|
+
|
100
|
+
for key, value in result_dict.items():
|
101
|
+
setattr(data, key, value)
|
102
|
+
|
103
|
+
logo_os = selectOSLogo(OSDetect(os=current_os).getOSInfo().id)
|
104
|
+
Printer(logo_os=logo_os, data=createDataString(data)).cPrint()
|
105
|
+
|
106
|
+
|
107
|
+
# def main():
|
108
|
+
# current_os = getOS()
|
109
|
+
# if current_os not in ["linux", "macos", "freebsd", "windows"]:
|
110
|
+
# print(f"Only Linux, macOS, FreeBSD and Windows are supported for now. Current OS: {current_os}")
|
111
|
+
# return
|
112
|
+
# data = Data()
|
113
|
+
# data.title = TitleDetect(os=current_os).getTitle().title
|
114
|
+
# data.Host = HostDetect(os=current_os).getHostInfo().model
|
115
|
+
# data.Kernel = KernelDetect(os=current_os).getKernelInfo().kernel
|
116
|
+
# data.Shell = ShellDetect(os=current_os).getShellInfo().info
|
117
|
+
# data.Uptime = UptimeDetect(os=current_os).getUptime().uptime
|
118
|
+
# data.OS = OSDetect(os=current_os).getOSInfo().prettyName
|
119
|
+
# data.CPU = CPUDetect(os=current_os).getCPUInfo().cpu
|
120
|
+
# gpu_info = GPUDetect(os=current_os).getGPUInfo()
|
121
|
+
# if gpu_info.number > 0:
|
122
|
+
# data.GPU = gpu_info.gpus
|
123
|
+
# data.Memory = MemoryDetect(os=current_os).getMemoryInfo().memory
|
124
|
+
# nic_info = NICDetect(os=current_os).getNICInfo()
|
125
|
+
# if nic_info.number > 0:
|
126
|
+
# data.NIC = nic_info.nics
|
127
|
+
# npu_info = NPUDetect(os=current_os).getNPUInfo()
|
128
|
+
# if npu_info.number > 0:
|
129
|
+
# data.NPU = npu_info.npus
|
130
|
+
#
|
131
|
+
# Printer(logo_os=selectOSLogo(OSDetect(os=current_os).getOSInfo().id), data=createDataString(data)).cPrint()
|
132
|
+
|
133
|
+
|
134
|
+
if __name__ == "__main__":
|
135
|
+
main()
|
@@ -73,6 +73,9 @@ class CPUDetectLinux:
|
|
73
73
|
model = compatible.split(",")[-1]
|
74
74
|
if model.startswith("sun"):
|
75
75
|
self.__cpuInfo.model = f"Allwinner {model.split('-')[-1].upper()} ({model})"
|
76
|
+
elif "cvitek" in compatible:
|
77
|
+
model = compatible.split(",")[-1]
|
78
|
+
self.__cpuInfo.model = f"Cvitek {model}"
|
76
79
|
else:
|
77
80
|
pass
|
78
81
|
|
@@ -29,7 +29,7 @@ class GPUDetectLinux:
|
|
29
29
|
|
30
30
|
def __handleNonePciDevices(self):
|
31
31
|
# if detector can't find any VGA/Display/3D GPUs, assume the host is a sbc device, this function is a placeholder for a more advanced method.
|
32
|
-
if getArch()
|
32
|
+
if getArch() in ["aarch64", "arm32", "riscv64"]:
|
33
33
|
self.__gpuInfo.number = 1
|
34
34
|
self.__gpuInfo.gpus.append(f"{CPUDetect(os='linux').getCPUInfo().model} [SOC Integrated]")
|
35
35
|
else:
|
@@ -39,7 +39,7 @@ class HostDetectLinux:
|
|
39
39
|
self._hostInfo.model = self._hostInfo.name + " " + self._hostInfo.version
|
40
40
|
except FileNotFoundError:
|
41
41
|
pass
|
42
|
-
elif self._arch in ["aarch64", "arm32"]:
|
42
|
+
elif self._arch in ["aarch64", "arm32", "riscv64"]:
|
43
43
|
# try to find dmi folder since some arm based desktops and servers may have same structure as x86_64 machines.
|
44
44
|
if os.path.exists("/sys/devices/virtual/dmi/id"):
|
45
45
|
try:
|
@@ -15,7 +15,10 @@ class KernelDetectWindows:
|
|
15
15
|
version = platform.version()
|
16
16
|
machine = platform.machine()
|
17
17
|
display = self.__get_windows_version()
|
18
|
-
|
18
|
+
if display != "":
|
19
|
+
self.__kernelInfo.kernel = f"{version} ({display}) {machine}"
|
20
|
+
else:
|
21
|
+
self.__kernelInfo.kernel = f"{version} {machine}"
|
19
22
|
return self.__kernelInfo
|
20
23
|
|
21
24
|
@staticmethod
|
@@ -26,4 +29,10 @@ class KernelDetectWindows:
|
|
26
29
|
winreg.CloseKey(key)
|
27
30
|
return str(display_version)
|
28
31
|
except:
|
29
|
-
|
32
|
+
try:
|
33
|
+
key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\Microsoft\Windows NT\CurrentVersion")
|
34
|
+
release_id, _ = winreg.QueryValueEx(key, "ReleaseId")
|
35
|
+
winreg.CloseKey(key)
|
36
|
+
return str(release_id)
|
37
|
+
except:
|
38
|
+
return ""
|
@@ -39,6 +39,8 @@ class NICDetectLinux:
|
|
39
39
|
for interface in interfaces:
|
40
40
|
try:
|
41
41
|
if_ip = subprocess.run(["bash", "-c", f"ip -4 addr show {interface} | grep inet | awk '{{print $2}}'"], capture_output=True, text=True).stdout.strip().split("/")[0]
|
42
|
+
if if_ip == "":
|
43
|
+
continue
|
42
44
|
self._nicInfo.nics.append(f"{interface} @ {if_ip}")
|
43
45
|
self._nicInfo.number += 1
|
44
46
|
except:
|
@@ -1,5 +1,6 @@
|
|
1
1
|
from .npuInfo import NPUInfo
|
2
2
|
import pypci
|
3
|
+
import os
|
3
4
|
|
4
5
|
|
5
6
|
class NPUDetectLinux:
|
@@ -25,9 +26,24 @@ class NPUDetectLinux:
|
|
25
26
|
self._npuInfo.number += 1
|
26
27
|
|
27
28
|
def _handleNonePciDevices(self):
|
29
|
+
if os.path.exists("/sys/firmware/devicetree/base/tpu/compatible"):
|
30
|
+
try:
|
31
|
+
with open("/sys/firmware/devicetree/base/tpu/compatible", "r") as f:
|
32
|
+
compatible = f.read().strip()
|
33
|
+
except FileNotFoundError:
|
34
|
+
compatible = ""
|
35
|
+
if "cvitek" in compatible:
|
36
|
+
model = compatible.split(",")[-1]
|
37
|
+
self._npuInfo.npus.append(f"Cvitek {model}")
|
38
|
+
self._npuInfo.number = 1
|
39
|
+
else:
|
40
|
+
pass
|
41
|
+
else:
|
42
|
+
pass
|
28
43
|
# Place Holder for unknown NPU
|
29
|
-
self._npuInfo.number
|
30
|
-
|
44
|
+
if self._npuInfo.number == 0:
|
45
|
+
self._npuInfo.number = 1
|
46
|
+
self._npuInfo.npus.append("Not found")
|
31
47
|
|
32
48
|
@staticmethod
|
33
49
|
def _npuNameClean(npu_name: str):
|
@@ -14,7 +14,10 @@ class OSDetectWindows:
|
|
14
14
|
edition = platform.win32_edition()
|
15
15
|
machine = platform.machine()
|
16
16
|
display = self.__get_windows_version()
|
17
|
-
|
17
|
+
if display != "":
|
18
|
+
self._osInfo.prettyName = f"{system} {release} {display} ({edition}) {machine}"
|
19
|
+
else:
|
20
|
+
self._osInfo.prettyName = f"{system} {release} ({edition}) {machine}"
|
18
21
|
if release == "10":
|
19
22
|
self._osInfo.id = "windows_10"
|
20
23
|
elif release == "11":
|
@@ -31,5 +34,10 @@ class OSDetectWindows:
|
|
31
34
|
winreg.CloseKey(key)
|
32
35
|
return str(display_version)
|
33
36
|
except:
|
34
|
-
|
35
|
-
|
37
|
+
try:
|
38
|
+
key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\Microsoft\Windows NT\CurrentVersion")
|
39
|
+
release_id, _ = winreg.QueryValueEx(key, "ReleaseId")
|
40
|
+
winreg.CloseKey(key)
|
41
|
+
return str(release_id)
|
42
|
+
except:
|
43
|
+
return ""
|
@@ -25,7 +25,7 @@ def getOS():
|
|
25
25
|
def getArch():
|
26
26
|
"""
|
27
27
|
Get the machine architecture.
|
28
|
-
:return: str, value in [x86_64, x86, aarch64, arm32].
|
28
|
+
:return: str, value in [x86_64, x86, aarch64, arm32, riscv64].
|
29
29
|
"""
|
30
30
|
arch = platform.machine()
|
31
31
|
if arch == "x86_64" or arch == "AMD64" or arch == "amd64":
|
@@ -36,6 +36,8 @@ def getArch():
|
|
36
36
|
return "aarch64"
|
37
37
|
elif arch.find("arm") != -1:
|
38
38
|
return "arm32"
|
39
|
+
elif arch == "riscv64":
|
40
|
+
return "riscv64"
|
39
41
|
else:
|
40
42
|
return "unknown"
|
41
43
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: pyhw
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.10.0
|
4
4
|
Summary: PyHw, a neofetch-like command line tool for fetching system information but written mostly in python.
|
5
5
|
Author-email: Xiao Ran <xiaoran.007@icloud.com>
|
6
6
|
License: BSD-3-Clause
|
@@ -10,10 +10,10 @@ Classifier: Development Status :: 4 - Beta
|
|
10
10
|
Classifier: Programming Language :: Python :: 3
|
11
11
|
Classifier: License :: OSI Approved :: BSD License
|
12
12
|
Classifier: Operating System :: OS Independent
|
13
|
-
Requires-Python: >=3.
|
13
|
+
Requires-Python: >=3.8
|
14
14
|
Description-Content-Type: text/markdown
|
15
15
|
License-File: LICENSE
|
16
|
-
Requires-Dist: pypci-ng>=0.1.
|
16
|
+
Requires-Dist: pypci-ng>=0.1.3
|
17
17
|
|
18
18
|
# PyHw
|
19
19
|
[](https://pepy.tech/project/pyhw)
|
@@ -27,6 +27,7 @@ Requires-Dist: pypci-ng>=0.1.2
|
|
27
27
|
|
28
28
|

|
29
29
|

|
30
|
+

|
30
31
|
|
31
32
|
|
32
33
|
PyHw, a neofetch-like command line tool for fetching system information but written mostly in Python. **Currently, this project is still in the initial stage, only Linux, macOS, FreeBSD and Windows are supported.**
|
@@ -41,8 +42,23 @@ This project is a Python reimplementation of [neofetch](https://github.com/dylan
|
|
41
42
|
|
42
43
|
|
43
44
|
|
44
|
-
## Install
|
45
|
-
There are already a lot of similar tools so you can choose any of them; they're all essentially no different. If you want to try this tool,
|
45
|
+
## 1. Install
|
46
|
+
There are already a lot of similar tools so you can choose any of them; they're all essentially no different. If you want to try this tool, There are two convenient ways to install it.
|
47
|
+
|
48
|
+
### 1.1 Install by pipx
|
49
|
+
**pipx** is an amazing tool to help you install and run applications written in Python. It is more like **brew** or **apt**. You can find more information about it here [pipx](https://github.com/pypa/pipx). **pipx** is available on almost all major platforms and is usually provided by the corresponding package manager. If you haven't used pipx before, you can refer to this [document](https://pipx.pypa.io/stable/installation/) to install it.
|
50
|
+
|
51
|
+
You can install pyhw by the following command:
|
52
|
+
```shell
|
53
|
+
pipx install pyhw
|
54
|
+
```
|
55
|
+
You can then use this tool directly from the command line with the following command, just like neofetch.
|
56
|
+
```shell
|
57
|
+
pyhw
|
58
|
+
```
|
59
|
+
|
60
|
+
### 1.2 Install by pip
|
61
|
+
In any case, pip is always available, so if you can't install this program using **pipx**, you can install pyhw by the following command:
|
46
62
|
```shell
|
47
63
|
pip install pyhw
|
48
64
|
```
|
@@ -60,19 +76,8 @@ python -m pyhw
|
|
60
76
|
```
|
61
77
|
Please note that the command line entry for __pyhw__ is created by pip, and depending on the user, this entry may not in the __system PATH__. If you encounter this problem, pip will give you a prompt, follow the prompts to add entry to the __system PATH__.
|
62
78
|
|
63
|
-
### Install by pipx
|
64
|
-
**pipx** is an amazing tool to help you install and run applications written in Python. It is more like **brew** or **apt**. You can find more information about it here [pipx](https://github.com/pypa/pipx).
|
65
|
-
|
66
|
-
You can install pyhw by the following command:
|
67
|
-
```shell
|
68
|
-
pipx install pyhw
|
69
|
-
```
|
70
|
-
You can then use this tool directly from the command line with the following command, just like neofetch.
|
71
|
-
```shell
|
72
|
-
pyhw
|
73
|
-
```
|
74
79
|
|
75
|
-
### Important note about debian 12:
|
80
|
+
### 1.3 Important note about debian 12:
|
76
81
|
If you use system pip to install pyhw, you will encounter this problem on debian12 and some related distributions (like Ubuntu 24.04):
|
77
82
|
```text
|
78
83
|
error: externally-managed-environment
|
@@ -92,32 +97,34 @@ error: externally-managed-environment
|
|
92
97
|
note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
|
93
98
|
hint: See PEP 668 for the detailed specification.
|
94
99
|
```
|
95
|
-
This is due to the fact that system python is not supposed to be managed by pip. You can simply use **pipx** to install **pyhw**. Or you can use a virtual environment (venv) or force remove this restriction (not recommended).
|
100
|
+
This is due to the fact that system python is not supposed to be managed by pip. You can simply use **pipx** to install **pyhw**. Or you can use a virtual environment (venv), conda environment or force remove this restriction (not recommended).
|
96
101
|
|
97
|
-
## Tested OS
|
102
|
+
## 2. Tested OS
|
98
103
|
* macOS arm64, x86_64
|
99
|
-
* Linux arm64, x86_64
|
104
|
+
* Linux arm64, x86_64, riscv64
|
100
105
|
* FreeBSD arm64
|
101
|
-
* Windows 10
|
106
|
+
* Windows 10 x86_64
|
107
|
+
* Windows 11 arm64, x86_64
|
108
|
+
|
109
|
+
For more detailed information, please refer to [Tested Platform](docs/tested_platform.md).
|
102
110
|
|
103
|
-
## Add Logo
|
111
|
+
## 3. Add Logo
|
104
112
|
1. Create a file named **\<os>.pyhw** in **logo/ascii** folder
|
105
113
|
2. Modify **colorConfig.py** file to add a new logo style
|
106
114
|
3. Update **pyhwUtil.py** to enable new logo style.
|
107
115
|
|
108
|
-
## Build from source
|
109
|
-
Currently, build process relay on swiftc and macOS IOKit framework. To build package from source, you need a Mac machine with macOS 11 and newer.
|
116
|
+
## 4. Build from source
|
110
117
|
|
111
|
-
### Dependencies
|
118
|
+
### 4.1 Dependencies
|
112
119
|
This package was originally implemented in pure python and only depends on the python standard library. However, in subsequent development, the code for the pci part was separated into a separate package **pypci-ng**, which can be obtained using pip (or check out [this](https://github.com/xiaoran007/pypci) GitHub repository).
|
113
120
|
|
114
|
-
### Build tools
|
121
|
+
### 4.2 Build tools
|
115
122
|
Make sure the following Python build tools are already installed.
|
116
123
|
* setuptools
|
117
124
|
* build
|
118
125
|
* twine
|
119
126
|
|
120
|
-
### Build package
|
127
|
+
### 4.3 Build package
|
121
128
|
clone the project, and run:
|
122
129
|
```shell
|
123
130
|
python -m build
|
@@ -126,11 +133,17 @@ After the build process, the source package and the binary whl package can be fo
|
|
126
133
|
```shell
|
127
134
|
pip install dist/*.whl --force-reinstall
|
128
135
|
```
|
129
|
-
|
136
|
+
|
137
|
+
### 4.4 Build Full Feature package
|
138
|
+
Currently, build process relay on swiftc and macOS IOKit framework. To build Full Feature Package from source, you need a Mac machine with macOS 11 and newer.
|
139
|
+
|
140
|
+
Simply type:
|
130
141
|
```shell
|
131
142
|
make build
|
132
143
|
make install
|
133
144
|
```
|
145
|
+
|
146
|
+
## 5. Test Package
|
134
147
|
If you have docker installed, you can test this package through docker by type:
|
135
148
|
```shell
|
136
149
|
make test # local build
|
@@ -0,0 +1 @@
|
|
1
|
+
pypci-ng>=0.1.3
|
pyhw-0.8.0/src/pyhw/__init__.py
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
__version__ = '0.8.0'
|
pyhw-0.8.0/src/pyhw/__main__.py
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
from .frontend import Printer
|
2
|
-
from .backend import Data
|
3
|
-
from .backend.title import TitleDetect
|
4
|
-
from .backend.host import HostDetect
|
5
|
-
from .backend.kernel import KernelDetect
|
6
|
-
from .backend.shell import ShellDetect
|
7
|
-
from .backend.uptime import UptimeDetect
|
8
|
-
from .backend.os import OSDetect
|
9
|
-
from .backend.cpu import CPUDetect
|
10
|
-
from .backend.gpu import GPUDetect
|
11
|
-
from .backend.memory import MemoryDetect
|
12
|
-
from .backend.nic import NICDetect
|
13
|
-
from .backend.npu import NPUDetect
|
14
|
-
from .pyhwUtil import createDataString
|
15
|
-
from .pyhwUtil import getOS, selectOSLogo
|
16
|
-
|
17
|
-
|
18
|
-
def main():
|
19
|
-
current_os = getOS()
|
20
|
-
if current_os not in ["linux", "macos", "freebsd", "windows"]:
|
21
|
-
print(f"Only Linux, macOS, FreeBSD and Windows are supported for now. Current OS: {current_os}")
|
22
|
-
return
|
23
|
-
data = Data()
|
24
|
-
data.title = TitleDetect(os=current_os).getTitle().title
|
25
|
-
data.Host = HostDetect(os=current_os).getHostInfo().model
|
26
|
-
data.Kernel = KernelDetect(os=current_os).getKernelInfo().kernel
|
27
|
-
data.Shell = ShellDetect(os=current_os).getShellInfo().info
|
28
|
-
data.Uptime = UptimeDetect(os=current_os).getUptime().uptime
|
29
|
-
data.OS = OSDetect(os=current_os).getOSInfo().prettyName
|
30
|
-
data.CPU = CPUDetect(os=current_os).getCPUInfo().cpu
|
31
|
-
gpu_info = GPUDetect(os=current_os).getGPUInfo()
|
32
|
-
if gpu_info.number > 0:
|
33
|
-
data.GPU = gpu_info.gpus
|
34
|
-
data.Memory = MemoryDetect(os=current_os).getMemoryInfo().memory
|
35
|
-
nic_info = NICDetect(os=current_os).getNICInfo()
|
36
|
-
if nic_info.number > 0:
|
37
|
-
data.NIC = nic_info.nics
|
38
|
-
npu_info = NPUDetect(os=current_os).getNPUInfo()
|
39
|
-
if npu_info.number > 0:
|
40
|
-
data.NPU = npu_info.npus
|
41
|
-
|
42
|
-
Printer(logo_os=selectOSLogo(OSDetect(os=current_os).getOSInfo().id), data=createDataString(data)).cPrint()
|
43
|
-
|
44
|
-
|
45
|
-
if __name__ == "__main__":
|
46
|
-
main()
|
@@ -1 +0,0 @@
|
|
1
|
-
pypci-ng>=0.1.2
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|