diff --git a/pylsp/__main__.py b/pylsp/__main__.py index 61bd015b..08b5e452 100644 --- a/pylsp/__main__.py +++ b/pylsp/__main__.py @@ -2,16 +2,12 @@ # Copyright 2021- Python Language Server Contributors. import argparse +import json import logging import logging.config import sys import time -try: - import ujson as json -except Exception: - import json - from ._version import __version__ from .python_lsp import ( PythonLSPServer, diff --git a/pylsp/plugins/pylint_lint.py b/pylsp/plugins/pylint_lint.py index beffe6f3..ababff3b 100644 --- a/pylsp/plugins/pylint_lint.py +++ b/pylsp/plugins/pylint_lint.py @@ -15,8 +15,8 @@ from pylsp import hookimpl, lsp try: - import ujson as json -except Exception: + import orjson as json +except ImportError: import json log = logging.getLogger(__name__) diff --git a/pylsp/python_lsp.py b/pylsp/python_lsp.py index 528ffdb4..47d765e6 100644 --- a/pylsp/python_lsp.py +++ b/pylsp/python_lsp.py @@ -10,8 +10,8 @@ from typing import Any, Dict, List try: - import ujson as json -except Exception: + import orjson as json +except ImportError: import json from pylsp_jsonrpc.dispatchers import MethodDispatcher diff --git a/pyproject.toml b/pyproject.toml index f68cc2ed..53629727 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,7 +18,7 @@ dependencies = [ "jedi>=0.17.2,<0.20.0", "pluggy>=1.0.0", "python-lsp-jsonrpc>=1.1.0,<2.0.0", - "ujson>=3.0.0", + "orjson>=3.10.0", ] dynamic = ["version"]