handyman


Namehandyman JSON
Version 0.2.2 PyPI version JSON
download
home_pagehttps://gitlab.com/vernacularai/tools/handyman
SummarySkit utils package for ML Services
upload_time2022-08-17 14:30:48
maintainer
docs_urlNone
authorSkit.ai
requires_python>=3.5
licenseApache 2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Handyman

Common utility framework for ML Services

## Install

1. To install the handyman library, please use the following command in case of [_pip_](https://pip.pypa.io/en/stable/):

```
    pip install handyman
```

* Or add handyman as a poetry dependency.

```
    handyman = 0.2.0
```

## Usage

The handyman library currently consists of the following packages:

* `exceptions`
* `io`
* `json_utils`
* `log`
* `prometheus`
* `sentry`
* `crypto`

#### Crypto

Full example of new client onboarding to encryption/decryption to deletion of the client

##### Generate data key for client (onboarding)
``` python
    from handyman.crypto import generate_new_data_key

    # Random client uuid for example usage purpose
    client_uuid = '6a624995-a0f4-43e1-b331-1716457962ce'

    # Generate data key for new client (while onboarding)
    generate_new_data_key(client_uuid)
    # Output - ('vault:v1:tXZ4nHIs3G8xhbLWMuMM8kzdLDgG7pr8B/uyNTz8svK2maNFZM8tkwU/ribGQQO6/5K7Pg2TeOSLia2b', None)

    # Store the variable for example usage purpose
    encrypted_data_key = 'vault:v1:tXZ4nHIs3G8xhbLWMuMM8kzdLDgG7pr8B/uyNTz8svK2maNFZM8tkwU/ribGQQO6/5K7Pg2TeOSLia2b'
```

##### Encrypt data with newly created client
``` python
    from handyman.crypto import encrypt_string

    # Encrypt plaintext
    encrypt_string("hello world", client_uuid, encrypted_data_key)
    # Output - ('GICD7oOmX0KbaBzeqzvOxtmK2ntjRH7kiFMmgKH8F6FYbvibASCM', None)

    # Store the variable for example usage purpose
    encrypted_data = 'GICD7oOmX0KbaBzeqzvOxtmK2ntjRH7kiFMmgKH8F6FYbvibASCM'
```

##### Decrypt data with the same client
``` python
    from handyman.crypto import decrypt_base64_string

    # Decrypt data (2nd return parameter is an exception if any)
    decrypt_base64_string(encrypted_data, client_uuid, encrypted_data_key)
    # Output - (b'hello world', None)
    # Decrypt data to string (2nd return parameter is an exception if any)
    decrypt_base64_string(encrypted_data, client_uuid, encrypted_data_key, decode_to_str=True)
    # Output - ('hello world', None)
```

##### Delete client (offboarding)
``` python
    from handyman.crypto import transit_delete_key

    # Delete client (offboarding)
    transit_delete_key(client_uuid)
```


To use any of the packages stated above, please use:

    from handyman import <package name>

## Publish

Create a distribution package:

    python setup.py sdist

Publish to PyPi:


    pip install twine

    twine upload dist/*

You will be prompted to enter username and password, if you don't have credentials contact `@devops`.
            

Raw data

            {
    "_id": null,
    "home_page": "https://gitlab.com/vernacularai/tools/handyman",
    "name": "handyman",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.5",
    "maintainer_email": "",
    "keywords": "",
    "author": "Skit.ai",
    "author_email": "deepankar@vernacular.ai",
    "download_url": "https://files.pythonhosted.org/packages/e1/c3/fb83ca2d176c5ca7d533973a6a922f1a760482d52db5ee14b222473be322/handyman-0.2.2.tar.gz",
    "platform": "Posix; MacOS X; Windows",
    "description": "# Handyman\n\nCommon utility framework for ML Services\n\n## Install\n\n1. To install the handyman library, please use the following command in case of [_pip_](https://pip.pypa.io/en/stable/):\n\n```\n    pip install handyman\n```\n\n* Or add handyman as a poetry dependency.\n\n```\n    handyman = 0.2.0\n```\n\n## Usage\n\nThe handyman library currently consists of the following packages:\n\n* `exceptions`\n* `io`\n* `json_utils`\n* `log`\n* `prometheus`\n* `sentry`\n* `crypto`\n\n#### Crypto\n\nFull example of new client onboarding to encryption/decryption to deletion of the client\n\n##### Generate data key for client (onboarding)\n``` python\n    from handyman.crypto import generate_new_data_key\n\n    # Random client uuid for example usage purpose\n    client_uuid = '6a624995-a0f4-43e1-b331-1716457962ce'\n\n    # Generate data key for new client (while onboarding)\n    generate_new_data_key(client_uuid)\n    # Output - ('vault:v1:tXZ4nHIs3G8xhbLWMuMM8kzdLDgG7pr8B/uyNTz8svK2maNFZM8tkwU/ribGQQO6/5K7Pg2TeOSLia2b', None)\n\n    # Store the variable for example usage purpose\n    encrypted_data_key = 'vault:v1:tXZ4nHIs3G8xhbLWMuMM8kzdLDgG7pr8B/uyNTz8svK2maNFZM8tkwU/ribGQQO6/5K7Pg2TeOSLia2b'\n```\n\n##### Encrypt data with newly created client\n``` python\n    from handyman.crypto import encrypt_string\n\n    # Encrypt plaintext\n    encrypt_string(\"hello world\", client_uuid, encrypted_data_key)\n    # Output - ('GICD7oOmX0KbaBzeqzvOxtmK2ntjRH7kiFMmgKH8F6FYbvibASCM', None)\n\n    # Store the variable for example usage purpose\n    encrypted_data = 'GICD7oOmX0KbaBzeqzvOxtmK2ntjRH7kiFMmgKH8F6FYbvibASCM'\n```\n\n##### Decrypt data with the same client\n``` python\n    from handyman.crypto import decrypt_base64_string\n\n    # Decrypt data (2nd return parameter is an exception if any)\n    decrypt_base64_string(encrypted_data, client_uuid, encrypted_data_key)\n    # Output - (b'hello world', None)\n    # Decrypt data to string (2nd return parameter is an exception if any)\n    decrypt_base64_string(encrypted_data, client_uuid, encrypted_data_key, decode_to_str=True)\n    # Output - ('hello world', None)\n```\n\n##### Delete client (offboarding)\n``` python\n    from handyman.crypto import transit_delete_key\n\n    # Delete client (offboarding)\n    transit_delete_key(client_uuid)\n```\n\n\nTo use any of the packages stated above, please use:\n\n    from handyman import <package name>\n\n## Publish\n\nCreate a distribution package:\n\n    python setup.py sdist\n\nPublish to PyPi:\n\n\n    pip install twine\n\n    twine upload dist/*\n\nYou will be prompted to enter username and password, if you don't have credentials contact `@devops`.",
    "bugtrack_url": null,
    "license": "Apache 2.0",
    "summary": "Skit utils package for ML Services",
    "version": "0.2.2",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "dd84d0ae97174367866802af592b668c",
                "sha256": "c12b292cae72e510c7a18373f51a92c6bec1dd93a0a0281af76c8005520bacb9"
            },
            "downloads": -1,
            "filename": "handyman-0.2.2.tar.gz",
            "has_sig": false,
            "md5_digest": "dd84d0ae97174367866802af592b668c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.5",
            "size": 15830,
            "upload_time": "2022-08-17T14:30:48",
            "upload_time_iso_8601": "2022-08-17T14:30:48.521019Z",
            "url": "https://files.pythonhosted.org/packages/e1/c3/fb83ca2d176c5ca7d533973a6a922f1a760482d52db5ee14b222473be322/handyman-0.2.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-08-17 14:30:48",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "handyman"
}
        
Elapsed time: 0.40897s