Package: qinfo-python
qinfo-pythonPython Bindings forqinfo.Installationpipinstallqinfo-pythonHow to compileBuild dependencies:Python3 (Cython)gccglibcmakepatchelfgitclone--recurse-submoduleshttps://github.com/el-wumbus/qinfo-pythoncdqinfo-pyhton
pipinstall-r./requirements.txtmakepackageThe package is in thedistdirectory.UsageBelow is a short example of some of the functionality of this module#!/usr/bin/env python3importqinfofromsysimportexitassexitfromosimportenviron,pathdefmain():silent=Falseconfig_file=path.join(environ.get("HOME"),".config/.qinfo.conf")configuration_options=qinfo.parse_config(config_file,silent)ifconfiguration_optionsisNone:return1ifconfiguration_options["display_cpu"]:cpu=qinfo.cpu_model()print(f"CPU:{cpu}")return0sexit(main())Avaliable Functions & What They Returnavalible_memory()-> intReturns the avalible memory in kB.core_count()-> intReturns the core count.cpu_model()-> stringReturns the cpu model as a string.kernel_release()-> stringReturns the release and name of the kernel.motherboard_model()-> stringReturns the model name of the motherboard along with the manufacturer.os_name()-> stringReturns the operating system name (distro name) as a string.parse_config(config_file_location: string, silent:bool)-> dictReturns a dict of all the configuration options.thread_count()-> intReturns the thread count.total_memory()-> intReturns the total memory in kB.uptime()-> longReturns the uptime in seconds.version()-> stringReturns the version of qinfo being used.hostname()-> stringReturn the hostname of the system as a string.packages()-> dictReturns a dict of the number of packages for each supported package manager.rootfs_age()-> dictReturns a dict of the age of the root file system.shell()-> stringReturns a string containing the shell (or if none found, the calling process).username()-> stringReturns the username of the user running the program as a string.What the dictionaries look likeparse_config()returns a dict of the configuration options and their values.
This looks similar to the following:{'display_cpu':1,# Display cpu name and core/thread info'display_etc_cpu':0,# Display extra cpu info'display_mem':1,# Display memory capacity and usage ratio'display_board':1,# Display motherboard info'display_hostname':1,# Display the computer's hostname'display_uptime':1,# Display the system uptime'display_gb':1,# Measure memory in gigabytes instead of kilobytes'display_kernel':1,# Display Kernel release version'display_logo':1,# Display a logo for the OS if supported'display_rootfs_birth':1,# Display the birthdate of the root file system'display_pkg_count':1,# Display the number of packages for every supported package manager'display_shell':1,# Display the shell calling the program'display_username':1,# Display the username of the user calling the program'display_os':1,# Display the os name'date_order':0,# supported formats are YYYY/MM/DD (0) and MM/DD/YYYY (1)'idcolor':'\x1b[1;36m',# Color for the id column'txtcolor':'',# Color for the text column'logocolor':'\x1b[0;31m'# Color for the logo}The *color values are ansi escape codes.
The rest are int values that are either1or0(a.k.a booleans).rootfs_age()returns a dict containing the date.
This will look like the following:{'year':2022,'month':8,'day':21}packages()returns a dict that looks something like the following:{'pacman':979,'apt':372,'apk':87,'flatpak':0,'snap':0}