Skip to content

Commit 7977e15

Browse files
committed
remove jsonpath_rw
1 parent 030c371 commit 7977e15

File tree

12 files changed

+25
-28
lines changed

12 files changed

+25
-28
lines changed

fixed-requirements.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ amqp==5.3.1
1010
apscheduler==3.11.0
1111
chardet==5.2.0
1212
cffi==1.17.1
13-
cryptography=<47.0.0
13+
cryptography==45.0.7
1414
eventlet==0.39.1
1515
flex==6.14.1
1616
# Note: installs gitpython==3.1.37 (security fixed) under py3.8 and gitpython==3.1.18 (latest available, vulnerable) under py3.6
@@ -21,14 +21,11 @@ gitdb==4.0.12
2121
# Note: greenlet is used by eventlet
2222
greenlet==3.1.1
2323
gunicorn==23.0.0
24-
jsonpath-rw==1.4.0
2524
jsonschema==3.2.0
2625
kombu==5.5.4
2726
lockfile==0.12.2
2827
mongoengine==0.29.1
2928
networkx==3.1
30-
# jsonpath-rw is the only thing that depends on decorator (a transitive dep)
31-
decorator==5.2.1
3229
# 202403: Bump oslo.config for py3.10 support.
3330
oslo.config==9.6.0
3431
oslo.utils==7.3.0

requirements-pants.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ gitpython
2222
greenlet
2323
gunicorn
2424
jinja2
25-
jsonpath-rw
25+
jsonpath-ng
2626
jsonschema>=3,<4
2727
kombu
2828
lockfile

requirements.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ bcrypt==4.3.0
1414
cffi==1.17.1
1515
chardet==5.2.0
1616
ciso8601
17-
cryptography==43.0.3
18-
decorator==5.2.1
17+
cryptography==45.0.7
18+
decorator
1919
dnspython
2020
editor==1.6.6
2121
eventlet==0.39.1
@@ -26,7 +26,7 @@ greenlet==3.1.1
2626
gunicorn==23.0.0
2727
importlib-metadata==7.1.0
2828
jinja2==3.1.6
29-
jsonpath-rw==1.4.0
29+
jsonpath-ng
3030
jsonschema==3.2.0
3131
kombu==5.5.4
3232
lockfile==0.12.2
@@ -39,6 +39,7 @@ orquesta@ git+https://github.com/StackStorm/orquesta.git@5ba1467614b2ef8b4709b2c
3939
oslo.config==9.6.0
4040
oslo.utils==7.3.0
4141
paramiko==3.5.1
42+
ply
4243
prettytable==3.10.2
4344
prompt-toolkit==3.0.52
4445
psutil==7.0.0

st2client/in-requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@ importlib-metadata
44
typing-extensions
55
argcomplete
66
prettytable
7+
ply
78
pytz
89
python-dateutil
910
pyyaml
1011
jsonschema
11-
jsonpath-rw
12+
jsonpath-ng
1213
requests
1314
# urllib3 is a transitive dep
1415
urllib3

st2client/requirements.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@
88
argcomplete==3.6.2
99
cffi==1.17.1
1010
chardet==5.2.0
11-
cryptography==43.0.3
11+
cryptography==45.0.7
1212
editor==1.6.6
1313
importlib-metadata==7.1.0
14-
jsonpath-rw==1.4.0
14+
jsonpath-ng
1515
jsonschema==3.2.0
1616
orjson==3.10.15
17+
ply
1718
prettytable==3.10.2
1819
prompt-toolkit==3.0.52
1920
pyOpenSSL

st2client/st2client/utils/jsutil.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
from __future__ import absolute_import
17-
from jsonpath_rw import parse
16+
from jsonpath_ng import parse
1817
import re
1918

2019
# A simple expression is defined as a series of letters [a-zA-Z], numbers [0-9],
@@ -65,8 +64,7 @@ def _get_value_complex(doc, key):
6564
"""
6665
Extracts a value from a nested set of dictionaries 'doc' based on
6766
a 'key' string.
68-
The key is expected to be a jsonpath_rw expression:
69-
http://jsonpath-rw.readthedocs.io/en/stable/
67+
The key is expected to be a jsonpath_ng expression:
7068
7169
Returns the extracted value from the key specified (if found)
7270
Returns None if the key can not be found
@@ -85,10 +83,10 @@ def get_value(doc, key):
8583
raise ValueError(
8684
"doc is not an instance of dict: type={} value='{}'".format(type(doc), doc)
8785
)
88-
# jsonpath_rw can be very slow when processing expressions.
86+
# jsonpath_ng can be very slow when processing expressions.
8987
# In the case of a simple expression we've created a "fast path" that avoids
90-
# the complexity introduced by running jsonpath_rw code.
91-
# For more complex expressions we fall back to using jsonpath_rw.
88+
# the complexity introduced by running jsonpath_ng code.
89+
# For more complex expressions we fall back to using jsonpath_ng.
9290
# This provides flexibility and increases performance in the base case.
9391
match = SIMPLE_EXPRESSION_REGEX_CMPL.match(key)
9492
if match:

st2common/in-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ redis
3939
routes
4040
flex
4141
webob
42-
jsonpath-rw
42+
jsonpath-ng
4343
pyOpenSSL
4444
python-statsd
4545
ciso8601

st2common/requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ backports.zoneinfo[tzdata]; python_version<"3.9"
1111
cffi==1.17.1
1212
chardet==5.2.0
1313
ciso8601
14-
cryptography==43.0.3
15-
decorator==5.2.1
14+
cryptography==45.0.7
15+
decorator
1616
dnspython
1717
eventlet==0.39.1
1818
flex==6.14.1
1919
gitdb==4.0.12
2020
gitpython==3.1.45
2121
greenlet==3.1.1
2222
jinja2==3.1.6
23-
jsonpath-rw==1.4.0
23+
jsonpath-ng
2424
jsonschema==3.2.0
2525
kombu==5.5.4
2626
lockfile==0.12.2

st2common/st2common/expressions/functions/data.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from __future__ import absolute_import
1717

1818
import json
19-
import jsonpath_rw
19+
import jsonpath_ng
2020
import six
2121
import orjson
2222

@@ -91,13 +91,12 @@ def json_escape(value):
9191

9292
def jsonpath_query(value, query):
9393
"""Extracts data from an object `value` using a JSONPath `query`.
94-
:link: https://github.com/kennknowles/python-jsonpath-rw
9594
:param value: a object (dict, array, etc) to query
9695
:param query: a JSONPath query expression (string)
9796
:returns: the result of the query executed on the value
9897
:rtype: dict, array, int, string, bool
9998
"""
100-
expr = jsonpath_rw.parse(query)
99+
expr = jsonpath_ng.parse(query)
101100

102101
matches = [match.value for match in expr.find(value)]
103102

st2common/st2common/util/payload.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# limitations under the License.
1515

1616
from __future__ import absolute_import
17-
from jsonpath_rw import parse
17+
from jsonpath_ng import parse
1818

1919
from st2common.constants.keyvalue import SYSTEM_SCOPES
2020
from st2common.constants.rules import TRIGGER_PAYLOAD_PREFIX

0 commit comments

Comments
 (0)