diff --git a/pyproject.toml b/pyproject.toml index 499db6e..a17c384 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,6 +38,7 @@ dependencies = { file = "requirements/_.txt" } [tool.setuptools.dynamic.optional-dependencies] dev = { file = "requirements/dev.txt" } +speed = { file = "requirements/speed.txt" } [tool.setuptools.packages.find] where = ["src"] diff --git a/requirements/speed.txt b/requirements/speed.txt new file mode 100644 index 0000000..37c6a01 --- /dev/null +++ b/requirements/speed.txt @@ -0,0 +1 @@ +ujson~=5.8.0 \ No newline at end of file diff --git a/src/pyrmv/raw/__init__.py b/src/pyrmv/raw/__init__.py index 3c8c095..77fd736 100644 --- a/src/pyrmv/raw/__init__.py +++ b/src/pyrmv/raw/__init__.py @@ -1,3 +1,7 @@ +import contextlib + +import requests + from .board_arrival import board_arrival from .board_departure import board_departure from .him_search import him_search @@ -6,3 +10,8 @@ from .stop_by_coords import stop_by_coords from .stop_by_name import stop_by_name from .trip_find import trip_find from .trip_recon import trip_recon + +with contextlib.suppress(ImportError): + import ujson + + requests.models.complexjson = ujson diff --git a/tox.ini b/tox.ini index e4c6404..b3d08ff 100644 --- a/tox.ini +++ b/tox.ini @@ -18,6 +18,7 @@ passenv = deps = -r{toxinidir}/requirements/_.txt -r{toxinidir}/requirements/dev.txt + -r{toxinidir}/requirements/speed.txt commands = pytest --basetemp={envtmpdir} --cov=pyrmv --cov-report term-missing