{"id":16247798,"url":"https://github.com/mbdevpl/system-query","last_synced_at":"2025-08-21T06:32:16.131Z","repository":{"id":48196381,"uuid":"92152504","full_name":"mbdevpl/system-query","owner":"mbdevpl","description":"Comprehensive and concise system information querying tool.","archived":false,"fork":false,"pushed_at":"2024-12-01T20:33:20.000Z","size":177,"stargazers_count":9,"open_issues_count":6,"forks_count":6,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-12-14T21:32:47.014Z","etag":null,"topics":["hardware-information","jenkins-enabled","system-information"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mbdevpl.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-23T09:08:25.000Z","updated_at":"2024-11-30T23:19:01.000Z","dependencies_parsed_at":"2023-09-27T08:21:18.209Z","dependency_job_id":"c7b0b28a-1588-4d69-80dd-d514bd1f36ac","html_url":"https://github.com/mbdevpl/system-query","commit_stats":{"total_commits":116,"total_committers":3,"mean_commits":"38.666666666666664","dds":"0.18965517241379315","last_synced_commit":"fcfab939978c1065122e49527e0c25c3ace59d87"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbdevpl%2Fsystem-query","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbdevpl%2Fsystem-query/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbdevpl%2Fsystem-query/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbdevpl%2Fsystem-query/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mbdevpl","download_url":"https://codeload.github.com/mbdevpl/system-query/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230494900,"owners_count":18235047,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hardware-information","jenkins-enabled","system-information"],"created_at":"2024-10-10T14:38:42.447Z","updated_at":"2025-08-21T06:32:16.110Z","avatar_url":"https://github.com/mbdevpl.png","language":"Python","readme":".. 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: 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]: import system_query\n\nUsage examples are below and in `\u003cexamples.ipynb\u003e`_.\n\nsystem_query.query_all()\n~~~~~~~~~~~~~~~~~~~~~~~~\n\nThis will get basic host and OS information and launch most of below functions,\nand then assemble the results into a single dictionary.\n\n.. code:: python\n\n    In [2]: system_query.query_all()\n    Out[2]:\n    {'host': 'hostname',\n     'os': 'Linux-6.8.0-47-generic-x86_64-with-glibc2.35',\n     'cpu': {'brand': 'Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz',\n      'logical_cores': 12,\n      'physical_cores': 6,\n      'clock': 4131.882833333333,\n      'clock_min': 800.0,\n      'clock_max': 4500.0,\n      'cache': {1: 196608, 2: 1572864, 3: 12582912}},\n     'gpus': [{'brand': 'NVIDIA GeForce RTX 2060',\n       'memory': 6214516736,\n       'memory_clock': 7001000,\n       'compute_capability': 7.5,\n       'clock': 1200000,\n       'multiprocessors': 30,\n       'cores': None,\n       'warp_size': 32}],\n     'ram': {'total': 16631603200},\n     'hdds': {'/dev/sdb': {'size': 0, 'model': '1081C'},\n      '/dev/sdc': {'size': 0, 'model': '1081C'},\n      '/dev/sda': {'size': 1953525168, 'model': 'WDC WD10SPZX-24Z'},\n      '/dev/nvme0n1': {'size': 2000409264, 'model': 'SAMSUNG MZVLB1T0HBLR-000L2'}},\n     'swap': {'total': 17179865088}}\n\nsystem_query.query_cpu()\n~~~~~~~~~~~~~~~~~~~~~~~~\n\nTo be able to see details like cache size, clock speed and core counts,\ninstall Python packages ``pint`` and ``psutil``.\n\n.. code:: python\n\n    In [3]: system_query.query_cpu()\n    Out[3]:\n    {'brand': 'Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz',\n     'logical_cores': 12,\n     'physical_cores': 6,\n     'clock': 4182.955000000001,\n     'clock_min': 800.0,\n     'clock_max': 4500.0,\n     'cache': {1: 196608, 2: 1572864, 3: 12582912}}\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 ``pycuda``.\n\n.. code:: python\n\n    In [4]: system_query.query_gpus()\n    Out[4]:\n    [{'brand': 'NVIDIA GeForce RTX 2060',\n      'memory': 6214516736,\n      'memory_clock': 7001000,\n      'compute_capability': 7.5,\n      'clock': 1200000,\n      'multiprocessors': 30,\n      'cores': None,\n      'warp_size': 32}]\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 ``pyudev``.\n\n.. code:: python\n\n    In [5]: system_query.query_hdds()\n    Out[5]:\n    {'/dev/sdb': {'size': 0, 'model': '1081C'},\n     '/dev/sdc': {'size': 0, 'model': '1081C'},\n     '/dev/sda': {'size': 1953525168, 'model': 'WDC WD10SPZX-24Z'},\n     '/dev/nvme0n1': {'size': 2000409264, 'model': 'SAMSUNG MZVLB1T0HBLR-000L2'}}\n\nsystem_query.query_ram()\n~~~~~~~~~~~~~~~~~~~~~~~~\n\nTo be able to see amount of memory, install Python package ``psutil``.\n\n.. code:: python\n\n    In [6]: system_query.query_ram()\n    Out[6]: {'total': 16631603200}\n\nWhen given an optional argument ``sudo``, more information will be shown.\n\n.. code:: python\n\n    In [7]: system_query.query_ram(sudo=True)\n    [sudo] password for user: ...\n    Out[7]:\n    {'total': 16632750080,\n     'banks': [{'memory': 8589934592, 'clock': 2667000000},\n      {'memory': 8589934592, 'clock': 2667000000}]}\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.. code:: python\n\n    In [8]: system_query.query_software()\n    Out[8]:\n    {'gcc': {'path': '/usr/bin/gcc',\n      'version': 'gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0'},\n     'g++': {'path': '/usr/bin/g++',\n      'version': 'g++ (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0'},\n     'gfortran': {'path': '/usr/bin/gfortran',\n      'version': 'GNU Fortran (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0'},\n     'clang': {'path': '/usr/bin/clang',\n      'version': 'Ubuntu clang version 14.0.0-1ubuntu1.1'},\n     'clang++': {'path': '/usr/bin/clang++',\n      'version': 'Ubuntu clang version 14.0.0-1ubuntu1.1'},\n     'python': {'path': '/home/user/Software/Spack/opt/spack/linux-ubuntu22.04-skylake/gcc-12.3.0/python-3.11.6-pkgqipsrm2re32eisko6o7xa2xnwwzyh/bin/python',\n      'version': 'Python 3.11.6',\n      'packages': {'ipython': {'version': 'ipython==8.26.0'},\n       'numpy': {'version': 'numpy @ file:///tmp/user/spack-stage/spack-stage-py-numpy-1.26.2-bpjavwbbxmsgiutvjzijlkjf5si5ki2v/spack-src'},\n       'pandas': {'version': 'pandas==1.5.3'},\n       'pycuda': {'version': 'pycuda==2024.1'},\n       'scipy': {'version': 'scipy==1.13.0'}}},\n     'python3': {'path': '/home/user/Software/Spack/opt/spack/linux-ubuntu22.04-skylake/gcc-12.3.0/python-3.11.6-pkgqipsrm2re32eisko6o7xa2xnwwzyh/bin/python3',\n      'version': 'Python 3.11.6',\n      'packages': {'ipython': {'version': 'ipython==8.26.0'},\n       'numpy': {'version': 'numpy @ file:///tmp/user/spack-stage/spack-stage-py-numpy-1.26.2-bpjavwbbxmsgiutvjzijlkjf5si5ki2v/spack-src'},\n       'pandas': {'version': 'pandas==1.5.3'},\n       'pycuda': {'version': 'pycuda==2024.1'},\n       'scipy': {'version': 'scipy==1.13.0'}}},\n     'python3.10': {'path': '/usr/bin/python3.10',\n      'version': 'Python 3.10.12',\n      'packages': {}},\n     'python3.11': {'path': '/home/user/Software/Spack/opt/spack/linux-ubuntu22.04-skylake/gcc-12.3.0/python-3.11.6-pkgqipsrm2re32eisko6o7xa2xnwwzyh/bin/python3.11',\n      'version': 'Python 3.11.6',\n      'packages': {'ipython': {'version': 'ipython==8.26.0'},\n       'numpy': {'version': 'numpy @ file:///tmp/user/spack-stage/spack-stage-py-numpy-1.26.2-bpjavwbbxmsgiutvjzijlkjf5si5ki2v/spack-src'},\n       'pandas': {'version': 'pandas==1.5.3'},\n       'pycuda': {'version': 'pycuda==2024.1'},\n       'scipy': {'version': 'scipy==1.13.0'}}},\n     'pip': {'path': '/home/user/Software/Spack/opt/spack/linux-ubuntu22.04-skylake/gcc-12.3.0/python-3.11.6-pkgqipsrm2re32eisko6o7xa2xnwwzyh/bin/pip',\n      'version': 'pip 24.2 from /home/user/Software/Spack/opt/spack/linux-ubuntu22.04-skylake/gcc-12.3.0/python-3.11.6-pkgqipsrm2re32eisko6o7xa2xnwwzyh/lib/python3.11/site-packages/pip (python 3.11)'},\n     'pip3': {'path': '/home/user/Software/Spack/opt/spack/linux-ubuntu22.04-skylake/gcc-12.3.0/python-3.11.6-pkgqipsrm2re32eisko6o7xa2xnwwzyh/bin/pip3',\n      'version': 'pip 24.2 from /home/user/Software/Spack/opt/spack/linux-ubuntu22.04-skylake/gcc-12.3.0/python-3.11.6-pkgqipsrm2re32eisko6o7xa2xnwwzyh/lib/python3.11/site-packages/pip (python 3.11)'},\n     'pip3.11': {'path': '/home/user/Software/Spack/opt/spack/linux-ubuntu22.04-skylake/gcc-12.3.0/python-3.11.6-pkgqipsrm2re32eisko6o7xa2xnwwzyh/bin/pip3.11',\n      'version': 'pip 24.2 from /home/user/Software/Spack/opt/spack/linux-ubuntu22.04-skylake/gcc-12.3.0/python-3.11.6-pkgqipsrm2re32eisko6o7xa2xnwwzyh/lib/python3.11/site-packages/pip (python 3.11)'},\n     'java': {'path': '/usr/lib/jvm/java-11-openjdk-amd64/bin/java',\n      'version': 'openjdk version \"11.0.24\" 2024-07-16'},\n     'ruby': {'path': '/usr/bin/ruby',\n      'version': 'ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-linux-gnu]'},\n     'nvcc': {'path': '/usr/bin/nvcc',\n      'version': 'nvcc: NVIDIA (R) Cuda compiler driver'},\n     'spack': {'path': '/home/user/Software/Scripts/spack', 'version': None}}\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': 17179865088}\n\nsystem_query.query_and_export()\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThis function is for convenience of running the query and outputting the results\nin a designated format, to a designated location.\n\n.. code:: python\n\n    In [10]: import pathlib\n    In [11]: system_query.query_and_export('all', 'json', pathlib.Path('/tmp/system_info.json'))\n\nAs command-line tool\n--------------------\n\nBelow will run :python:`system_query.query_all()` and output results to stdout:\n\n.. code::\n\n    $ python3 -m system_query\n    {'cpu': {'brand': 'Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz',\n             'cache': {1: 196608, 2: 1572864, 3: 12582912},\n             'clock': 3685.686166666667,\n             'clock_max': 4500.0,\n             'clock_min': 800.0,\n             'logical_cores': 12,\n             'physical_cores': 6},\n     'gpus': [{'brand': 'NVIDIA GeForce RTX 2060',\n               'clock': 1200000,\n               'compute_capability': 7.5,\n               'cores': None,\n               'memory': 6214516736,\n               'memory_clock': 7001000,\n               'multiprocessors': 30,\n               'warp_size': 32}],\n     'hdds': {'/dev/nvme0n1': {'model': 'SAMSUNG MZVLB1T0HBLR-000L2',\n                               'size': 2000409264},\n              '/dev/sda': {'model': 'WDC WD10SPZX-24Z', 'size': 1953525168},\n              '/dev/sdb': {'model': '1081C', 'size': 0},\n              '/dev/sdc': {'model': '1081C', 'size': 0}},\n     'host': 'mbLegion',\n     'os': 'Linux-6.8.0-47-generic-x86_64-with-glibc2.35',\n     'ram': {'total': 16631603200},\n     'swap': {'total': 17179865088}}\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    options:\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-2025 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 `\u003crequirements.txt\u003e`_.\nRecommended (but optional) packages are listed in `\u003crequirements_optional.txt\u003e`_.\n\nBuilding and running tests additionally requires packages listed in `\u003crequirements_test.txt\u003e`_.\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 `\u003cLICENSE\u003e`_ and `\u003cNOTICE\u003e`_.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbdevpl%2Fsystem-query","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmbdevpl%2Fsystem-query","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbdevpl%2Fsystem-query/lists"}