ujson is now optional

This commit is contained in:
Profitroll 2023-05-14 23:40:45 +02:00
parent 0f39f6158e
commit dc760a8b67
3 changed files with 11 additions and 3 deletions

View File

@ -2,7 +2,11 @@ from pathlib import Path
from typing import Any, Union from typing import Any, Union
import aiofiles import aiofiles
try:
from ujson import dumps, loads from ujson import dumps, loads
except ImportError:
from json import dumps, loads
from libbot.sync import nested_set from libbot.sync import nested_set

View File

@ -1,7 +1,10 @@
from pathlib import Path from pathlib import Path
from typing import Any, Union from typing import Any, Union
try:
from ujson import dumps, loads from ujson import dumps, loads
except ImportError:
from json import dumps, loads
def json_read(path: Union[str, Path]) -> Any: def json_read(path: Union[str, Path]) -> Any:

View File

@ -23,11 +23,12 @@ classifiers = [
"Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Utilities", "Topic :: Utilities",
] ]
dependencies = ["aiofiles~=23.1.0", "ujson==5.7.0"] dependencies = ["aiofiles~=23.1.0"]
[project.optional-dependencies] [project.optional-dependencies]
pycord = ["py-cord>=2.0.0"] pycord = ["py-cord>=2.0.0"]
pyrogram = ["pyrogram>=2.0.0"] pyrogram = ["pyrogram>=2.0.0"]
speed = ["ujson==5.7.0"]
[project.urls] [project.urls]
Source = "https://git.end-play.xyz/profitroll/LibBotUniversal" Source = "https://git.end-play.xyz/profitroll/LibBotUniversal"