keyraser_client


Namekeyraser_client JSON
Version 0.5.0 PyPI version JSON
download
home_pageNone
SummaryPython client library for the Keyraser key shredding system
upload_time2024-05-26 18:30:26
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords machine learning encryption io network data privacy
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # keyraser python client

 [![pipeline status](https://gitlab.com/kantai/keyraser/python-client/badges/mainline/pipeline.svg)](https://gitlab.com/kantai/multimeter/-/commits/mainline)
 [![coverage report](https://gitlab.com/kantai/keyraser/python-client/badges/mainline/coverage.svg)](https://gitlab.com/kantai/multimeter/-/commits/mainline)

Keyraser is a system that helps you to use key-shredding for managing data privacy in
distributed system. This python library includes a client that allows to encrypt or
decrypt data with keys that are managed by keyraser.

## What it does

The library contains a single class `Client` that exposes methods for encrypting or
decrypting data that is either provided in form of files, python io streams or `bytes`.
The data is encrypted with encryption keys that are specific for the owning entity of
the data. Encrypted data contains an identifier of the key that it was encrypted with
so it can be automatically fetched from the keyraser keystore.

## How it works

Internally the library uses the
[Keyraser client binaries](https://docs.kant.ai/keyraser/go-client) for en-/decrypting
the data. The python process communicates with the cli client in a subprocess using
stdout/stdin.

Using the library is quite easy:

```python
import keyraser_client

...

client = keyraser_client.Client(
    keystore_address='localhost:1996',
    credential_path='/path/to/credential.kred',
)

src = '/path/to/ndjson/file'
dest = '/path/to/encrypted/file'

client.encrypt(
    keyraser_client.NdjsonFormat(id_property = 'user_id'), src, dest,
)
```

After importing the module we can create a new `Client` to which we need to provide
configuration parameter like the address of the keystore, from where the keys should be
fetched and the credential that should be used for authenticating the client.
With the client we can then `encrypt` or `decrypt` by proving the arguments on where to
read the data from and where to write it into.

For more information take a look at the latest
[user guide](https://docs.kant.ai/keyraser/python-client/latest/user_guide/).

## Develop

The Keyraser python client uses [tox](https://tox.wiki/en/latest/index.html) to build and test the library.
Tox runs all tests on different python versions, can generate the documentation and run
linters and style checks to improve the code quality.
In order to install all the necessary python modules, please run:

```bash
pip install tox
```

Afterwards the tests can be run by just calling

```bash
tox
```

from the project directory. For this to work, you need to have multiple python
interpreters installed. If you don't want to run the tests on all supported platforms
just edit the tox.ini file and set
```
envlist = py38,py39,py310,py311,py312
```
to contain only the python version you want to use. Another option is to run tox with
the additional command line argument
['--skip_missing_interpreters'](https://tox.wiki/en/latest/config.html#conf-skip_missing_interpreters)
which skips python versions that aren't installed.

Alternatively, one can use [pyenv](https://github.com/pyenv/pyenv) which will use the
available python version and skip the others. For this to work, export the 
`VIRTUALENV_DISCOVERY` environment variable with a value of `pyenv`.

```bash
export VIRTUALENV_DISCOVERY=pyenv
```

## Documentation

The latest version of the documentation can always be found under https://docs.kant.ai/keyraser/python-client/latest.
The documentation is written in [Markdown](https://daringfireball.net/projects/markdown/)
and is located in the `docs` directory of the project.
It can be built into static HTML by using [MkDocs](https://www.mkdocs.org/).
In order to manually generate the documentation we can use tox to build the HTML pages from our markdown.

```bash
tox -e docs
```

## Release

### Releasing a new package version

Releasing new versions of multimeter is done using [flit](https://flit.readthedocs.io/en/latest/).

```bash
pip install flit
```

In order to be able to publish a new release, you need an account with PyPI or their
respective test environment.

Add those accounts into your `~.pypirc`:
```
[distutils]
index-servers =
  pypi
  pypitest

[pypi]
username: <my-user>

[pypitest]
repository: https://test.pypi.org/legacy/
username: <my-test-user>
```


### Publishing a new release to test

```bash
flit publish --repository pypitest
```

### Releasing a new version of the documentation

The package uses [mike](https://github.com/jimporter/mike)
to manage multiple versions of the documentation. The already generated documentation is kept
in the `docs-deployment` branch and will be automatically deployed, if the branch is pushed to
the repository.

In order to build a new version of the documentation, we need to use the corresponding tox environment:

```bash
VERSION_TAG='<my-version>' tox -e docs-release
```

The `VERSION_TAG` environment variable should be set to the new version in format '<major>.<minor>'.
This will build the documentation and add it as new commits to the `docs-deployment` branch.

By pushing the updated branch to the gitlab repository, the documentation will be automatically
deployed to [the official documentation website](https://docs.kant.ai/keyraser/python-client).

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "keyraser_client",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "machine learning, encryption, io, network, data, privacy",
    "author": null,
    "author_email": "Christoph Emonds <chris+git@kant.ai>",
    "download_url": "https://files.pythonhosted.org/packages/6f/ea/3b933c6c6dee4368f24ab6e3b16f3c9603befb8a50d16f3b579f60a2fa57/keyraser_client-0.5.0.tar.gz",
    "platform": null,
    "description": "# keyraser python client\n\n [![pipeline status](https://gitlab.com/kantai/keyraser/python-client/badges/mainline/pipeline.svg)](https://gitlab.com/kantai/multimeter/-/commits/mainline)\n [![coverage report](https://gitlab.com/kantai/keyraser/python-client/badges/mainline/coverage.svg)](https://gitlab.com/kantai/multimeter/-/commits/mainline)\n\nKeyraser is a system that helps you to use key-shredding for managing data privacy in\ndistributed system. This python library includes a client that allows to encrypt or\ndecrypt data with keys that are managed by keyraser.\n\n## What it does\n\nThe library contains a single class `Client` that exposes methods for encrypting or\ndecrypting data that is either provided in form of files, python io streams or `bytes`.\nThe data is encrypted with encryption keys that are specific for the owning entity of\nthe data. Encrypted data contains an identifier of the key that it was encrypted with\nso it can be automatically fetched from the keyraser keystore.\n\n## How it works\n\nInternally the library uses the\n[Keyraser client binaries](https://docs.kant.ai/keyraser/go-client) for en-/decrypting\nthe data. The python process communicates with the cli client in a subprocess using\nstdout/stdin.\n\nUsing the library is quite easy:\n\n```python\nimport keyraser_client\n\n...\n\nclient = keyraser_client.Client(\n    keystore_address='localhost:1996',\n    credential_path='/path/to/credential.kred',\n)\n\nsrc = '/path/to/ndjson/file'\ndest = '/path/to/encrypted/file'\n\nclient.encrypt(\n    keyraser_client.NdjsonFormat(id_property = 'user_id'), src, dest,\n)\n```\n\nAfter importing the module we can create a new `Client` to which we need to provide\nconfiguration parameter like the address of the keystore, from where the keys should be\nfetched and the credential that should be used for authenticating the client.\nWith the client we can then `encrypt` or `decrypt` by proving the arguments on where to\nread the data from and where to write it into.\n\nFor more information take a look at the latest\n[user guide](https://docs.kant.ai/keyraser/python-client/latest/user_guide/).\n\n## Develop\n\nThe Keyraser python client uses [tox](https://tox.wiki/en/latest/index.html) to build and test the library.\nTox runs all tests on different python versions, can generate the documentation and run\nlinters and style checks to improve the code quality.\nIn order to install all the necessary python modules, please run:\n\n```bash\npip install tox\n```\n\nAfterwards the tests can be run by just calling\n\n```bash\ntox\n```\n\nfrom the project directory. For this to work, you need to have multiple python\ninterpreters installed. If you don't want to run the tests on all supported platforms\njust edit the tox.ini file and set\n```\nenvlist = py38,py39,py310,py311,py312\n```\nto contain only the python version you want to use. Another option is to run tox with\nthe additional command line argument\n['--skip_missing_interpreters'](https://tox.wiki/en/latest/config.html#conf-skip_missing_interpreters)\nwhich skips python versions that aren't installed.\n\nAlternatively, one can use [pyenv](https://github.com/pyenv/pyenv) which will use the\navailable python version and skip the others. For this to work, export the \n`VIRTUALENV_DISCOVERY` environment variable with a value of `pyenv`.\n\n```bash\nexport VIRTUALENV_DISCOVERY=pyenv\n```\n\n## Documentation\n\nThe latest version of the documentation can always be found under https://docs.kant.ai/keyraser/python-client/latest.\nThe documentation is written in [Markdown](https://daringfireball.net/projects/markdown/)\nand is located in the `docs` directory of the project.\nIt can be built into static HTML by using [MkDocs](https://www.mkdocs.org/).\nIn order to manually generate the documentation we can use tox to build the HTML pages from our markdown.\n\n```bash\ntox -e docs\n```\n\n## Release\n\n### Releasing a new package version\n\nReleasing new versions of multimeter is done using [flit](https://flit.readthedocs.io/en/latest/).\n\n```bash\npip install flit\n```\n\nIn order to be able to publish a new release, you need an account with PyPI or their\nrespective test environment.\n\nAdd those accounts into your `~.pypirc`:\n```\n[distutils]\nindex-servers =\n  pypi\n  pypitest\n\n[pypi]\nusername: <my-user>\n\n[pypitest]\nrepository: https://test.pypi.org/legacy/\nusername: <my-test-user>\n```\n\n\n### Publishing a new release to test\n\n```bash\nflit publish --repository pypitest\n```\n\n### Releasing a new version of the documentation\n\nThe package uses [mike](https://github.com/jimporter/mike)\nto manage multiple versions of the documentation. The already generated documentation is kept\nin the `docs-deployment` branch and will be automatically deployed, if the branch is pushed to\nthe repository.\n\nIn order to build a new version of the documentation, we need to use the corresponding tox environment:\n\n```bash\nVERSION_TAG='<my-version>' tox -e docs-release\n```\n\nThe `VERSION_TAG` environment variable should be set to the new version in format '<major>.<minor>'.\nThis will build the documentation and add it as new commits to the `docs-deployment` branch.\n\nBy pushing the updated branch to the gitlab repository, the documentation will be automatically\ndeployed to [the official documentation website](https://docs.kant.ai/keyraser/python-client).\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Python client library for the Keyraser key shredding system",
    "version": "0.5.0",
    "project_urls": {
        "Documentation": "https://docs.kant.ai/keyraser-client/latest/",
        "Source": "https://gitlab.com/kantai/keyraser/python-client/"
    },
    "split_keywords": [
        "machine learning",
        " encryption",
        " io",
        " network",
        " data",
        " privacy"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "c6ab284e81270f39ef700dd5f38ded8e2b903d401562e793a1b5749a2147a1fb",
                "md5": "bd0be759d56c4a29ff40123f775c2019",
                "sha256": "efc9c44ee53d8117fe4749e2ca184277589a4fc6cd1320ffce24796e5b1f5c29"
            },
            "downloads": -1,
            "filename": "keyraser_client-0.5.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "bd0be759d56c4a29ff40123f775c2019",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 12054,
            "upload_time": "2024-05-26T18:30:24",
            "upload_time_iso_8601": "2024-05-26T18:30:24.477783Z",
            "url": "https://files.pythonhosted.org/packages/c6/ab/284e81270f39ef700dd5f38ded8e2b903d401562e793a1b5749a2147a1fb/keyraser_client-0.5.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "6fea3b933c6c6dee4368f24ab6e3b16f3c9603befb8a50d16f3b579f60a2fa57",
                "md5": "5b81abd5159c62bc6e99d4dafd5f2970",
                "sha256": "989099236fce346f2a8ca47b214da91776969b034fcc4aeb66e6d262c69239bb"
            },
            "downloads": -1,
            "filename": "keyraser_client-0.5.0.tar.gz",
            "has_sig": false,
            "md5_digest": "5b81abd5159c62bc6e99d4dafd5f2970",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 43494,
            "upload_time": "2024-05-26T18:30:26",
            "upload_time_iso_8601": "2024-05-26T18:30:26.437720Z",
            "url": "https://files.pythonhosted.org/packages/6f/ea/3b933c6c6dee4368f24ab6e3b16f3c9603befb8a50d16f3b579f60a2fa57/keyraser_client-0.5.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-26 18:30:26",
    "github": false,
    "gitlab": true,
    "bitbucket": false,
    "codeberg": false,
    "gitlab_user": "kantai",
    "gitlab_project": "keyraser",
    "lcname": "keyraser_client"
}
        
Elapsed time: 0.30519s