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.3

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.3
File Size Uploaded Provenance Actions
system_parse_lib-0.0.3.tar.gz 7.6 kB Without provenance Details for system_parse_lib-0.0.3.tar.gz

Built distribution (wheel)

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

Total release size: 13.0 kB

Release files / system_parse_lib-0.0.3.tar.gz

Download URL system_parse_lib-0.0.3.tar.gz
Size 7.6 kB
Tags Source
SHA-256 checksum
How to use checksums
5441ec506310e67dda10edd2d4a950827a74edd7cb27179f7b473a69fca39dca
BLAKE2b-256 checksum
How to use checksums
ee5786a045b65f872acf8a6db04665b4453cd7236a7fd0dfdb6b46a6077a5384
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.3-py3-none-any.whl

Download URL system_parse_lib-0.0.3-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f3cad630d52c306813e94dec23906fa0914100d039f42da32cbddf5868a58a5e
BLAKE2b-256 checksum
How to use checksums
aa693354be0537af69f3ad86d88b25e353545e6d7b1720dcc7daddc13faf9a54
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.3

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