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

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

Built distribution (wheel)

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

Total release size: 13.1 kB

Release files / system_parse_lib-0.0.4.tar.gz

Download URL system_parse_lib-0.0.4.tar.gz
Size 7.6 kB
Tags Source
SHA-256 checksum
How to use checksums
2e89ffdc24f1449b8dd34d5d8de1ba4f154670de97fbb38c8094273e3c9d72df
BLAKE2b-256 checksum
How to use checksums
3423fcb80d972f57771f92fab9592d2f8340dbce31908c9d571e0537050376d6
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.4-py3-none-any.whl

Download URL system_parse_lib-0.0.4-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1a8c731ec50cf4ca09508a512d088ef47c7242efee9d96685aeaa1866158d7f1
BLAKE2b-256 checksum
How to use checksums
c4c91382d44de1c8fa614f335f91718cd0f6f0c705738ab51ae0777864201536
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.4

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