system-query


Namesystem-query JSON
Version 0.4.0 PyPI version JSON
download
home_pagehttps://github.com/mbdevpl/system-query
SummaryComprehensive and concise system information querying tool.
upload_time2024-10-23 14:08:11
maintainerMateusz Bysiek
docs_urlNone
authorAleksandr Drozd, Emil Vatai, Mateusz Bysiek
requires_python>=3.9
licenseApache License 2.0
keywords system software hardware
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            .. role:: bash(code)
    :language: bash

.. role:: python(code)
    :language: python


============
system_query
============

Comprehensive and concise system information querying tool.

.. image:: https://img.shields.io/pypi/v/system-query.svg
    :target: https://pypi.org/project/system-query
    :alt: package version from PyPI

.. image:: https://github.com/mbdevpl/system-query/actions/workflows/python.yml/badge.svg?branch=main
    :target: https://github.com/mbdevpl/system-query/actions
    :alt: build status from GitHub

.. image:: https://codecov.io/gh/mbdevpl/system-query/branch/main/graph/badge.svg
    :target: https://codecov.io/gh/mbdevpl/system-query
    :alt: test coverage from Codecov

.. image:: https://api.codacy.com/project/badge/Grade/b44e2fc42fcd4301bcd0fb11938a89da
    :target: https://app.codacy.com/gh/mbdevpl/system-query
    :alt: grade from Codacy

.. image:: https://img.shields.io/github/license/mbdevpl/system-query.svg
    :target: https://github.com/mbdevpl/system-query/blob/v0.4.0/NOTICE
    :alt: license

The goal is to gather all relevant:

*   hardware information (processors, accelerators, memory, networks, drives)
*   static operating system information (name, version, hostname)
*   runtime information (environment, libraries, system load, etc.)

and provide them in a concise form that's both machine- and human-readable.

Another important goal is to also be fail-safe, even with unexpected hardware configurations,
low-level tool errors and deal with incomplete information.

You can use *system-query* as a library and as a command-line tool.

.. contents::
    :backlinks: none


Motivation
==========

Where am I running?
-------------------

One of the main motivations for creating *system-query* is to assist with answering the question
"what is the actual hardware and software configuration of the system I'm using?"
regardless of the official specification.


How to rerun this experiment?
-----------------------------

The *system-query* was also created to assist with the computational experiment reproducibility
and verification of results. Only if you know exactly where you ran your experiment,
you can reason about its results and be able to reproduce them.


Using
=====

Installing *system-query* doesn't enable all the features by default. Some of the query functions
will work only on **some** systems. To attempt installation with all features enables,
run :bash:`pip3 install system-query[all]`. If something brakes, you can narrow down the features
by typing a feature scope instead of ``all``.
You can choose from ``cpu``, ``gpu``, ``hdd``, ``ram`` and ``swap``.
E.g. :bash:`pip3 install system-query[gpu]`. You can also select more than one feature
at the same time, e.g. :bash:`pip3 install system-query[cpu,hdd,ram]`.


As library
----------

.. code:: python

    In [1]: from system_query import query_cpu
            query_cpu()

    Out[1]: {'brand': 'Intel(R) Core(TM) i7-3770K CPU @ 3.50GHz',
             'clock': 1771.0370000000003,
             'clock_max': 3900.0,
             'clock_min': 1600.0,
             'logical_cores': 8,
             'physical_cores': 4}

More examples in `<examples.ipynb>`_.


system_query.query_all()
~~~~~~~~~~~~~~~~~~~~~~~~

This will launch all below functions and assemble results into a dictionary.


system_query.query_cpu()
~~~~~~~~~~~~~~~~~~~~~~~~

To be able to see details like cache size, clock speed and core counts,
install Python packages :bash:`pint` and :bash:`psutil`.


system_query.query_gpus()
~~~~~~~~~~~~~~~~~~~~~~~~~

To be able to see GPUs in the system, make sure you have CUDA installed
and install Python package :bash:`pycuda`.


system_query.query_hdds()
~~~~~~~~~~~~~~~~~~~~~~~~~

To be able to see HDDs in the system, make sure you have libudev installed
and install Python package :bash:`pyudev`.


system_query.query_ram()
~~~~~~~~~~~~~~~~~~~~~~~~

To be able to see amount of memory, install Python package :bash:`psutil`.


system_query.query_software()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This will attempt to gather version information of various common programs,
assuming their executables are in system path.


system_query.query_swap()
~~~~~~~~~~~~~~~~~~~~~~~~~

To be able to see amount of swap space, install Python package ``psutil``.

.. code:: python

    In [9]: system_query.query_swap()
    Out[9]: {'total': 0}


As command-line tool
--------------------

Below will run :python:`system_query.query_all()` and output results to stdout:

.. code:: bash

    $ python3 -m system_query
    {'cpu': {'brand': 'Intel(R) Core(TM) i7-3770K CPU @ 3.50GHz',
             'clock': 1725.031125,
             'clock_max': 3900.0,
             'clock_min': 1600.0,
             'logical_cores': 8,
             'physical_cores': 4},
     'gpus': [],
     'host': 'TestMachine',
     'os': 'Linux-4.4.0-109-generic-x86_64-with-debian-stretch-sid',
     'ram': {'total': 33701269504},
     'swap': {'total': 0}}

Please use ``-h`` to see usage information:

.. code::

    $ python3 -m system_query -h
    usage: system_query [-h] [-s {all,cpu,gpu,ram,swap}] [-f {raw,json}]
                        [-t TARGET] [--version]

    Comprehensive and concise system information tool. Query a given hardware
    and/or software scope of your system and get results in human- and machine-
    readable formats.

    optional arguments:
      -h, --help            show this help message and exit
      -s {all,cpu,gpu,ram,swap}, --scope {all,cpu,gpu,ram,swap}
                            Scope of the query (default: all)
      -f {raw,json}, --format {raw,json}
                            Format of the results of the query. (default: raw)
      -t TARGET, --target TARGET
                            File path where to write the results of the query.
                            Special values: "stdout" and "stderr" to write to
                            stdout and stderr, respectively. (default: stdout)
      --version             show program's version number and exit

    Copyright 2017-2023 by the contributors, Apache License 2.0,
    https://github.com/mbdevpl/system-query

Requirements
============

Python version 3.9 or later.

Python libraries as specified in `requirements.txt <https://github.com/mbdevpl/system-query/blob/v0.4.0/requirements.txt>`_.
Recommended (but optional) packages are listed in `<requirements_optional.txt>`_.

Building and running tests additionally requires packages listed in `requirements_test.txt <https://github.com/mbdevpl/system-query/blob/v0.4.0/requirements_test.txt>`_.

Tested on Linux, macOS and Windows.

Additionally, for all features to work you should have the following libraries
installed in your system:

*   CUDA
*   libudev


Contributors
============

Aleksandr Drozd

Emil Vatai

Mateusz Bysiek

For licensing information, please see `LICENSE <https://github.com/mbdevpl/system-query/blob/v0.4.0/LICENSE>`_ and `NOTICE <https://github.com/mbdevpl/system-query/blob/v0.4.0/NOTICE>`_.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/mbdevpl/system-query",
    "name": "system-query",
    "maintainer": "Mateusz Bysiek",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "mateusz.bysiek@gmail.com",
    "keywords": "system, software, hardware",
    "author": "Aleksandr Drozd, Emil Vatai, Mateusz Bysiek",
    "author_email": "mateusz.bysiek@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/5c/63/12dfe44f6bc0f3c6ae669ae98cd8de3822465c1e3c0c89eb08b1bc45cabf/system_query-0.4.0.tar.gz",
    "platform": null,
    "description": ".. role:: bash(code)\n    :language: bash\n\n.. role:: python(code)\n    :language: python\n\n\n============\nsystem_query\n============\n\nComprehensive and concise system information querying tool.\n\n.. image:: https://img.shields.io/pypi/v/system-query.svg\n    :target: https://pypi.org/project/system-query\n    :alt: package version from PyPI\n\n.. image:: https://github.com/mbdevpl/system-query/actions/workflows/python.yml/badge.svg?branch=main\n    :target: https://github.com/mbdevpl/system-query/actions\n    :alt: build status from GitHub\n\n.. image:: https://codecov.io/gh/mbdevpl/system-query/branch/main/graph/badge.svg\n    :target: https://codecov.io/gh/mbdevpl/system-query\n    :alt: test coverage from Codecov\n\n.. image:: https://api.codacy.com/project/badge/Grade/b44e2fc42fcd4301bcd0fb11938a89da\n    :target: https://app.codacy.com/gh/mbdevpl/system-query\n    :alt: grade from Codacy\n\n.. image:: https://img.shields.io/github/license/mbdevpl/system-query.svg\n    :target: https://github.com/mbdevpl/system-query/blob/v0.4.0/NOTICE\n    :alt: license\n\nThe goal is to gather all relevant:\n\n*   hardware information (processors, accelerators, memory, networks, drives)\n*   static operating system information (name, version, hostname)\n*   runtime information (environment, libraries, system load, etc.)\n\nand provide them in a concise form that's both machine- and human-readable.\n\nAnother important goal is to also be fail-safe, even with unexpected hardware configurations,\nlow-level tool errors and deal with incomplete information.\n\nYou can use *system-query* as a library and as a command-line tool.\n\n.. contents::\n    :backlinks: none\n\n\nMotivation\n==========\n\nWhere am I running?\n-------------------\n\nOne of the main motivations for creating *system-query* is to assist with answering the question\n\"what is the actual hardware and software configuration of the system I'm using?\"\nregardless of the official specification.\n\n\nHow to rerun this experiment?\n-----------------------------\n\nThe *system-query* was also created to assist with the computational experiment reproducibility\nand verification of results. Only if you know exactly where you ran your experiment,\nyou can reason about its results and be able to reproduce them.\n\n\nUsing\n=====\n\nInstalling *system-query* doesn't enable all the features by default. Some of the query functions\nwill work only on **some** systems. To attempt installation with all features enables,\nrun :bash:`pip3 install system-query[all]`. If something brakes, you can narrow down the features\nby typing a feature scope instead of ``all``.\nYou can choose from ``cpu``, ``gpu``, ``hdd``, ``ram`` and ``swap``.\nE.g. :bash:`pip3 install system-query[gpu]`. You can also select more than one feature\nat the same time, e.g. :bash:`pip3 install system-query[cpu,hdd,ram]`.\n\n\nAs library\n----------\n\n.. code:: python\n\n    In [1]: from system_query import query_cpu\n            query_cpu()\n\n    Out[1]: {'brand': 'Intel(R) Core(TM) i7-3770K CPU @ 3.50GHz',\n             'clock': 1771.0370000000003,\n             'clock_max': 3900.0,\n             'clock_min': 1600.0,\n             'logical_cores': 8,\n             'physical_cores': 4}\n\nMore examples in `<examples.ipynb>`_.\n\n\nsystem_query.query_all()\n~~~~~~~~~~~~~~~~~~~~~~~~\n\nThis will launch all below functions and assemble results into a dictionary.\n\n\nsystem_query.query_cpu()\n~~~~~~~~~~~~~~~~~~~~~~~~\n\nTo be able to see details like cache size, clock speed and core counts,\ninstall Python packages :bash:`pint` and :bash:`psutil`.\n\n\nsystem_query.query_gpus()\n~~~~~~~~~~~~~~~~~~~~~~~~~\n\nTo be able to see GPUs in the system, make sure you have CUDA installed\nand install Python package :bash:`pycuda`.\n\n\nsystem_query.query_hdds()\n~~~~~~~~~~~~~~~~~~~~~~~~~\n\nTo be able to see HDDs in the system, make sure you have libudev installed\nand install Python package :bash:`pyudev`.\n\n\nsystem_query.query_ram()\n~~~~~~~~~~~~~~~~~~~~~~~~\n\nTo be able to see amount of memory, install Python package :bash:`psutil`.\n\n\nsystem_query.query_software()\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThis will attempt to gather version information of various common programs,\nassuming their executables are in system path.\n\n\nsystem_query.query_swap()\n~~~~~~~~~~~~~~~~~~~~~~~~~\n\nTo be able to see amount of swap space, install Python package ``psutil``.\n\n.. code:: python\n\n    In [9]: system_query.query_swap()\n    Out[9]: {'total': 0}\n\n\nAs command-line tool\n--------------------\n\nBelow will run :python:`system_query.query_all()` and output results to stdout:\n\n.. code:: bash\n\n    $ python3 -m system_query\n    {'cpu': {'brand': 'Intel(R) Core(TM) i7-3770K CPU @ 3.50GHz',\n             'clock': 1725.031125,\n             'clock_max': 3900.0,\n             'clock_min': 1600.0,\n             'logical_cores': 8,\n             'physical_cores': 4},\n     'gpus': [],\n     'host': 'TestMachine',\n     'os': 'Linux-4.4.0-109-generic-x86_64-with-debian-stretch-sid',\n     'ram': {'total': 33701269504},\n     'swap': {'total': 0}}\n\nPlease use ``-h`` to see usage information:\n\n.. code::\n\n    $ python3 -m system_query -h\n    usage: system_query [-h] [-s {all,cpu,gpu,ram,swap}] [-f {raw,json}]\n                        [-t TARGET] [--version]\n\n    Comprehensive and concise system information tool. Query a given hardware\n    and/or software scope of your system and get results in human- and machine-\n    readable formats.\n\n    optional arguments:\n      -h, --help            show this help message and exit\n      -s {all,cpu,gpu,ram,swap}, --scope {all,cpu,gpu,ram,swap}\n                            Scope of the query (default: all)\n      -f {raw,json}, --format {raw,json}\n                            Format of the results of the query. (default: raw)\n      -t TARGET, --target TARGET\n                            File path where to write the results of the query.\n                            Special values: \"stdout\" and \"stderr\" to write to\n                            stdout and stderr, respectively. (default: stdout)\n      --version             show program's version number and exit\n\n    Copyright 2017-2023 by the contributors, Apache License 2.0,\n    https://github.com/mbdevpl/system-query\n\nRequirements\n============\n\nPython version 3.9 or later.\n\nPython libraries as specified in `requirements.txt <https://github.com/mbdevpl/system-query/blob/v0.4.0/requirements.txt>`_.\nRecommended (but optional) packages are listed in `<requirements_optional.txt>`_.\n\nBuilding and running tests additionally requires packages listed in `requirements_test.txt <https://github.com/mbdevpl/system-query/blob/v0.4.0/requirements_test.txt>`_.\n\nTested on Linux, macOS and Windows.\n\nAdditionally, for all features to work you should have the following libraries\ninstalled in your system:\n\n*   CUDA\n*   libudev\n\n\nContributors\n============\n\nAleksandr Drozd\n\nEmil Vatai\n\nMateusz Bysiek\n\nFor licensing information, please see `LICENSE <https://github.com/mbdevpl/system-query/blob/v0.4.0/LICENSE>`_ and `NOTICE <https://github.com/mbdevpl/system-query/blob/v0.4.0/NOTICE>`_.\n",
    "bugtrack_url": null,
    "license": "Apache License 2.0",
    "summary": "Comprehensive and concise system information querying tool.",
    "version": "0.4.0",
    "project_urls": {
        "Homepage": "https://github.com/mbdevpl/system-query"
    },
    "split_keywords": [
        "system",
        " software",
        " hardware"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "dff576087853d213fd18812ab3e376b4dab1d513417cd7375073c78ef2dd4eca",
                "md5": "a308178af31d994f37bf5cc7bd803f88",
                "sha256": "6830b9f05abb5a51fd7001006fe5322c59d47180f576aedf2352d29f79ef6875"
            },
            "downloads": -1,
            "filename": "system_query-0.4.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a308178af31d994f37bf5cc7bd803f88",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 20180,
            "upload_time": "2024-10-23T14:08:10",
            "upload_time_iso_8601": "2024-10-23T14:08:10.086540Z",
            "url": "https://files.pythonhosted.org/packages/df/f5/76087853d213fd18812ab3e376b4dab1d513417cd7375073c78ef2dd4eca/system_query-0.4.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5c6312dfe44f6bc0f3c6ae669ae98cd8de3822465c1e3c0c89eb08b1bc45cabf",
                "md5": "b573dd2cddea0390ea30b8e15ced6871",
                "sha256": "7d20dd357b66391d2006b5de35eda09c8d7c5c268b7d262e8427556f33097412"
            },
            "downloads": -1,
            "filename": "system_query-0.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "b573dd2cddea0390ea30b8e15ced6871",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 22102,
            "upload_time": "2024-10-23T14:08:11",
            "upload_time_iso_8601": "2024-10-23T14:08:11.910715Z",
            "url": "https://files.pythonhosted.org/packages/5c/63/12dfe44f6bc0f3c6ae669ae98cd8de3822465c1e3c0c89eb08b1bc45cabf/system_query-0.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-23 14:08:11",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mbdevpl",
    "github_project": "system-query",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "system-query"
}
        
Elapsed time: 0.77994s