lib-registry


Namelib-registry JSON
Version 2.0.10 PyPI version JSON
download
home_page
Summarya more pythonic way to access the windows registry as winreg
upload_time2023-07-21 08:50:35
maintainer
docs_urlNone
author
requires_python>=3.8.0
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            lib_registry
============


Version v2.0.10 as of 2023-07-21 see `Changelog`_

|build_badge| |codeql| |license| |jupyter| |pypi|
|pypi-downloads| |black| |codecov| |cc_maintain| |cc_issues| |cc_coverage| |snyk|



.. |build_badge| image:: https://github.com/bitranox/lib_registry/actions/workflows/python-package.yml/badge.svg
   :target: https://github.com/bitranox/lib_registry/actions/workflows/python-package.yml


.. |codeql| image:: https://github.com/bitranox/lib_registry/actions/workflows/codeql-analysis.yml/badge.svg?event=push
   :target: https://github.com//bitranox/lib_registry/actions/workflows/codeql-analysis.yml

.. |license| image:: https://img.shields.io/github/license/webcomics/pywine.svg
   :target: http://en.wikipedia.org/wiki/MIT_License

.. |jupyter| image:: https://mybinder.org/badge_logo.svg
   :target: https://mybinder.org/v2/gh/bitranox/lib_registry/master?filepath=lib_registry.ipynb

.. for the pypi status link note the dashes, not the underscore !
.. |pypi| image:: https://img.shields.io/pypi/status/lib-registry?label=PyPI%20Package
   :target: https://badge.fury.io/py/lib_registry

.. |codecov| image:: https://img.shields.io/codecov/c/github/bitranox/lib_registry
   :target: https://codecov.io/gh/bitranox/lib_registry

.. |cc_maintain| image:: https://img.shields.io/codeclimate/maintainability-percentage/bitranox/lib_registry?label=CC%20maintainability
   :target: https://codeclimate.com/github/bitranox/lib_registry/maintainability
   :alt: Maintainability

.. |cc_issues| image:: https://img.shields.io/codeclimate/issues/bitranox/lib_registry?label=CC%20issues
   :target: https://codeclimate.com/github/bitranox/lib_registry/maintainability
   :alt: Maintainability

.. |cc_coverage| image:: https://img.shields.io/codeclimate/coverage/bitranox/lib_registry?label=CC%20coverage
   :target: https://codeclimate.com/github/bitranox/lib_registry/test_coverage
   :alt: Code Coverage

.. |snyk| image:: https://snyk.io/test/github/bitranox/lib_registry/badge.svg
   :target: https://snyk.io/test/github/bitranox/lib_registry

.. |black| image:: https://img.shields.io/badge/code%20style-black-000000.svg
   :target: https://github.com/psf/black

.. |pypi-downloads| image:: https://img.shields.io/pypi/dm/lib-registry
   :target: https://pypi.org/project/lib-registry/
   :alt: PyPI - Downloads

a more pythonic way to access the windows registry as winreg

command line interface is prepared - if someone needs to use it via commandline, give me a note.

----

automated tests, Github Actions, Documentation, Badges, etc. are managed with `PizzaCutter <https://github
.com/bitranox/PizzaCutter>`_ (cookiecutter on steroids)

Python version required: 3.8.0 or newer

tested on recent linux with python 3.8, 3.9, 3.10, 3.11, 3.12-dev, pypy-3.9, pypy-3.10 - architectures: amd64

`100% code coverage <https://codeclimate.com/github/bitranox/lib_registry/test_coverage>`_, flake8 style checking ,mypy static type checking ,tested under `Linux, macOS, Windows <https://github.com/bitranox/lib_registry/actions/workflows/python-package.yml>`_, automatic daily builds and monitoring

----

- `Try it Online`_
- `Usage`_
- `Usage from Commandline`_
- `Installation and Upgrade`_
- `Requirements`_
- `Acknowledgements`_
- `Contribute`_
- `Report Issues <https://github.com/bitranox/lib_registry/blob/master/ISSUE_TEMPLATE.md>`_
- `Pull Request <https://github.com/bitranox/lib_registry/blob/master/PULL_REQUEST_TEMPLATE.md>`_
- `Code of Conduct <https://github.com/bitranox/lib_registry/blob/master/CODE_OF_CONDUCT.md>`_
- `License`_
- `Changelog`_

----

Try it Online
-------------

You might try it right away in Jupyter Notebook by using the "launch binder" badge, or click `here <https://mybinder.org/v2/gh/{{rst_include.
repository_slug}}/master?filepath=lib_registry.ipynb>`_

Usage
-----------

python methods:

- Registry Object

.. code-block:: python

    class Registry(object):
        def __init__(self, key: Union[None, str, int] = None, computer_name: Optional[str] = None):
            """
            The Registry Class, to create the registry object.
            If a key is passed, a connection to the hive is established.

            Parameter
            ---------

            key:
                the predefined handle to connect to,
                or a key string with the hive as the first part (everything else but the hive will be ignored)
                or None (then no connection will be established)
            computer_name:
                the name of the remote computer, of the form r"\\computer_name" or "computer_name". If None, the local computer is used.

            Exceptions
            ----------
                RegistryNetworkConnectionError      if we can not reach target computer
                RegistryHKeyError                   if we can not connect to the hive
                winreg.ConnectRegistry              auditing event

            Examples
            --------

            >>> # just create the instance without connection
            >>> registry = Registry()

            >>> # test connect at init:
            >>> registry = Registry('HKCU')

            >>> # test invalid hive as string
            >>> Registry()._reg_connect('SPAM')
            Traceback (most recent call last):
                ...
            lib_registry.RegistryHKeyError: invalid KEY: "SPAM"

            >>> # test invalid hive as integer
            >>> Registry()._reg_connect(42)
            Traceback (most recent call last):
                ...
            lib_registry.RegistryHKeyError: invalid HIVE KEY: "42"

            >>> # test invalid computer to connect
            >>> Registry()._reg_connect(winreg.HKEY_LOCAL_MACHINE, computer_name='some_unknown_machine')
            Traceback (most recent call last):
                ...
            lib_registry.RegistryNetworkConnectionError: The network address "some_unknown_machine" is invalid

            >>> # test invalid network Path
            >>> Registry()._reg_connect(winreg.HKEY_LOCAL_MACHINE, computer_name=r'localhost\\ham\\spam')
            Traceback (most recent call last):
                ...
            lib_registry.RegistryNetworkConnectionError: The network path to "localhost\\ham\\spam" was not found

            """

- create_key

.. code-block:: python

        def create_key(self, key: Union[str, int], sub_key: str = '', exist_ok: bool = True, parents: bool = False) -> winreg.HKEYType:
            """
            Creates a Key, and returns a Handle to the new key


            Parameter
            ---------
            key
              either a predefined HKEY_* constant,
              a string containing the root key,
              or an already open key
            sub_key
              a string with the desired subkey relative to the key
            exist_ok
              bool, default = True
            parents
              bool, default = false


            Exceptions
            ----------
            RegistryKeyCreateError
                if we can not create the key


            Examples
            --------

            >>> # Setup
            >>> registry = Registry()
            >>> # create a key
            >>> registry.create_key(r'HKCU\\Software')
            <...PyHKEY object at ...>

            >>> # create an existing key, with exist_ok = True
            >>> registry.create_key(r'HKCU\\Software\\lib_registry_test', exist_ok=True)
            <...PyHKEY object at ...>

            >>> # create an existing key, with exist_ok = False (parent existing)
            >>> registry.create_key(r'HKCU\\Software\\lib_registry_test', exist_ok=False)
            Traceback (most recent call last):
                ...
            lib_registry.RegistryKeyCreateError: can not create key, it already exists: HKEY_CURRENT_USER...lib_registry_test

            >>> # create a key, parent not existing, with parents = False
            >>> registry.create_key(r'HKCU\\Software\\lib_registry_test\\a\\b', parents=False)
            Traceback (most recent call last):
                ...
            lib_registry.RegistryKeyCreateError: can not create key, the parent key to "HKEY_CURRENT_USER...b" does not exist

            >>> # create a key, parent not existing, with parents = True
            >>> registry.create_key(r'HKCU\\Software\\lib_registry_test\\a\\b', parents=True)
            <...PyHKEY object at ...>

            >>> # TEARDOWN
            >>> registry.delete_key(r'HKCU\\Software\\lib_registry_test', delete_subkeys=True)

            """

- delete_key

.. code-block:: python

        def delete_key(self, key: Union[str, int], sub_key: str = '', missing_ok: bool = False, delete_subkeys: bool = False) -> None:
            """
            deletes the specified key, this method can delete keys with subkeys.
            If the method succeeds, the entire key, including all of its values, is removed.

            Parameter
            ---------
            key
              either a predefined HKEY_* constant,
              a string containing the root key,
              or an already open key
            sub_key
              a string with the desired subkey relative to the key
            missing_ok
              bool, default = False
            delete_subkeys
              bool, default = False

            Exceptions
            ----------
                RegistryKeyDeleteError  If the key does not exist,
                RegistryKeyDeleteError  If the key has subkeys and delete_subkeys = False

            >>> # Setup
            >>> registry = Registry()
            >>> # create a key, parent not existing, with parents = True
            >>> registry.create_key(r'HKCU\\Software\\lib_registry_test\\a\\b', parents=True)
            <...PyHKEY object at ...>

            >>> # Delete a Key
            >>> assert registry.key_exist(r'HKCU\\Software\\lib_registry_test\\a\\b') == True
            >>> registry.delete_key(r'HKCU\\Software\\lib_registry_test\\a\\b')
            >>> assert registry.key_exist(r'HKCU\\Software\\lib_registry_test\\a\\b') == False

            >>> # Try to delete a missing Key
            >>> registry.delete_key(r'HKCU\\Software\\lib_registry_test\\a\\b')
            Traceback (most recent call last):
                ...
            lib_registry.RegistryKeyDeleteError: can not delete key none existing key ...

            >>> # Try to delete a missing Key, missing_ok = True
            >>> registry.delete_key(r'HKCU\\Software\\lib_registry_test\\a\\b')
            Traceback (most recent call last):
                ...
            lib_registry.RegistryKeyDeleteError: can not delete key none existing key ...

            >>> # Try to delete a Key with subkeys
            >>> registry.delete_key(r'HKCU\\Software\\lib_registry_test')
            Traceback (most recent call last):
                ...
            lib_registry.RegistryKeyDeleteError: can not delete none empty key ...

            >>> # Try to delete a Key with subkeys, delete_subkeys = True
            >>> registry.delete_key(r'HKCU\\Software\\lib_registry_test', delete_subkeys=True)
            >>> assert registry.key_exist(r'HKCU\\Software\\lib_registry_test') == False

            >>> # Try to delete a Key with missing_ok = True
            >>> registry.delete_key(r'HKCU\\Software\\lib_registry_test', missing_ok=True)

            """

- key_exists

.. code-block:: python

        def key_exist(self, key: Union[str, int], sub_key: str = '') -> bool:
            """
            True if the given key exists

            Parameter
            ---------
            key
              either a predefined HKEY_* constant,
              a string containing the root key,
              or an already open key

            sub_key
              a string with the desired subkey relative to the key


            Examples
            --------

            >>> Registry().key_exist(r'HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion')
            True
            >>> Registry().key_exist(r'HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\DoesNotExist')
            False

            """

Usage from Commandline
------------------------

.. code-block::

   Usage: lib_registry [OPTIONS] COMMAND [ARGS]...

     a more pythonic way to access the windows registry as winreg

   Options:
     --version                     Show the version and exit.
     --traceback / --no-traceback  return traceback information on cli
     -h, --help                    Show this message and exit.

   Commands:
     info  get program informations

Installation and Upgrade
------------------------

- Before You start, its highly recommended to update pip and setup tools:


.. code-block::

    python -m pip --upgrade pip
    python -m pip --upgrade setuptools

- to install the latest release from PyPi via pip (recommended):

.. code-block::

    python -m pip install --upgrade lib_registry


- to install the latest release from PyPi via pip, including test dependencies:

.. code-block::

    python -m pip install --upgrade lib_registry[test]

- to install the latest version from github via pip:


.. code-block::

    python -m pip install --upgrade git+https://github.com/bitranox/lib_registry.git


- include it into Your requirements.txt:

.. code-block::

    # Insert following line in Your requirements.txt:
    # for the latest Release on pypi:
    lib_registry

    # for the latest development version :
    lib_registry @ git+https://github.com/bitranox/lib_registry.git

    # to install and upgrade all modules mentioned in requirements.txt:
    python -m pip install --upgrade -r /<path>/requirements.txt


- to install the latest development version, including test dependencies from source code:

.. code-block::

    # cd ~
    $ git clone https://github.com/bitranox/lib_registry.git
    $ cd lib_registry
    python -m pip install -e .[test]

- via makefile:
  makefiles are a very convenient way to install. Here we can do much more,
  like installing virtual environments, clean caches and so on.

.. code-block:: shell

    # from Your shell's homedirectory:
    $ git clone https://github.com/bitranox/lib_registry.git
    $ cd lib_registry

    # to run the tests:
    $ make test

    # to install the package
    $ make install

    # to clean the package
    $ make clean

    # uninstall the package
    $ make uninstall

Requirements
------------
following modules will be automatically installed :

.. code-block:: bash

    ## Project Requirements
    click
    cli_exit_tools
    fake_winreg

Acknowledgements
----------------

- special thanks to "uncle bob" Robert C. Martin, especially for his books on "clean code" and "clean architecture"

Contribute
----------

I would love for you to fork and send me pull request for this project.
- `please Contribute <https://github.com/bitranox/lib_registry/blob/master/CONTRIBUTING.md>`_

License
-------

This software is licensed under the `MIT license <http://en.wikipedia.org/wiki/MIT_License>`_

---

Changelog
=========

- new MAJOR version for incompatible API changes,
- new MINOR version for added functionality in a backwards compatible manner
- new PATCH version for backwards compatible bug fixes

tasks:
    - test if caching of handles make sense, especially on network
    - documentation update
    - pathlib-like Interface
    - jupyter notebook update

v2.0.10
---------
    - update jupyter notebook
    - set secrets for pypi upload

v2.0.9
---------
2023-07-20:
    - correct error in set_value with value_type=winreg.REG_NONE

v2.0.8
---------
2023-07-20:
    - require minimum python 3.8
    - remove python 3.7 tests
    - introduce PEP517 packaging standard
    - introduce pyproject.toml build-system
    - remove mypy.ini
    - remove pytest.ini
    - remove setup.cfg
    - remove setup.py
    - remove .bettercodehub.yml
    - remove .travis.yml
    - update black config
    - clean ./tests/test_cli.py
    - add codeql badge
    - move 3rd_party_stubs outside the src directory to ``./.3rd_party_stubs``
    - add pypy 3.10 tests
    - add python 3.12-dev tests

v2.0.7
--------
2020-10-10: fix minor bugs

v2.0.6
--------
2020-10-09: service release
    - update travis build matrix for linux 3.9-dev
    - update travis build matrix (paths) for windows 3.9 / 3.10

v2.0.5
--------
2020-08-08: service release
    - fix documentation
    - fix travis
    - deprecate pycodestyle
    - implement flake8

v2.0.4
---------
2020-08-01: fix pypi deploy

v2.0.3
--------
2020-07-31: fix travis build

v2.0.2
--------
2020-07-29: feature release
    - use the new pizzacutter template
    - use cli_exit_tools

v2.0.1
--------
2020-07-16: feature release
    - fix cli test
    - enable traceback option on cli errors
    - corrected error in DeleteKey, missing_ok

v2.0.0
--------
2020-07-14 : feature release
    - fix setup.py for deploy on pypi
    - fix travis for pypi deploy testing

v2.0.0a0
--------
2020-07-13 : intermediate release
    - start to implement additional pathlib-like interface
    - implement fake-winreg to be able to develop and test under linux

v1.0.4
--------
2020-07-08 : patch release
    - new click CLI
    - use PizzaCutter Template
    - added jupyter notebook
    - reorganized modules and import
    - updated documentation

v1.0.3
--------
2019-09-02: strict mypy type checking, housekeeping

v1.0.2
--------
2019-04-10: initial PyPi release

v1.0.1
--------
2019-03-29: prevent import error when importing under linux

v1.0.0
--------
2019-03-28: Initial public release


            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "lib-registry",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "",
    "author_email": "Robert Nowotny <bitranox@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/a2/91/4c6da5a116a05570da4f3edf72b02e40a323601648417605c99ff3584936/lib_registry-2.0.10.tar.gz",
    "platform": null,
    "description": "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 <https://github\n.com/bitranox/PizzaCutter>`_ (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 <https://codeclimate.com/github/bitranox/lib_registry/test_coverage>`_, flake8 style checking ,mypy static type checking ,tested under `Linux, macOS, Windows <https://github.com/bitranox/lib_registry/actions/workflows/python-package.yml>`_, 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 <https://github.com/bitranox/lib_registry/blob/master/ISSUE_TEMPLATE.md>`_\n- `Pull Request <https://github.com/bitranox/lib_registry/blob/master/PULL_REQUEST_TEMPLATE.md>`_\n- `Code of Conduct <https://github.com/bitranox/lib_registry/blob/master/CODE_OF_CONDUCT.md>`_\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 <https://mybinder.org/v2/gh/{{rst_include.\nrepository_slug}}/master?filepath=lib_registry.ipynb>`_\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            >>> # just create the instance without connection\n            >>> registry = Registry()\n\n            >>> # test connect at init:\n            >>> registry = Registry('HKCU')\n\n            >>> # test invalid hive as string\n            >>> Registry()._reg_connect('SPAM')\n            Traceback (most recent call last):\n                ...\n            lib_registry.RegistryHKeyError: invalid KEY: \"SPAM\"\n\n            >>> # test invalid hive as integer\n            >>> Registry()._reg_connect(42)\n            Traceback (most recent call last):\n                ...\n            lib_registry.RegistryHKeyError: invalid HIVE KEY: \"42\"\n\n            >>> # test invalid computer to connect\n            >>> 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            >>> # test invalid network Path\n            >>> 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) -> 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            >>> # Setup\n            >>> registry = Registry()\n            >>> # create a key\n            >>> registry.create_key(r'HKCU\\\\Software')\n            <...PyHKEY object at ...>\n\n            >>> # create an existing key, with exist_ok = True\n            >>> registry.create_key(r'HKCU\\\\Software\\\\lib_registry_test', exist_ok=True)\n            <...PyHKEY object at ...>\n\n            >>> # create an existing key, with exist_ok = False (parent existing)\n            >>> 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            >>> # create a key, parent not existing, with parents = False\n            >>> 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            >>> # create a key, parent not existing, with parents = True\n            >>> registry.create_key(r'HKCU\\\\Software\\\\lib_registry_test\\\\a\\\\b', parents=True)\n            <...PyHKEY object at ...>\n\n            >>> # TEARDOWN\n            >>> 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) -> 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            >>> # Setup\n            >>> registry = Registry()\n            >>> # create a key, parent not existing, with parents = True\n            >>> registry.create_key(r'HKCU\\\\Software\\\\lib_registry_test\\\\a\\\\b', parents=True)\n            <...PyHKEY object at ...>\n\n            >>> # Delete a Key\n            >>> assert registry.key_exist(r'HKCU\\\\Software\\\\lib_registry_test\\\\a\\\\b') == True\n            >>> registry.delete_key(r'HKCU\\\\Software\\\\lib_registry_test\\\\a\\\\b')\n            >>> assert registry.key_exist(r'HKCU\\\\Software\\\\lib_registry_test\\\\a\\\\b') == False\n\n            >>> # Try to delete a missing Key\n            >>> 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            >>> # Try to delete a missing Key, missing_ok = True\n            >>> 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            >>> # Try to delete a Key with subkeys\n            >>> 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            >>> # Try to delete a Key with subkeys, delete_subkeys = True\n            >>> registry.delete_key(r'HKCU\\\\Software\\\\lib_registry_test', delete_subkeys=True)\n            >>> assert registry.key_exist(r'HKCU\\\\Software\\\\lib_registry_test') == False\n\n            >>> # Try to delete a Key with missing_ok = True\n            >>> 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 = '') -> 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            >>> Registry().key_exist(r'HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Windows NT\\\\CurrentVersion')\n            True\n            >>> 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 /<path>/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 <https://github.com/bitranox/lib_registry/blob/master/CONTRIBUTING.md>`_\n\nLicense\n-------\n\nThis software is licensed under the `MIT license <http://en.wikipedia.org/wiki/MIT_License>`_\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",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "a more pythonic way to access the windows registry as winreg",
    "version": "2.0.10",
    "project_urls": {
        "Changelog": "https://github.com/bitranox/lib_registry/blob/master/CHANGES.rst",
        "Documentation": "https://github.com/bitranox/lib_registry/blob/master/README.rst",
        "Homepage": "https://github.com/bitranox/lib_registry",
        "Repository": "https://github.com/bitranox/lib_registry.git"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cbfa537bc687fbc0c11c44b2b907a29c7250bde94854c2beda4f387facf1002f",
                "md5": "5ce00552b32c62991a7ca0bdffcfd973",
                "sha256": "727096e5ec90726a42be53aed61d637f53da02f7c00404d96846eb27bd6161cf"
            },
            "downloads": -1,
            "filename": "lib_registry-2.0.10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5ce00552b32c62991a7ca0bdffcfd973",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8.0",
            "size": 19241,
            "upload_time": "2023-07-21T08:50:33",
            "upload_time_iso_8601": "2023-07-21T08:50:33.726139Z",
            "url": "https://files.pythonhosted.org/packages/cb/fa/537bc687fbc0c11c44b2b907a29c7250bde94854c2beda4f387facf1002f/lib_registry-2.0.10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a2914c6da5a116a05570da4f3edf72b02e40a323601648417605c99ff3584936",
                "md5": "0c42cfc203f74184170aac9313c3fc1f",
                "sha256": "fb34a3c51327c0e57101de1b0a579b7afdfebee4d9e94d00df71357b3b604dec"
            },
            "downloads": -1,
            "filename": "lib_registry-2.0.10.tar.gz",
            "has_sig": false,
            "md5_digest": "0c42cfc203f74184170aac9313c3fc1f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8.0",
            "size": 42008,
            "upload_time": "2023-07-21T08:50:35",
            "upload_time_iso_8601": "2023-07-21T08:50:35.532738Z",
            "url": "https://files.pythonhosted.org/packages/a2/91/4c6da5a116a05570da4f3edf72b02e40a323601648417605c99ff3584936/lib_registry-2.0.10.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-21 08:50:35",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "bitranox",
    "github_project": "lib_registry",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "requirements": [],
    "lcname": "lib-registry"
}
        
Elapsed time: 0.42849s