Skip to main content

system-parse-lib

A small Python library for reading system information on Linux: OS name, kernel version, uptime, desktop environment, session type, CPU and GPU models and vendors, and basic user details. One module, no third-party dependencies, and no external commands: everything is read from /etc, /proc and /sys.

PyPI License Python Platform

Documentation: https://black-mesa-studios.github.io/system-parse-lib/

Features

  • Distro ID and pretty name, read from /etc/os-release
  • Current username and hostname
  • Kernel version and uptime (as seconds or readable text)
  • Desktop environment, from XDG_CURRENT_DESKTOP or DESKTOP_SESSION
  • Session type (Wayland, X11, tty), from XDG_SESSION_TYPE
  • CPU model, from /proc/cpuinfo
  • GPUs with vendor, model and kernel driver, from /sys/bus/pci/devices

Requirements

  • Linux
  • Python 3.10 or newer
  • Optional: a pci.ids file (from the hwdata or pciids package) so get_gpu() can show real model names

Installation

Install it from PyPI:

pip install system-parse-lib

Or use the source directly: clone the repo and copy systemparselib.py next to your script.

git clone https://github.com/black-mesa-studios/system-parse-lib.git
cp system-parse-lib/systemparselib.py ./

Usage

import systemparselib

sysinfo = systemparselib.Main()

print(sysinfo.get_pretty_name())   # e.g. Arch Linux
print(sysinfo.get_de())            # e.g. KDE
print(sysinfo.get_session_type())  # e.g. wayland
print(sysinfo.get_kernel_version())  # e.g. 6.11.2-arch1-1
print(sysinfo.get_pretty_uptime())   # e.g. up 3 hours, 12 minutes
print(sysinfo.get_cpu())           # e.g. AMD Ryzen 5 5600X 6-Core Processor
print(sysinfo.get_gpu())           # e.g. [GPU(vendor='AMD', model='...', driver='amdgpu')]
print(f"{sysinfo.get_username()}@{sysinfo.get_hostname()}")

Functions

All functions live on the Main class.

Function Returns Description
get_distro_id() str | None Short distro ID, like arch or ubuntu
get_pretty_name() str | None Human-readable OS name
get_username() str Current user's name
get_hostname() str Machine hostname
get_de() str | None Desktop environment, or None if none is set
get_session_type() str Session type from XDG_SESSION_TYPE, like wayland or x11
get_kernel_version() str Kernel release, like 6.11.2-arch1-1
get_uptime_seconds() int | None Seconds since boot
get_pretty_uptime() str | None Readable uptime, like up 3 hours, 12 minutes
get_cpu() str | None CPU model name
get_gpu() list[GPU] One GPU(vendor, model, driver) per display device

Full details are in the documentation.

Testing

test.py prints the output of every function so you can check it on your machine:

python3 test.py

License

Released under the BSD 3-Clause License. Copyright 2026 Black Mesa Studios.

Metadata

Release files for system-parse-lib 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for system-parse-lib 0.0.2
File Size Uploaded Provenance Actions
system_parse_lib-0.0.2.tar.gz 7.6 kB Without provenance Details for system_parse_lib-0.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for system-parse-lib 0.0.2
File Interpreter ABI Platform Actions
system_parse_lib-0.0.2-py3-none-any.whl Python 3 none any Details for system_parse_lib-0.0.2-py3-none-any.whl

Total release size: 13.0 kB

Release files / system_parse_lib-0.0.2.tar.gz

Download URL system_parse_lib-0.0.2.tar.gz
Size 7.6 kB
Tags Source
SHA-256 checksum
How to use checksums
7e3b6af3904c25143b37b38a0ff4f47e62dac69a02e8977015decdba787a8b54
BLAKE2b-256 checksum
How to use checksums
fdb192334b2720ccd47cebb3fe904469a6be57367c20862a7a5ef733cf91c64f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.9

Release files / system_parse_lib-0.0.2-py3-none-any.whl

Download URL system_parse_lib-0.0.2-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
31f265863234a4f97a2b465159a8a872c8c6b28d3af57dfd7d25577620cbacb9
BLAKE2b-256 checksum
How to use checksums
65cb1879de3d1059e8c49b7d6e10c1be9b10ad7e512dc3572455135c9f74bdde
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.9

Security for system-parse-lib 0.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page