jsonmask-ng


Namejsonmask-ng JSON
Version 0.4.4 PyPI version JSON
download
home_pagehttps://github.com/juanyque/jsonmask_ng
SummaryImplements the Google Partial Response protocol in Python
upload_time2023-08-31 18:24:58
maintainer
docs_urlNone
authorJuan Garcia Longaron
requires_python>=3.7,<3.12
licenseMIT
keywords jsonmask_ng jsonmask json google partial response
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage
            [![Build Status](https://img.shields.io/travis/juanyque/jsonmask_ng/master.svg)](https://travis-ci.org/juanyque/jsonmask_ng) [![Coverage Status](https://img.shields.io/coveralls/juanyque/jsonmask_ng/master.svg)](https://coveralls.io/r/juanyque/jsonmask_ng) [![PyPI Version](https://img.shields.io/pypi/v/jsonmask_ng.svg)](https://pypi.org/project/jsonmask_ng)

# Overview

Implements [Google Partial Response](https://developers.google.com/discovery/v1/performance#partial-response) / [`json-mask`](https://github.com/nemtsov/json-mask) in Python.

jsonmask_ng is a fork of [jsonmask](https://github.com/zapier/jsonmask) from Zapier that seems discontinued.

## Requirements

- Python 3.7
- Python 3.8
- Python 3.9
- Python 3.10
- Python 3.11

## Installation

Install jsonmask_ng with pip:

```sh
$ pip install jsonmask_ng
```

or directly from the source code:

```sh
$ git clone https://github.com/juanyque/jsonmask_ng.git
$ cd jsonmask_ng
$ python setup.py install
```

# Usage

After installation, the package can imported:

```sh
$ python
>>> import jsonmask_ng
>>> jsonmask_ng.__version__
```

To prune dictionaries:

```py
>>> import jsonmask_ng
>>> mask = jsonmask_ng.parse_fields('a,b(c,d)')
>>> jsonmask_ng.apply_json_mask(
    {
        'a': {
            'nested_within_a': True,
        },
        'b': {
            'c': True,
            'd': {'Will get included?': 'Yes'},
            'e': 'Tough luck here',
        },
        'c': 'Definitely hopeless',
    },
    mask,
)
```

Output:

```py
{
    'a': {
        'nested_within_a': True,
    },
    'b': {
        'c': True,
        'd': {'Will get included?': 'Yes'},
    },
}
```

## Contribute

To setup an appropriate dev environment:

- With docker environment available
- run: `./docker_start.sh``

- run tests `make test`

- Clean (test, cache, ...) `make clean`

- Clean (test, cache, ... including virtualenv) `make clean-all` (you will need a `make all` after this)

- Build dist package: `make build`

- Set PyPI credentials: `poetry config pypi-token.pypi pypi-xxxxxTOKENXxxx` (find token in `~/.pypirc` file or create a new one on https://pypi.org/manage/account/token/)

- Build dist package: `make upload`

### Util commands:

- To fix poetry.lock with minimal changes: `poetry lock --no-update`
- To fix poetry.lock updating package versions: `poetry lock` (this could don't work)
- After `poetry lock...` probably you will need to do `make all` to update packages on virtualenv

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/juanyque/jsonmask_ng",
    "name": "jsonmask-ng",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7,<3.12",
    "maintainer_email": "",
    "keywords": "jsonmask_ng,jsonmask,json,google partial response",
    "author": "Juan Garcia Longaron",
    "author_email": "juan.mobilife@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/1d/f4/d584a285cfff7d8a696cab9322f835a2cb43c1289e1a4bb6480dfef703e7/jsonmask_ng-0.4.4.tar.gz",
    "platform": null,
    "description": "[![Build Status](https://img.shields.io/travis/juanyque/jsonmask_ng/master.svg)](https://travis-ci.org/juanyque/jsonmask_ng) [![Coverage Status](https://img.shields.io/coveralls/juanyque/jsonmask_ng/master.svg)](https://coveralls.io/r/juanyque/jsonmask_ng) [![PyPI Version](https://img.shields.io/pypi/v/jsonmask_ng.svg)](https://pypi.org/project/jsonmask_ng)\n\n# Overview\n\nImplements [Google Partial Response](https://developers.google.com/discovery/v1/performance#partial-response) / [`json-mask`](https://github.com/nemtsov/json-mask) in Python.\n\njsonmask_ng is a fork of [jsonmask](https://github.com/zapier/jsonmask) from Zapier that seems discontinued.\n\n## Requirements\n\n- Python 3.7\n- Python 3.8\n- Python 3.9\n- Python 3.10\n- Python 3.11\n\n## Installation\n\nInstall jsonmask_ng with pip:\n\n```sh\n$ pip install jsonmask_ng\n```\n\nor directly from the source code:\n\n```sh\n$ git clone https://github.com/juanyque/jsonmask_ng.git\n$ cd jsonmask_ng\n$ python setup.py install\n```\n\n# Usage\n\nAfter installation, the package can imported:\n\n```sh\n$ python\n>>> import jsonmask_ng\n>>> jsonmask_ng.__version__\n```\n\nTo prune dictionaries:\n\n```py\n>>> import jsonmask_ng\n>>> mask = jsonmask_ng.parse_fields('a,b(c,d)')\n>>> jsonmask_ng.apply_json_mask(\n    {\n        'a': {\n            'nested_within_a': True,\n        },\n        'b': {\n            'c': True,\n            'd': {'Will get included?': 'Yes'},\n            'e': 'Tough luck here',\n        },\n        'c': 'Definitely hopeless',\n    },\n    mask,\n)\n```\n\nOutput:\n\n```py\n{\n    'a': {\n        'nested_within_a': True,\n    },\n    'b': {\n        'c': True,\n        'd': {'Will get included?': 'Yes'},\n    },\n}\n```\n\n## Contribute\n\nTo setup an appropriate dev environment:\n\n- With docker environment available\n- run: `./docker_start.sh``\n\n- run tests `make test`\n\n- Clean (test, cache, ...) `make clean`\n\n- Clean (test, cache, ... including virtualenv) `make clean-all` (you will need a `make all` after this)\n\n- Build dist package: `make build`\n\n- Set PyPI credentials: `poetry config pypi-token.pypi pypi-xxxxxTOKENXxxx` (find token in `~/.pypirc` file or create a new one on https://pypi.org/manage/account/token/)\n\n- Build dist package: `make upload`\n\n### Util commands:\n\n- To fix poetry.lock with minimal changes: `poetry lock --no-update`\n- To fix poetry.lock updating package versions: `poetry lock` (this could don't work)\n- After `poetry lock...` probably you will need to do `make all` to update packages on virtualenv\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Implements the Google Partial Response protocol in Python",
    "version": "0.4.4",
    "project_urls": {
        "Documentation": "https://github.com/juanyque/jsonmask_ng/blob/master/README.md",
        "Homepage": "https://github.com/juanyque/jsonmask_ng",
        "Repository": "https://github.com/juanyque/jsonmask_ng"
    },
    "split_keywords": [
        "jsonmask_ng",
        "jsonmask",
        "json",
        "google partial response"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9d02e56edc97b49322ca5707c442b3906481ca4c063dbdcc1aa621365efc7886",
                "md5": "741cd22cca221604a9a5deb2621ddf82",
                "sha256": "90b553b72164369357a2050b292312ceabf61d134f28fc8c67274566e9a8a1ba"
            },
            "downloads": -1,
            "filename": "jsonmask_ng-0.4.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "741cd22cca221604a9a5deb2621ddf82",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7,<3.12",
            "size": 8811,
            "upload_time": "2023-08-31T18:24:56",
            "upload_time_iso_8601": "2023-08-31T18:24:56.954791Z",
            "url": "https://files.pythonhosted.org/packages/9d/02/e56edc97b49322ca5707c442b3906481ca4c063dbdcc1aa621365efc7886/jsonmask_ng-0.4.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1df4d584a285cfff7d8a696cab9322f835a2cb43c1289e1a4bb6480dfef703e7",
                "md5": "9fc09807cb41326fab05fffa7a9b0166",
                "sha256": "0c859bb7227c2384c9371d0daf61a20f3a03c2866758be375682c3f3b832eeb2"
            },
            "downloads": -1,
            "filename": "jsonmask_ng-0.4.4.tar.gz",
            "has_sig": false,
            "md5_digest": "9fc09807cb41326fab05fffa7a9b0166",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7,<3.12",
            "size": 8148,
            "upload_time": "2023-08-31T18:24:58",
            "upload_time_iso_8601": "2023-08-31T18:24:58.503783Z",
            "url": "https://files.pythonhosted.org/packages/1d/f4/d584a285cfff7d8a696cab9322f835a2cb43c1289e1a4bb6480dfef703e7/jsonmask_ng-0.4.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-31 18:24:58",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "juanyque",
    "github_project": "jsonmask_ng",
    "travis_ci": true,
    "coveralls": true,
    "github_actions": false,
    "requirements": [],
    "lcname": "jsonmask-ng"
}
        
Elapsed time: 0.13438s