sysfacts
is a system information collector.
It can be used standalone or as a library. In order to achieve its goals, sysfacts
tries to leverage existing cross-platform python libraries.
The recommended installation method is pipx. More
specifically, you can install sysfacts
for your user with:
pipx install sysfacts
The above command will create a virtual environment in ~/.local/pipx/venvs/sysfacts
and add the sysfacts
script in ~/.local/bin
.
In case you need to run sysfacts
just once, without installing it, you can do it with
pipx run sysfacts
This way, pipx
will create a temporary virtual environment, install sysfacts
, run it
and cleanup afterwards.
Alternatively you can use good old pip
but this is more fragile than pipx
.
pip install --user sysfacts
If you use poetry, you can use:
poetry add sysfacts
On the CLI application there are three options for the output format:
- colored, pretty-printed JSON (the default)
- machine readable JSON blob
- YAML
sysfacts --help
# JSON output
sysfacts # colored + pretty-printed
sysfacts --no-color # pretty-printed
sysfacts --blob # machine readable
# YAML output
sysfacts --yaml
sysfacts --yaml --no-color
The main function is collect_facts()
which returns a python dictionary.
from sysfacts import collect_facts
facts = collect_facts()
Well, this is not really unique, since there are several similar projects out there