{"id":16495663,"url":"https://github.com/bitranox/lib_registry","last_synced_at":"2026-04-03T00:13:48.799Z","repository":{"id":57438673,"uuid":"178183299","full_name":"bitranox/lib_registry","owner":"bitranox","description":"Python Windows Registry Related","archived":false,"fork":false,"pushed_at":"2025-06-12T10:15:37.000Z","size":294,"stargazers_count":2,"open_issues_count":8,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-14T20:56:29.265Z","etag":null,"topics":["python3","registry","windows","wine"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bitranox.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGES.rst","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2019-03-28T10:46:22.000Z","updated_at":"2025-01-24T23:22:25.000Z","dependencies_parsed_at":"2024-04-18T05:29:03.547Z","dependency_job_id":"1f5978a0-94b9-4971-8e06-6bf944d18088","html_url":"https://github.com/bitranox/lib_registry","commit_stats":{"total_commits":289,"total_committers":4,"mean_commits":72.25,"dds":0.532871972318339,"last_synced_commit":"cffcdd6d41dc16b4fe9c58295d3208dc8efda870"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/bitranox/lib_registry","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitranox%2Flib_registry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitranox%2Flib_registry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitranox%2Flib_registry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitranox%2Flib_registry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bitranox","download_url":"https://codeload.github.com/bitranox/lib_registry/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitranox%2Flib_registry/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261056698,"owners_count":23103498,"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":["python3","registry","windows","wine"],"created_at":"2024-10-11T14:32:01.278Z","updated_at":"2026-04-03T00:13:48.749Z","avatar_url":"https://github.com/bitranox.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"lib_registry\n============\n\n\nVersion v2.0.10 as of 2023-07-21 see `Changelog`_\n\n|build_badge| |codeql| |license| |jupyter| |pypi|\n|pypi-downloads| |black| |codecov| |cc_maintain| |cc_issues| |cc_coverage| |snyk|\n\n\n\n.. |build_badge| image:: https://github.com/bitranox/lib_registry/actions/workflows/python-package.yml/badge.svg\n   :target: https://github.com/bitranox/lib_registry/actions/workflows/python-package.yml\n\n\n.. |codeql| image:: https://github.com/bitranox/lib_registry/actions/workflows/codeql-analysis.yml/badge.svg?event=push\n   :target: https://github.com//bitranox/lib_registry/actions/workflows/codeql-analysis.yml\n\n.. |license| image:: https://img.shields.io/github/license/webcomics/pywine.svg\n   :target: http://en.wikipedia.org/wiki/MIT_License\n\n.. |jupyter| image:: https://mybinder.org/badge_logo.svg\n   :target: https://mybinder.org/v2/gh/bitranox/lib_registry/master?filepath=lib_registry.ipynb\n\n.. for the pypi status link note the dashes, not the underscore !\n.. |pypi| image:: https://img.shields.io/pypi/status/lib-registry?label=PyPI%20Package\n   :target: https://badge.fury.io/py/lib_registry\n\n.. |codecov| image:: https://img.shields.io/codecov/c/github/bitranox/lib_registry\n   :target: https://codecov.io/gh/bitranox/lib_registry\n\n.. |cc_maintain| image:: https://img.shields.io/codeclimate/maintainability-percentage/bitranox/lib_registry?label=CC%20maintainability\n   :target: https://codeclimate.com/github/bitranox/lib_registry/maintainability\n   :alt: Maintainability\n\n.. |cc_issues| image:: https://img.shields.io/codeclimate/issues/bitranox/lib_registry?label=CC%20issues\n   :target: https://codeclimate.com/github/bitranox/lib_registry/maintainability\n   :alt: Maintainability\n\n.. |cc_coverage| image:: https://img.shields.io/codeclimate/coverage/bitranox/lib_registry?label=CC%20coverage\n   :target: https://codeclimate.com/github/bitranox/lib_registry/test_coverage\n   :alt: Code Coverage\n\n.. |snyk| image:: https://snyk.io/test/github/bitranox/lib_registry/badge.svg\n   :target: https://snyk.io/test/github/bitranox/lib_registry\n\n.. |black| image:: https://img.shields.io/badge/code%20style-black-000000.svg\n   :target: https://github.com/psf/black\n\n.. |pypi-downloads| image:: https://img.shields.io/pypi/dm/lib-registry\n   :target: https://pypi.org/project/lib-registry/\n   :alt: PyPI - Downloads\n\na more pythonic way to access the windows registry as winreg\n\ncommand line interface is prepared - if someone needs to use it via commandline, give me a note.\n\n----\n\nautomated tests, Github Actions, Documentation, Badges, etc. are managed with `PizzaCutter \u003chttps://github\n.com/bitranox/PizzaCutter\u003e`_ (cookiecutter on steroids)\n\nPython version required: 3.8.0 or newer\n\ntested on recent linux with python 3.8, 3.9, 3.10, 3.11, 3.12-dev, pypy-3.9, pypy-3.10 - architectures: amd64\n\n`100% code coverage \u003chttps://codeclimate.com/github/bitranox/lib_registry/test_coverage\u003e`_, flake8 style checking ,mypy static type checking ,tested under `Linux, macOS, Windows \u003chttps://github.com/bitranox/lib_registry/actions/workflows/python-package.yml\u003e`_, automatic daily builds and monitoring\n\n----\n\n- `Try it Online`_\n- `Usage`_\n- `Usage from Commandline`_\n- `Installation and Upgrade`_\n- `Requirements`_\n- `Acknowledgements`_\n- `Contribute`_\n- `Report Issues \u003chttps://github.com/bitranox/lib_registry/blob/master/ISSUE_TEMPLATE.md\u003e`_\n- `Pull Request \u003chttps://github.com/bitranox/lib_registry/blob/master/PULL_REQUEST_TEMPLATE.md\u003e`_\n- `Code of Conduct \u003chttps://github.com/bitranox/lib_registry/blob/master/CODE_OF_CONDUCT.md\u003e`_\n- `License`_\n- `Changelog`_\n\n----\n\nTry it Online\n-------------\n\nYou might try it right away in Jupyter Notebook by using the \"launch binder\" badge, or click `here \u003chttps://mybinder.org/v2/gh/{{rst_include.\nrepository_slug}}/master?filepath=lib_registry.ipynb\u003e`_\n\nUsage\n-----------\n\npython methods:\n\n- Registry Object\n\n.. code-block:: python\n\n    class Registry(object):\n        def __init__(self, key: Union[None, str, int] = None, computer_name: Optional[str] = None):\n            \"\"\"\n            The Registry Class, to create the registry object.\n            If a key is passed, a connection to the hive is established.\n\n            Parameter\n            ---------\n\n            key:\n                the predefined handle to connect to,\n                or a key string with the hive as the first part (everything else but the hive will be ignored)\n                or None (then no connection will be established)\n            computer_name:\n                the name of the remote computer, of the form r\"\\\\computer_name\" or \"computer_name\". If None, the local computer is used.\n\n            Exceptions\n            ----------\n                RegistryNetworkConnectionError      if we can not reach target computer\n                RegistryHKeyError                   if we can not connect to the hive\n                winreg.ConnectRegistry              auditing event\n\n            Examples\n            --------\n\n            \u003e\u003e\u003e # just create the instance without connection\n            \u003e\u003e\u003e registry = Registry()\n\n            \u003e\u003e\u003e # test connect at init:\n            \u003e\u003e\u003e registry = Registry('HKCU')\n\n            \u003e\u003e\u003e # test invalid hive as string\n            \u003e\u003e\u003e Registry()._reg_connect('SPAM')\n            Traceback (most recent call last):\n                ...\n            lib_registry.RegistryHKeyError: invalid KEY: \"SPAM\"\n\n            \u003e\u003e\u003e # test invalid hive as integer\n            \u003e\u003e\u003e Registry()._reg_connect(42)\n            Traceback (most recent call last):\n                ...\n            lib_registry.RegistryHKeyError: invalid HIVE KEY: \"42\"\n\n            \u003e\u003e\u003e # test invalid computer to connect\n            \u003e\u003e\u003e Registry()._reg_connect(winreg.HKEY_LOCAL_MACHINE, computer_name='some_unknown_machine')\n            Traceback (most recent call last):\n                ...\n            lib_registry.RegistryNetworkConnectionError: The network address \"some_unknown_machine\" is invalid\n\n            \u003e\u003e\u003e # test invalid network Path\n            \u003e\u003e\u003e Registry()._reg_connect(winreg.HKEY_LOCAL_MACHINE, computer_name=r'localhost\\\\ham\\\\spam')\n            Traceback (most recent call last):\n                ...\n            lib_registry.RegistryNetworkConnectionError: The network path to \"localhost\\\\ham\\\\spam\" was not found\n\n            \"\"\"\n\n- create_key\n\n.. code-block:: python\n\n        def create_key(self, key: Union[str, int], sub_key: str = '', exist_ok: bool = True, parents: bool = False) -\u003e winreg.HKEYType:\n            \"\"\"\n            Creates a Key, and returns a Handle to the new key\n\n\n            Parameter\n            ---------\n            key\n              either a predefined HKEY_* constant,\n              a string containing the root key,\n              or an already open key\n            sub_key\n              a string with the desired subkey relative to the key\n            exist_ok\n              bool, default = True\n            parents\n              bool, default = false\n\n\n            Exceptions\n            ----------\n            RegistryKeyCreateError\n                if we can not create the key\n\n\n            Examples\n            --------\n\n            \u003e\u003e\u003e # Setup\n            \u003e\u003e\u003e registry = Registry()\n            \u003e\u003e\u003e # create a key\n            \u003e\u003e\u003e registry.create_key(r'HKCU\\\\Software')\n            \u003c...PyHKEY object at ...\u003e\n\n            \u003e\u003e\u003e # create an existing key, with exist_ok = True\n            \u003e\u003e\u003e registry.create_key(r'HKCU\\\\Software\\\\lib_registry_test', exist_ok=True)\n            \u003c...PyHKEY object at ...\u003e\n\n            \u003e\u003e\u003e # create an existing key, with exist_ok = False (parent existing)\n            \u003e\u003e\u003e registry.create_key(r'HKCU\\\\Software\\\\lib_registry_test', exist_ok=False)\n            Traceback (most recent call last):\n                ...\n            lib_registry.RegistryKeyCreateError: can not create key, it already exists: HKEY_CURRENT_USER...lib_registry_test\n\n            \u003e\u003e\u003e # create a key, parent not existing, with parents = False\n            \u003e\u003e\u003e registry.create_key(r'HKCU\\\\Software\\\\lib_registry_test\\\\a\\\\b', parents=False)\n            Traceback (most recent call last):\n                ...\n            lib_registry.RegistryKeyCreateError: can not create key, the parent key to \"HKEY_CURRENT_USER...b\" does not exist\n\n            \u003e\u003e\u003e # create a key, parent not existing, with parents = True\n            \u003e\u003e\u003e registry.create_key(r'HKCU\\\\Software\\\\lib_registry_test\\\\a\\\\b', parents=True)\n            \u003c...PyHKEY object at ...\u003e\n\n            \u003e\u003e\u003e # TEARDOWN\n            \u003e\u003e\u003e registry.delete_key(r'HKCU\\\\Software\\\\lib_registry_test', delete_subkeys=True)\n\n            \"\"\"\n\n- delete_key\n\n.. code-block:: python\n\n        def delete_key(self, key: Union[str, int], sub_key: str = '', missing_ok: bool = False, delete_subkeys: bool = False) -\u003e None:\n            \"\"\"\n            deletes the specified key, this method can delete keys with subkeys.\n            If the method succeeds, the entire key, including all of its values, is removed.\n\n            Parameter\n            ---------\n            key\n              either a predefined HKEY_* constant,\n              a string containing the root key,\n              or an already open key\n            sub_key\n              a string with the desired subkey relative to the key\n            missing_ok\n              bool, default = False\n            delete_subkeys\n              bool, default = False\n\n            Exceptions\n            ----------\n                RegistryKeyDeleteError  If the key does not exist,\n                RegistryKeyDeleteError  If the key has subkeys and delete_subkeys = False\n\n            \u003e\u003e\u003e # Setup\n            \u003e\u003e\u003e registry = Registry()\n            \u003e\u003e\u003e # create a key, parent not existing, with parents = True\n            \u003e\u003e\u003e registry.create_key(r'HKCU\\\\Software\\\\lib_registry_test\\\\a\\\\b', parents=True)\n            \u003c...PyHKEY object at ...\u003e\n\n            \u003e\u003e\u003e # Delete a Key\n            \u003e\u003e\u003e assert registry.key_exist(r'HKCU\\\\Software\\\\lib_registry_test\\\\a\\\\b') == True\n            \u003e\u003e\u003e registry.delete_key(r'HKCU\\\\Software\\\\lib_registry_test\\\\a\\\\b')\n            \u003e\u003e\u003e assert registry.key_exist(r'HKCU\\\\Software\\\\lib_registry_test\\\\a\\\\b') == False\n\n            \u003e\u003e\u003e # Try to delete a missing Key\n            \u003e\u003e\u003e registry.delete_key(r'HKCU\\\\Software\\\\lib_registry_test\\\\a\\\\b')\n            Traceback (most recent call last):\n                ...\n            lib_registry.RegistryKeyDeleteError: can not delete key none existing key ...\n\n            \u003e\u003e\u003e # Try to delete a missing Key, missing_ok = True\n            \u003e\u003e\u003e registry.delete_key(r'HKCU\\\\Software\\\\lib_registry_test\\\\a\\\\b')\n            Traceback (most recent call last):\n                ...\n            lib_registry.RegistryKeyDeleteError: can not delete key none existing key ...\n\n            \u003e\u003e\u003e # Try to delete a Key with subkeys\n            \u003e\u003e\u003e registry.delete_key(r'HKCU\\\\Software\\\\lib_registry_test')\n            Traceback (most recent call last):\n                ...\n            lib_registry.RegistryKeyDeleteError: can not delete none empty key ...\n\n            \u003e\u003e\u003e # Try to delete a Key with subkeys, delete_subkeys = True\n            \u003e\u003e\u003e registry.delete_key(r'HKCU\\\\Software\\\\lib_registry_test', delete_subkeys=True)\n            \u003e\u003e\u003e assert registry.key_exist(r'HKCU\\\\Software\\\\lib_registry_test') == False\n\n            \u003e\u003e\u003e # Try to delete a Key with missing_ok = True\n            \u003e\u003e\u003e registry.delete_key(r'HKCU\\\\Software\\\\lib_registry_test', missing_ok=True)\n\n            \"\"\"\n\n- key_exists\n\n.. code-block:: python\n\n        def key_exist(self, key: Union[str, int], sub_key: str = '') -\u003e bool:\n            \"\"\"\n            True if the given key exists\n\n            Parameter\n            ---------\n            key\n              either a predefined HKEY_* constant,\n              a string containing the root key,\n              or an already open key\n\n            sub_key\n              a string with the desired subkey relative to the key\n\n\n            Examples\n            --------\n\n            \u003e\u003e\u003e Registry().key_exist(r'HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Windows NT\\\\CurrentVersion')\n            True\n            \u003e\u003e\u003e Registry().key_exist(r'HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Windows NT\\\\DoesNotExist')\n            False\n\n            \"\"\"\n\nUsage from Commandline\n------------------------\n\n.. code-block::\n\n   Usage: lib_registry [OPTIONS] COMMAND [ARGS]...\n\n     a more pythonic way to access the windows registry as winreg\n\n   Options:\n     --version                     Show the version and exit.\n     --traceback / --no-traceback  return traceback information on cli\n     -h, --help                    Show this message and exit.\n\n   Commands:\n     info  get program informations\n\nInstallation and Upgrade\n------------------------\n\n- Before You start, its highly recommended to update pip and setup tools:\n\n\n.. code-block::\n\n    python -m pip --upgrade pip\n    python -m pip --upgrade setuptools\n\n- to install the latest release from PyPi via pip (recommended):\n\n.. code-block::\n\n    python -m pip install --upgrade lib_registry\n\n\n- to install the latest release from PyPi via pip, including test dependencies:\n\n.. code-block::\n\n    python -m pip install --upgrade lib_registry[test]\n\n- to install the latest version from github via pip:\n\n\n.. code-block::\n\n    python -m pip install --upgrade git+https://github.com/bitranox/lib_registry.git\n\n\n- include it into Your requirements.txt:\n\n.. code-block::\n\n    # Insert following line in Your requirements.txt:\n    # for the latest Release on pypi:\n    lib_registry\n\n    # for the latest development version :\n    lib_registry @ git+https://github.com/bitranox/lib_registry.git\n\n    # to install and upgrade all modules mentioned in requirements.txt:\n    python -m pip install --upgrade -r /\u003cpath\u003e/requirements.txt\n\n\n- to install the latest development version, including test dependencies from source code:\n\n.. code-block::\n\n    # cd ~\n    $ git clone https://github.com/bitranox/lib_registry.git\n    $ cd lib_registry\n    python -m pip install -e .[test]\n\n- via makefile:\n  makefiles are a very convenient way to install. Here we can do much more,\n  like installing virtual environments, clean caches and so on.\n\n.. code-block:: shell\n\n    # from Your shell's homedirectory:\n    $ git clone https://github.com/bitranox/lib_registry.git\n    $ cd lib_registry\n\n    # to run the tests:\n    $ make test\n\n    # to install the package\n    $ make install\n\n    # to clean the package\n    $ make clean\n\n    # uninstall the package\n    $ make uninstall\n\nRequirements\n------------\nfollowing modules will be automatically installed :\n\n.. code-block:: bash\n\n    ## Project Requirements\n    click\n    cli_exit_tools\n    fake_winreg\n\nAcknowledgements\n----------------\n\n- special thanks to \"uncle bob\" Robert C. Martin, especially for his books on \"clean code\" and \"clean architecture\"\n\nContribute\n----------\n\nI would love for you to fork and send me pull request for this project.\n- `please Contribute \u003chttps://github.com/bitranox/lib_registry/blob/master/CONTRIBUTING.md\u003e`_\n\nLicense\n-------\n\nThis software is licensed under the `MIT license \u003chttp://en.wikipedia.org/wiki/MIT_License\u003e`_\n\n---\n\nChangelog\n=========\n\n- new MAJOR version for incompatible API changes,\n- new MINOR version for added functionality in a backwards compatible manner\n- new PATCH version for backwards compatible bug fixes\n\ntasks:\n    - test if caching of handles make sense, especially on network\n    - documentation update\n    - pathlib-like Interface\n    - jupyter notebook update\n\nv2.0.10\n---------\n    - update jupyter notebook\n    - set secrets for pypi upload\n\nv2.0.9\n---------\n2023-07-20:\n    - correct error in set_value with value_type=winreg.REG_NONE\n\nv2.0.8\n---------\n2023-07-20:\n    - require minimum python 3.8\n    - remove python 3.7 tests\n    - introduce PEP517 packaging standard\n    - introduce pyproject.toml build-system\n    - remove mypy.ini\n    - remove pytest.ini\n    - remove setup.cfg\n    - remove setup.py\n    - remove .bettercodehub.yml\n    - remove .travis.yml\n    - update black config\n    - clean ./tests/test_cli.py\n    - add codeql badge\n    - move 3rd_party_stubs outside the src directory to ``./.3rd_party_stubs``\n    - add pypy 3.10 tests\n    - add python 3.12-dev tests\n\nv2.0.7\n--------\n2020-10-10: fix minor bugs\n\nv2.0.6\n--------\n2020-10-09: service release\n    - update travis build matrix for linux 3.9-dev\n    - update travis build matrix (paths) for windows 3.9 / 3.10\n\nv2.0.5\n--------\n2020-08-08: service release\n    - fix documentation\n    - fix travis\n    - deprecate pycodestyle\n    - implement flake8\n\nv2.0.4\n---------\n2020-08-01: fix pypi deploy\n\nv2.0.3\n--------\n2020-07-31: fix travis build\n\nv2.0.2\n--------\n2020-07-29: feature release\n    - use the new pizzacutter template\n    - use cli_exit_tools\n\nv2.0.1\n--------\n2020-07-16: feature release\n    - fix cli test\n    - enable traceback option on cli errors\n    - corrected error in DeleteKey, missing_ok\n\nv2.0.0\n--------\n2020-07-14 : feature release\n    - fix setup.py for deploy on pypi\n    - fix travis for pypi deploy testing\n\nv2.0.0a0\n--------\n2020-07-13 : intermediate release\n    - start to implement additional pathlib-like interface\n    - implement fake-winreg to be able to develop and test under linux\n\nv1.0.4\n--------\n2020-07-08 : patch release\n    - new click CLI\n    - use PizzaCutter Template\n    - added jupyter notebook\n    - reorganized modules and import\n    - updated documentation\n\nv1.0.3\n--------\n2019-09-02: strict mypy type checking, housekeeping\n\nv1.0.2\n--------\n2019-04-10: initial PyPi release\n\nv1.0.1\n--------\n2019-03-29: prevent import error when importing under linux\n\nv1.0.0\n--------\n2019-03-28: Initial public release\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitranox%2Flib_registry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbitranox%2Flib_registry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitranox%2Flib_registry/lists"}