quickspec 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Henry Lok
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,14 @@
1
+ Metadata-Version: 2.4
2
+ Name: quickspec
3
+ Version: 0.1.0
4
+ Summary: 快速顯示電腦硬體規格的 CLI 工具
5
+ Author: HenryLok0
6
+ Requires-Python: >=3.7
7
+ License-File: LICENSE
8
+ Requires-Dist: psutil
9
+ Requires-Dist: py-cpuinfo
10
+ Dynamic: author
11
+ Dynamic: license-file
12
+ Dynamic: requires-dist
13
+ Dynamic: requires-python
14
+ Dynamic: summary
@@ -0,0 +1,110 @@
1
+
2
+
3
+ # quickspec
4
+
5
+ [![Code Size](https://img.shields.io/github/languages/code-size/HenryLok0/Quickspec?style=flat-square&logo=github)](https://github.com/HenryLok0/Quickspec)
6
+ ![PyPI - Version](https://img.shields.io/pypi/v/quickspec)
7
+ [![MIT License](https://img.shields.io/github/license/HenryLok0/Quickspec?style=flat-square)](LICENSE)
8
+ [![Stars](https://img.shields.io/github/stars/HenryLok0/Quickspec?style=flat-square)](https://github.com/HenryLok0/Quickspec/stargazers)
9
+
10
+ Instantly display your computer hardware specs in the terminal. Supports Windows/macOS/Linux. One command shows CPU, memory, disk, GPU, motherboard, BIOS, and more.
11
+
12
+ ## Features
13
+
14
+ - One command for all major hardware specs
15
+ - `--detail` flag shows motherboard, BIOS, network adapters, display resolution, boot time, cache, virtualization, battery, and more (Windows only)
16
+ - Cross-platform: Windows, macOS, Linux
17
+ - Minimal dependencies, easy installation
18
+
19
+ ## Installation
20
+
21
+ ```bash
22
+ pip install quickspec
23
+ ```
24
+
25
+ ## Quick Start
26
+
27
+ ```bash
28
+ # Install
29
+ pip install quickspec
30
+
31
+ # Show main hardware specs
32
+ quickspec
33
+
34
+ # Show all detailed hardware info (Windows)
35
+ quickspec --detail
36
+ ```
37
+
38
+ ## Usage
39
+
40
+ ```bash
41
+ # Basic usage
42
+ quickspec
43
+
44
+ # Show detailed info
45
+ quickspec --detail
46
+ ```
47
+
48
+ ## Options
49
+
50
+ | Option | Description |
51
+ |----------------|-------------|
52
+ | `--detail` | Show motherboard, BIOS, network adapters, display resolution, boot time, cache, virtualization, battery, and more (Windows only) |
53
+
54
+ ## Examples
55
+
56
+ ```bash
57
+ # Show main hardware specs
58
+ quickspec
59
+
60
+ # Show all detailed hardware info
61
+ quickspec --detail
62
+ ```
63
+
64
+ ## Comparison
65
+
66
+ | Feature | quickspec | lshw | inxi | dmidecode |
67
+ |-----------------|-----------|------|------|-----------|
68
+ | CPU/Memory/Disk | Yes | Yes | Yes | Yes |
69
+ | GPU | Yes | Yes | Yes | No |
70
+ | Motherboard/BIOS| Yes (Win) | Yes | Yes | Yes |
71
+ | Battery | Yes (Win) | No | Yes | No |
72
+ | One-line install| Yes | No | No | No |
73
+ | Cross-platform | Yes | Partial| Partial| No |
74
+
75
+ ## Why quickspec?
76
+
77
+ - Instantly get all major hardware info for quick checks, reports, or sharing
78
+ - Advanced details on Windows: motherboard, BIOS, battery, etc.
79
+ - Minimal dependencies, easy install, no admin required
80
+ - Cross-platform, works in any environment
81
+
82
+ ## Star History
83
+
84
+ [![Star History Chart](https://api.star-history.com/svg?repos=HenryLok0/Quickspec&type=Date)](https://star-history.com/#HenryLok0/Quickspec&Date)
85
+
86
+ ## Contributing
87
+
88
+ Contributions are welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
89
+
90
+ ---
91
+
92
+ ## License
93
+
94
+ This project is licensed under the MIT License. See [LICENSE](LICENSE) for details.
95
+
96
+ ---
97
+
98
+ ## Support
99
+
100
+ If you have questions or suggestions, please open an issue on GitHub.
101
+
102
+ Thanks to all contributors and the open-source community for your support!
103
+
104
+ ---
105
+
106
+ ## Troubleshooting
107
+
108
+ - Command not found: try `python -m quickspec`.
109
+ - Windows path/encoding issues: run from a local folder and ensure UTF-8 console.
110
+ - Permission issues: if install or run fails, try running as administrator.
@@ -0,0 +1 @@
1
+ # quickspec 套件初始化檔案
@@ -0,0 +1,177 @@
1
+ import sys
2
+ from datetime import datetime
3
+ def get_detail():
4
+ detail = {}
5
+ if wmi:
6
+ c = wmi.WMI()
7
+ # 主機板型號
8
+ try:
9
+ board = c.Win32_BaseBoard()[0]
10
+ detail['Motherboard'] = f"{board.Manufacturer} {board.Product}"
11
+ except Exception:
12
+ detail['Motherboard'] = 'Unknown'
13
+ # BIOS 版本
14
+ try:
15
+ bios = c.Win32_BIOS()[0]
16
+ detail['BIOS'] = f"{bios.Manufacturer} {bios.SMBIOSBIOSVersion} ({bios.ReleaseDate})"
17
+ except Exception:
18
+ detail['BIOS'] = 'Unknown'
19
+ # 網路卡資訊
20
+ try:
21
+ nics = c.Win32_NetworkAdapter()
22
+ nic_list = [nic.Name for nic in nics if nic.PhysicalAdapter]
23
+ detail['Network Adapters'] = ', '.join(nic_list) if nic_list else 'None'
24
+ except Exception:
25
+ detail['Network Adapters'] = 'Unknown'
26
+ # 顯示器解析度
27
+ try:
28
+ screens = c.Win32_DesktopMonitor()
29
+ res_list = [f"{s.ScreenWidth}x{s.ScreenHeight}" for s in screens if s.ScreenWidth and s.ScreenHeight]
30
+ detail['Display Resolution'] = ', '.join(res_list) if res_list else 'Unknown'
31
+ except Exception:
32
+ detail['Display Resolution'] = 'Unknown'
33
+ # 系統開機時間
34
+ try:
35
+ os = c.Win32_OperatingSystem()[0]
36
+ boot_time = datetime.strptime(os.LastBootUpTime.split('.')[0], "%Y%m%d%H%M%S")
37
+ uptime = datetime.now() - boot_time
38
+ detail['Boot Time'] = boot_time.strftime('%Y-%m-%d %H:%M:%S')
39
+ detail['Uptime'] = str(uptime).split('.')[0]
40
+ except Exception:
41
+ detail['Boot Time'] = 'Unknown'
42
+ detail['Uptime'] = 'Unknown'
43
+ # 處理器快取(L2/L3)
44
+ try:
45
+ cpu = c.Win32_Processor()[0]
46
+ detail['CPU Cache'] = f"L2: {cpu.L2CacheSize} KB, L3: {cpu.L3CacheSize} KB"
47
+ except Exception:
48
+ detail['CPU Cache'] = 'Unknown'
49
+ # 虛擬化支援
50
+ try:
51
+ cpu = c.Win32_Processor()[0]
52
+ detail['Virtualization'] = 'Enabled' if getattr(cpu, 'VirtualizationFirmwareEnabled', False) else 'Disabled'
53
+ except Exception:
54
+ detail['Virtualization'] = 'Unknown'
55
+ # 電池資訊(筆電)
56
+ try:
57
+ batteries = c.Win32_Battery()
58
+ if batteries:
59
+ bat = batteries[0]
60
+ detail['Battery'] = f"{bat.Name}, {bat.EstimatedChargeRemaining}%"
61
+ else:
62
+ detail['Battery'] = 'No Battery'
63
+ except Exception:
64
+ detail['Battery'] = 'Unknown'
65
+ else:
66
+ detail['Detail'] = 'WMI not available on this system.'
67
+ return detail
68
+ def print_detail():
69
+ detail = get_detail()
70
+ print("=== Computer Detail Information ===")
71
+ for k, v in detail.items():
72
+ print(f"{k}: {v}")
73
+ import platform
74
+ import psutil
75
+
76
+ try:
77
+ import cpuinfo
78
+ except ImportError:
79
+ cpuinfo = None
80
+ import importlib
81
+ GPUtil = None
82
+ gputil_import_error = None
83
+ try:
84
+ GPUtil = importlib.import_module('GPUtil')
85
+ except Exception as e:
86
+ gputil_import_error = str(e)
87
+
88
+ # WMI for Windows GPU detection
89
+ wmi = None
90
+ wmi_import_error = None
91
+ try:
92
+ wmi = importlib.import_module('wmi')
93
+ except Exception as e:
94
+ wmi_import_error = str(e)
95
+
96
+ def get_spec():
97
+ info = {}
98
+ info['OS'] = platform.platform()
99
+ if cpuinfo:
100
+ cpu = cpuinfo.get_cpu_info()
101
+ cpu_name = cpu.get('brand_raw', 'Unknown')
102
+ else:
103
+ cpu_name = platform.processor() or 'Unknown'
104
+ cpu_cores = psutil.cpu_count(logical=False)
105
+ cpu_threads = psutil.cpu_count(logical=True)
106
+ info['CPU'] = f"{cpu_name} ({cpu_cores} Cores + {cpu_threads} Threads)"
107
+ info['CPU Frequency'] = f"{psutil.cpu_freq().current:.2f} MHz" if psutil.cpu_freq() else 'Unknown'
108
+ mem = psutil.virtual_memory()
109
+ mem_used = mem.used / (1024**3)
110
+ mem_total = mem.total / (1024**3)
111
+ mem_percent = mem.percent
112
+ info['Memory'] = f"{mem_used:.2f} GB / {mem_total:.2f} GB ({mem_percent:.1f}%)"
113
+
114
+ disk = psutil.disk_usage('/')
115
+ disk_total = disk.total / (1024**3)
116
+ disk_free = disk.free / (1024**3)
117
+ disk_used = disk_total - disk_free
118
+ disk_percent = disk.percent
119
+ info['Disk'] = f"{disk_used:.2f} GB / {disk_total:.2f} GB ({disk_percent:.1f}%)"
120
+ # GPU 資訊(優先使用 wmi,支援所有 Windows 顯示卡)
121
+ gpu_list = []
122
+ if wmi:
123
+ try:
124
+ c = wmi.WMI()
125
+ for gpu in c.Win32_VideoController():
126
+ name = gpu.Name
127
+ ram = int(gpu.AdapterRAM) // (1024**2) if gpu.AdapterRAM else 'Unknown'
128
+ gpu_list.append(f"{name} ({ram}MB)")
129
+ except Exception as e:
130
+ gpu_list.append(f"WMI error: {e}")
131
+ elif wmi_import_error:
132
+ gpu_list.append(f"WMI import error: {wmi_import_error}")
133
+ # 若 wmi 無法使用,則用 GPUtil
134
+ elif GPUtil:
135
+ gpus = GPUtil.getGPUs()
136
+ if gpus:
137
+ for idx, gpu in enumerate(gpus):
138
+ gpu_list.append(f"{gpu.name} ({gpu.driver}) {gpu.memoryTotal}MB")
139
+ else:
140
+ gpu_list.append('No GPU detected')
141
+ elif gputil_import_error:
142
+ gpu_list.append(f'GPUtil import error: {gputil_import_error}')
143
+ else:
144
+ gpu_list.append('No GPU detected')
145
+ # 顯示所有 GPU
146
+ for idx, gpu_info in enumerate(gpu_list):
147
+ info[f'GPU {idx+1}'] = gpu_info
148
+ return info
149
+
150
+ def print_spec():
151
+ spec = get_spec()
152
+ print("=== Computer Specification ===")
153
+ # 顯示順序:OS, CPU, CPU Frequency, GPU, Memory, Disk
154
+ order = [
155
+ 'OS',
156
+ 'CPU',
157
+ 'CPU Frequency',
158
+ ]
159
+ # GPU 可能有多個
160
+ gpu_keys = [k for k in spec.keys() if k.startswith('GPU')]
161
+ order.extend(gpu_keys)
162
+ order.extend([
163
+ 'Memory',
164
+ 'Disk',
165
+ ])
166
+ for k in order:
167
+ if k in spec:
168
+ print(f"{k}: {spec[k]}")
169
+
170
+ if __name__ == "__main__":
171
+ if '--detail' in sys.argv:
172
+ print_spec()
173
+ print()
174
+ print_detail()
175
+ print()
176
+ else:
177
+ print_spec()
@@ -0,0 +1,14 @@
1
+ Metadata-Version: 2.4
2
+ Name: quickspec
3
+ Version: 0.1.0
4
+ Summary: 快速顯示電腦硬體規格的 CLI 工具
5
+ Author: HenryLok0
6
+ Requires-Python: >=3.7
7
+ License-File: LICENSE
8
+ Requires-Dist: psutil
9
+ Requires-Dist: py-cpuinfo
10
+ Dynamic: author
11
+ Dynamic: license-file
12
+ Dynamic: requires-dist
13
+ Dynamic: requires-python
14
+ Dynamic: summary
@@ -0,0 +1,11 @@
1
+ LICENSE
2
+ README.md
3
+ setup.py
4
+ quickspec/__init__.py
5
+ quickspec/main.py
6
+ quickspec.egg-info/PKG-INFO
7
+ quickspec.egg-info/SOURCES.txt
8
+ quickspec.egg-info/dependency_links.txt
9
+ quickspec.egg-info/entry_points.txt
10
+ quickspec.egg-info/requires.txt
11
+ quickspec.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ quickspec = quickspec.main:print_spec
@@ -0,0 +1,2 @@
1
+ psutil
2
+ py-cpuinfo
@@ -0,0 +1 @@
1
+ quickspec
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,19 @@
1
+ from setuptools import setup, find_packages
2
+
3
+ setup(
4
+ name='quickspec',
5
+ version='0.1.0',
6
+ description='快速顯示電腦硬體規格的 CLI 工具',
7
+ author='HenryLok0',
8
+ packages=find_packages(),
9
+ install_requires=[
10
+ 'psutil',
11
+ 'py-cpuinfo',
12
+ ],
13
+ entry_points={
14
+ 'console_scripts': [
15
+ 'quickspec=quickspec.main:print_spec',
16
+ ],
17
+ },
18
+ python_requires='>=3.7',
19
+ )