Skip to content

Commit

Permalink
Drop ujson and switch to orjson
Browse files Browse the repository at this point in the history
  • Loading branch information
rumpelsepp committed Jul 30, 2024
1 parent dd31328 commit 4a01423
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 15 deletions.
6 changes: 1 addition & 5 deletions pylsp/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions pylsp/plugins/pylint_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
import sys
from subprocess import PIPE, Popen

from pylsp import hookimpl, lsp

try:
import ujson as json
except Exception:
import orjson as json
except ImportError:
import json

from pylsp import hookimpl, lsp

log = logging.getLogger(__name__)

# Pylint fails to suppress STDOUT when importing whitelisted C
Expand Down
10 changes: 5 additions & 5 deletions pylsp/python_lsp.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
from functools import partial
from typing import Any, Dict, List

try:
import ujson as json
except Exception:
import json

from pylsp_jsonrpc.dispatchers import MethodDispatcher
from pylsp_jsonrpc.endpoint import Endpoint
from pylsp_jsonrpc.streams import JsonRpcStreamReader, JsonRpcStreamWriter

try:
import orjson as json
except ImportError:
import json

from . import _utils, lsp, uris
from ._version import __version__
from .config import config
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down

0 comments on commit 4a01423

Please sign in to comment.