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.

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

There's no package yet. 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.1

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.1
File Size Uploaded Provenance Actions
system_parse_lib-0.0.1.tar.gz 7.5 kB Without provenance Details for system_parse_lib-0.0.1.tar.gz

Built distribution (wheel)

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

Total release size: 12.9 kB

Release files / system_parse_lib-0.0.1.tar.gz

Download URL system_parse_lib-0.0.1.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
8f057d12a7dea32012521f1fd585baf9a00309319eec67a6ada5275b88a76d46
BLAKE2b-256 checksum
How to use checksums
ab543c5013fb81596934da9dc32ecf5a8003e2a6ad2e4c180ef8ff09f469f7d7
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.1-py3-none-any.whl

Download URL system_parse_lib-0.0.1-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c6f6ad218207c80ab9c49846cb2d3e426fd78d6d5755cb39cabb0594fde19559
BLAKE2b-256 checksum
How to use checksums
5e829dd8cf4ce3fff042105f51cd8cf8e526153787a7ef05bbd21f1ac00765fe
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.1

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