opendp-logger


Nameopendp-logger JSON
Version 0.3.0 PyPI version JSON
download
home_pagehttps://github.com/opendp/opendp-logger
SummaryA logger wrapper for OpenDP to keep track of, import, export the AST
upload_time2023-08-17 20:23:19
maintainer
docs_urlNone
authorThe OpenDP Project
requires_python>=3.8, <4
licenseMIT
keywords opendp logger ast
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # OpenDP Logger
[![Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Python](https://img.shields.io/badge/python-3.8%20%7C%203.9%20%7C%203.10-blue)](https://www.python.org/)
[![ci tests](https://github.com/opendp/opendp-logger/actions/workflows/smoke-test.yml/badge.svg)](https://github.com/opendp/opendp-logger/actions/workflows/smoke-test.yml?query=branch%3Amain)

The OpenDP logger makes it possible to serialize and deserialize OpenDP Measurements/Transformations to/from JSON.


## Serialize
Enable logging (globally) before you build your transformations and/or measurements:

```python
from opendp_logging import enable_logging
enable_logging()
```
Once this is enabled, Transformations/Measurements have a method `.to_json()` that returns a JSON string.

## Deserialize
Deserialize a JSON string into a Transformation/Measurement by invoking `opendp_logger.make_load_json`.

# Example
```python
from opendp_logger import enable_logging
from opendp.mod import enable_features

enable_logging()
enable_features("contrib")

import opendp.transformations as trans

preprocessor = (
    # load data into a dataframe where columns are of type Vec<str>
    trans.make_split_dataframe(separator=",", col_names=["hello", "world"])
    >>
    # select a column of the dataframe
    trans.make_select_column(key="income", TOA=str)
)

# serialize the chain to json
json_obj = preprocessor.to_json()
print("json:", json_obj)

from opendp_logger import make_load_json

# reconstruct the obj from the json string
test = make_load_json(json_obj)
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/opendp/opendp-logger",
    "name": "opendp-logger",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8, <4",
    "maintainer_email": "",
    "keywords": "opendp logger ast",
    "author": "The OpenDP Project",
    "author_email": "info@opendp.org",
    "download_url": "",
    "platform": null,
    "description": "# OpenDP Logger\n[![Project Status: WIP \u2013 Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Python](https://img.shields.io/badge/python-3.8%20%7C%203.9%20%7C%203.10-blue)](https://www.python.org/)\n[![ci tests](https://github.com/opendp/opendp-logger/actions/workflows/smoke-test.yml/badge.svg)](https://github.com/opendp/opendp-logger/actions/workflows/smoke-test.yml?query=branch%3Amain)\n\nThe OpenDP logger makes it possible to serialize and deserialize OpenDP Measurements/Transformations to/from JSON.\n\n\n## Serialize\nEnable logging (globally) before you build your transformations and/or measurements:\n\n```python\nfrom opendp_logging import enable_logging\nenable_logging()\n```\nOnce this is enabled, Transformations/Measurements have a method `.to_json()` that returns a JSON string.\n\n## Deserialize\nDeserialize a JSON string into a Transformation/Measurement by invoking `opendp_logger.make_load_json`.\n\n# Example\n```python\nfrom opendp_logger import enable_logging\nfrom opendp.mod import enable_features\n\nenable_logging()\nenable_features(\"contrib\")\n\nimport opendp.transformations as trans\n\npreprocessor = (\n    # load data into a dataframe where columns are of type Vec<str>\n    trans.make_split_dataframe(separator=\",\", col_names=[\"hello\", \"world\"])\n    >>\n    # select a column of the dataframe\n    trans.make_select_column(key=\"income\", TOA=str)\n)\n\n# serialize the chain to json\njson_obj = preprocessor.to_json()\nprint(\"json:\", json_obj)\n\nfrom opendp_logger import make_load_json\n\n# reconstruct the obj from the json string\ntest = make_load_json(json_obj)\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A logger wrapper for OpenDP to keep track of, import, export the AST",
    "version": "0.3.0",
    "project_urls": {
        "Homepage": "https://github.com/opendp/opendp-logger"
    },
    "split_keywords": [
        "opendp",
        "logger",
        "ast"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1193db547e79737694a4f2aedf1212c924b23578ad056733ed4f603f84a38b4d",
                "md5": "23e280075df5331d4ac0419462e559f6",
                "sha256": "74093321625d40d3731943711be8874e0b931c7bc4de20c884887ab83e69512d"
            },
            "downloads": -1,
            "filename": "opendp_logger-0.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "23e280075df5331d4ac0419462e559f6",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8, <4",
            "size": 4288,
            "upload_time": "2023-08-17T20:23:19",
            "upload_time_iso_8601": "2023-08-17T20:23:19.668069Z",
            "url": "https://files.pythonhosted.org/packages/11/93/db547e79737694a4f2aedf1212c924b23578ad056733ed4f603f84a38b4d/opendp_logger-0.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-17 20:23:19",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "opendp",
    "github_project": "opendp-logger",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "opendp-logger"
}
        
Elapsed time: 0.57438s