From 3d33869f554691ad1c4d614aad0c626f5e034721 Mon Sep 17 00:00:00 2001 From: Denis Guerra Date: Tue, 7 Jan 2025 22:36:05 -0300 Subject: [PATCH 1/6] Fix bool filter type to handle None values --- jsonpath_ng/ext/filter.py | 7 +------ tests/test_jsonpath_rw_ext.py | 13 +++++++++++++ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/jsonpath_ng/ext/filter.py b/jsonpath_ng/ext/filter.py index e0bd48a..6ec7d1c 100644 --- a/jsonpath_ng/ext/filter.py +++ b/jsonpath_ng/ext/filter.py @@ -104,16 +104,11 @@ def find(self, datum): found = [] for data in datum: value = data.value - if isinstance(self.value, int): + if type(self.value) is int: try: value = int(value) except ValueError: continue - elif isinstance(self.value, bool): - try: - value = bool(value) - except ValueError: - continue if OPERATOR_MAP[self.op](value, self.value): found.append(data) diff --git a/tests/test_jsonpath_rw_ext.py b/tests/test_jsonpath_rw_ext.py index a14fd72..ca1c3e9 100644 --- a/tests/test_jsonpath_rw_ext.py +++ b/tests/test_jsonpath_rw_ext.py @@ -484,6 +484,19 @@ ["green"], id="boolean-filter-string-true-string-literal", ), + pytest.param( + "foo[?flag = true].color", + { + "foo": [ + {"color": "blue", "flag": True}, + {"color": "green", "flag": 2}, + {"color": "red", "flag": "hi"}, + {"color": "gray", "flag": None}, + ] + }, + ["blue"], + id="boolean-filter-with-null", + ), ) From ea57437b395d79a7efecabab94313caff447b1d8 Mon Sep 17 00:00:00 2001 From: Denis Guerra Date: Wed, 8 Jan 2025 18:07:44 -0300 Subject: [PATCH 2/6] =?UTF-8?q?Bump=20version:=201.7.0=20=E2=86=92=201.7.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- History.md | 4 ++++ jsonpath_ng/__init__.py | 2 +- setup.py | 6 +++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/History.md b/History.md index a058357..a18e9cb 100644 --- a/History.md +++ b/History.md @@ -1,3 +1,7 @@ +1.7.1 / 2025-01-08 +=================== + * Fix bool filter type to handle None values + 1.7.0 / 2024-10-11 =================== * Allow raw numeric values to be used as keys diff --git a/jsonpath_ng/__init__.py b/jsonpath_ng/__init__.py index 938f88c..d236f33 100644 --- a/jsonpath_ng/__init__.py +++ b/jsonpath_ng/__init__.py @@ -3,4 +3,4 @@ # Current package version -__version__ = '1.7.0' +__version__ = '1.7.1' diff --git a/setup.py b/setup.py index 9cec0f6..eb6ef07 100644 --- a/setup.py +++ b/setup.py @@ -3,8 +3,8 @@ setuptools.setup( - name='jsonpath-ng', - version='1.7.0', + name='dg-jsonpath-ng', + version='1.7.1', description=( 'A final implementation of JSONPath for Python that aims to be ' 'standard compliant, including arithmetic and binary comparison ' @@ -12,7 +12,7 @@ ), author='Tomas Aparicio', author_email='tomas@aparicio.me', - url='https://github.com/h2non/jsonpath-ng', + url='https://github.com/denisfrm/jsonpath-ng.git', license='Apache 2.0', long_description=io.open('README.rst', encoding='utf-8').read(), packages=['jsonpath_ng', 'jsonpath_ng.bin', 'jsonpath_ng.ext'], From 62c20080e3c37869efb0f0c8b5ba144116c9756e Mon Sep 17 00:00:00 2001 From: Denis Guerra Date: Wed, 8 Jan 2025 18:15:59 -0300 Subject: [PATCH 3/6] =?UTF-8?q?Bump=20version:=201.7.1=20=E2=86=92=201.7.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jsonpath_ng/__init__.py | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/jsonpath_ng/__init__.py b/jsonpath_ng/__init__.py index d236f33..4d4d899 100644 --- a/jsonpath_ng/__init__.py +++ b/jsonpath_ng/__init__.py @@ -3,4 +3,4 @@ # Current package version -__version__ = '1.7.1' +__version__ = '1.7.2' diff --git a/setup.py b/setup.py index eb6ef07..8263429 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ setuptools.setup( name='dg-jsonpath-ng', - version='1.7.1', + version='1.7.2', description=( 'A final implementation of JSONPath for Python that aims to be ' 'standard compliant, including arithmetic and binary comparison ' From b6764e428a80d069172c0ab013f07da35c9c6fe4 Mon Sep 17 00:00:00 2001 From: Denis Guerra Date: Sun, 1 Feb 2026 23:21:00 -0300 Subject: [PATCH 4/6] Bump version: 1.7.2 -> 1.7.3 --- jsonpath_ng/__init__.py | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/jsonpath_ng/__init__.py b/jsonpath_ng/__init__.py index 4d4d899..774ed7f 100644 --- a/jsonpath_ng/__init__.py +++ b/jsonpath_ng/__init__.py @@ -3,4 +3,4 @@ # Current package version -__version__ = '1.7.2' +__version__ = '1.7.3' diff --git a/setup.py b/setup.py index a90b459..268d4ae 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ setuptools.setup( name='dg-jsonpath-ng', - version='1.7.2', + version='1.7.3', description=( 'A final implementation of JSONPath for Python that aims to be ' 'standard compliant, including arithmetic and binary comparison ' From 0f976e94f5bb9f3380fae6edf5bb56330d4a4657 Mon Sep 17 00:00:00 2001 From: Denis Guerra Date: Sun, 1 Feb 2026 23:48:16 -0300 Subject: [PATCH 5/6] Create publish workflow --- .github/workflows/publish.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..72c47e7 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,33 @@ +name: Publish Python package + +on: + release: + types: [published] + workflow_dispatch: + inputs: + ref: + description: 'Branch or tag to publish (e.g. main or v1.2.3)' + required: false + default: 'main' + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + # Use the provided ref when manually triggered, otherwise fall back to the event ref + ref: ${{ github.event.inputs.ref != '' && github.event.inputs.ref || github.ref }} + - uses: actions/setup-python@v4 + with: + python-version: '3.11' + - name: Install build tools + run: pip install --upgrade build twine + - name: Build artifacts + run: python -m build + - name: Publish to PyPI + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} + run: | + python -m twine upload dist/* From 623ad0c233162890f085ea045d2ac34e417ca882 Mon Sep 17 00:00:00 2001 From: Denis Guerra Date: Sun, 1 Feb 2026 23:54:13 -0300 Subject: [PATCH 6/6] Bump version: 1.7.3 -> 1.7.4 --- jsonpath_ng/__init__.py | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/jsonpath_ng/__init__.py b/jsonpath_ng/__init__.py index 774ed7f..9d06b7e 100644 --- a/jsonpath_ng/__init__.py +++ b/jsonpath_ng/__init__.py @@ -3,4 +3,4 @@ # Current package version -__version__ = '1.7.3' +__version__ = '1.7.4' diff --git a/setup.py b/setup.py index 268d4ae..9dc2321 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ setuptools.setup( name='dg-jsonpath-ng', - version='1.7.3', + version='1.7.4', description=( 'A final implementation of JSONPath for Python that aims to be ' 'standard compliant, including arithmetic and binary comparison '