Skip to main content

Implements the Google Partial Response protocol in Python

Project description

Build Status Coverage Status PyPI Version

Overview

Implements Google Partial Response / json-mask in Python.

jsonmask_ng is a fork of 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:

$ pip install jsonmask_ng

or directly from the source code:

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

Usage

After installation, the package can imported:

$ python
>>> import jsonmask_ng
>>> jsonmask_ng.__version__

To prune dictionaries:

>>> 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:

{
    '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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jsonmask_ng-0.4.5.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

jsonmask_ng-0.4.5-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file jsonmask_ng-0.4.5.tar.gz.

File metadata

  • Download URL: jsonmask_ng-0.4.5.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.7.17 Linux/5.15.49-linuxkit-pr

File hashes

Hashes for jsonmask_ng-0.4.5.tar.gz
Algorithm Hash digest
SHA256 ef0c62bb72302686021207411baa085fb2327b14f1f8cd7189ef31e742c05169
MD5 362034e5fd502fcbe3095dec3dbf8f70
BLAKE2b-256 1fd687b0a4db0801340b54086bed2b1302773d4262a770857b8fc73a15b00ca2

See more details on using hashes here.

File details

Details for the file jsonmask_ng-0.4.5-py3-none-any.whl.

File metadata

  • Download URL: jsonmask_ng-0.4.5-py3-none-any.whl
  • Upload date:
  • Size: 8.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.7.17 Linux/5.15.49-linuxkit-pr

File hashes

Hashes for jsonmask_ng-0.4.5-py3-none-any.whl
Algorithm Hash digest
SHA256 ce293c2809d3bd8859ea846232b85dca07a446df50542a8f74e3d14f525e4386
MD5 fe0672ed6cdcae29b092202a4591aa8c
BLAKE2b-256 560cf4151a7955204c40f0ab3563299f6fe91cc9facf3810e49952fa005e745e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page