Skip to content

Commit 4a01423

Browse files
committed
Drop ujson and switch to orjson
1 parent dd31328 commit 4a01423

File tree

4 files changed

+11
-15
lines changed

4 files changed

+11
-15
lines changed

Diff for: pylsp/__main__.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,12 @@
22
# Copyright 2021- Python Language Server Contributors.
33

44
import argparse
5+
import json
56
import logging
67
import logging.config
78
import sys
89
import time
910

10-
try:
11-
import ujson as json
12-
except Exception:
13-
import json
14-
1511
from ._version import __version__
1612
from .python_lsp import (
1713
PythonLSPServer,

Diff for: pylsp/plugins/pylint_lint.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
import sys
1313
from subprocess import PIPE, Popen
1414

15-
from pylsp import hookimpl, lsp
16-
1715
try:
18-
import ujson as json
19-
except Exception:
16+
import orjson as json
17+
except ImportError:
2018
import json
2119

20+
from pylsp import hookimpl, lsp
21+
2222
log = logging.getLogger(__name__)
2323

2424
# Pylint fails to suppress STDOUT when importing whitelisted C

Diff for: pylsp/python_lsp.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99
from functools import partial
1010
from typing import Any, Dict, List
1111

12-
try:
13-
import ujson as json
14-
except Exception:
15-
import json
16-
1712
from pylsp_jsonrpc.dispatchers import MethodDispatcher
1813
from pylsp_jsonrpc.endpoint import Endpoint
1914
from pylsp_jsonrpc.streams import JsonRpcStreamReader, JsonRpcStreamWriter
2015

16+
try:
17+
import orjson as json
18+
except ImportError:
19+
import json
20+
2121
from . import _utils, lsp, uris
2222
from ._version import __version__
2323
from .config import config

Diff for: pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ dependencies = [
1818
"jedi>=0.17.2,<0.20.0",
1919
"pluggy>=1.0.0",
2020
"python-lsp-jsonrpc>=1.1.0,<2.0.0",
21-
"ujson>=3.0.0",
21+
"orjson>=3.10.0",
2222
]
2323
dynamic = ["version"]
2424

0 commit comments

Comments
 (0)