diff --git a/setup.py b/setup.py index 93b41f46fa..0742f04d58 100644 --- a/setup.py +++ b/setup.py @@ -111,6 +111,7 @@ "toml; python_version<'3.11'", "tqdm>=4.67,<5.0", "traitlets>=5.3.0", + "ujson>=5.11.0,<6", "urllib3>=2.3,<3", "watchdog>=3.0,<4", # ** Dependencies maintained by Ethereum Foundation ** diff --git a/src/ape/cli/paramtype.py b/src/ape/cli/paramtype.py index e5f6905a7e..bbf85ae94e 100644 --- a/src/ape/cli/paramtype.py +++ b/src/ape/cli/paramtype.py @@ -1,4 +1,4 @@ -import json +import ujson as json from pathlib import Path as PathLibPath from typing import Any diff --git a/src/ape/managers/_contractscache.py b/src/ape/managers/_contractscache.py index 69e526e77f..624fed6274 100644 --- a/src/ape/managers/_contractscache.py +++ b/src/ape/managers/_contractscache.py @@ -1,4 +1,4 @@ -import json +import ujson as json from collections.abc import Collection from concurrent.futures import ThreadPoolExecutor from contextlib import contextmanager diff --git a/src/ape/managers/project.py b/src/ape/managers/project.py index 3b90ded994..541932dcfe 100644 --- a/src/ape/managers/project.py +++ b/src/ape/managers/project.py @@ -1,4 +1,4 @@ -import json +import ujson as json import random import shutil from collections.abc import Callable, Iterable, Iterator diff --git a/src/ape/utils/basemodel.py b/src/ape/utils/basemodel.py index 923960d61f..e54c11ee4e 100644 --- a/src/ape/utils/basemodel.py +++ b/src/ape/utils/basemodel.py @@ -3,7 +3,7 @@ """ import inspect -import json +import ujson as json from abc import ABC from collections.abc import Callable, Iterator, Mapping, Sequence from importlib import import_module diff --git a/src/ape/utils/misc.py b/src/ape/utils/misc.py index 6160e7d0b1..086da06073 100644 --- a/src/ape/utils/misc.py +++ b/src/ape/utils/misc.py @@ -1,7 +1,7 @@ import asyncio import functools import inspect -import json +import ujson as json import sys if sys.version_info.minor >= 11: diff --git a/src/ape/utils/os.py b/src/ape/utils/os.py index adc94ea2a7..78e5597e93 100644 --- a/src/ape/utils/os.py +++ b/src/ape/utils/os.py @@ -1,4 +1,4 @@ -import json +import ujson as json import os import re import stat diff --git a/src/ape_accounts/_cli.py b/src/ape_accounts/_cli.py index 5e3cba5abc..f06f11f3b1 100644 --- a/src/ape_accounts/_cli.py +++ b/src/ape_accounts/_cli.py @@ -1,4 +1,4 @@ -import json +import ujson as json from importlib import import_module from typing import TYPE_CHECKING, Optional diff --git a/src/ape_accounts/accounts.py b/src/ape_accounts/accounts.py index bfaa907d45..28637c63f6 100644 --- a/src/ape_accounts/accounts.py +++ b/src/ape_accounts/accounts.py @@ -1,4 +1,4 @@ -import json +import ujson as json import warnings from collections.abc import Iterator from os import environ diff --git a/src/ape_cache/models.py b/src/ape_cache/models.py index c0b743cb32..831e0a5c70 100644 --- a/src/ape_cache/models.py +++ b/src/ape_cache/models.py @@ -1,4 +1,4 @@ -from sqlalchemy import JSON, BigInteger, Column, ForeignKey, Integer, LargeBinary, Numeric +from sqlalchemy import ujson as json, BigInteger, Column, ForeignKey, Integer, LargeBinary, Numeric from sqlalchemy.types import String, TypeDecorator from .base import Base diff --git a/src/ape_ethereum/provider.py b/src/ape_ethereum/provider.py index 13d9cbbd6c..5a0bc2449a 100644 --- a/src/ape_ethereum/provider.py +++ b/src/ape_ethereum/provider.py @@ -1,4 +1,4 @@ -import json +import ujson as json import os import re import sys diff --git a/src/ape_ethereum/trace.py b/src/ape_ethereum/trace.py index 164123567a..1efc50799a 100644 --- a/src/ape_ethereum/trace.py +++ b/src/ape_ethereum/trace.py @@ -1,4 +1,4 @@ -import json +import ujson as json import sys from abc import abstractmethod from collections import defaultdict, deque diff --git a/src/ape_networks/_cli.py b/src/ape_networks/_cli.py index 9bb74361c0..02c74c0c70 100644 --- a/src/ape_networks/_cli.py +++ b/src/ape_networks/_cli.py @@ -1,4 +1,4 @@ -import json +import ujson as json from collections.abc import Callable, Sequence from typing import TYPE_CHECKING diff --git a/src/ape_pm/compiler.py b/src/ape_pm/compiler.py index 46444eaa3f..2e45f6271d 100644 --- a/src/ape_pm/compiler.py +++ b/src/ape_pm/compiler.py @@ -1,6 +1,6 @@ -import json +import ujson as json from collections.abc import Iterable, Iterator -from json import JSONDecodeError +from ujson import JSONDecodeError from pathlib import Path from typing import TYPE_CHECKING, Optional diff --git a/src/ape_pm/dependency.py b/src/ape_pm/dependency.py index 1a6320500d..3841c0b824 100644 --- a/src/ape_pm/dependency.py +++ b/src/ape_pm/dependency.py @@ -1,4 +1,4 @@ -import json +import ujson as json import os import shutil from collections.abc import Iterable diff --git a/tests/conftest.py b/tests/conftest.py index b911508cff..f854276731 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,4 +1,4 @@ -import json +import ujson as json import os import shutil import subprocess diff --git a/tests/functional/test_compilers.py b/tests/functional/test_compilers.py index 42a4e2dbe3..f768717e9c 100644 --- a/tests/functional/test_compilers.py +++ b/tests/functional/test_compilers.py @@ -1,4 +1,4 @@ -import json +import ujson as json from pathlib import Path from re import Pattern from typing import cast diff --git a/tests/functional/test_contract.py b/tests/functional/test_contract.py index b5ef6df814..9b23347899 100644 --- a/tests/functional/test_contract.py +++ b/tests/functional/test_contract.py @@ -1,4 +1,4 @@ -import json +import ujson as json import pytest diff --git a/tests/functional/test_dependencies.py b/tests/functional/test_dependencies.py index 32c611bce6..4476bbfa7b 100644 --- a/tests/functional/test_dependencies.py +++ b/tests/functional/test_dependencies.py @@ -1,4 +1,4 @@ -import json +import ujson as json import os import shutil from pathlib import Path diff --git a/tests/functional/test_deploymentscache.py b/tests/functional/test_deploymentscache.py index f59946d9d8..5129fd9e40 100644 --- a/tests/functional/test_deploymentscache.py +++ b/tests/functional/test_deploymentscache.py @@ -1,4 +1,4 @@ -import json +import ujson as json import pytest diff --git a/tests/functional/test_project.py b/tests/functional/test_project.py index 8922e0a6f4..333c083601 100644 --- a/tests/functional/test_project.py +++ b/tests/functional/test_project.py @@ -1,4 +1,4 @@ -import json +import ujson as json import os import re import shutil diff --git a/tests/functional/test_trace.py b/tests/functional/test_trace.py index 5a46119fbf..4eb834505a 100644 --- a/tests/functional/test_trace.py +++ b/tests/functional/test_trace.py @@ -1,4 +1,4 @@ -import json +import ujson as json import re import pytest diff --git a/tests/integration/cli/test_accounts.py b/tests/integration/cli/test_accounts.py index 4927d590d4..792ad2eec1 100644 --- a/tests/integration/cli/test_accounts.py +++ b/tests/integration/cli/test_accounts.py @@ -1,4 +1,4 @@ -import json +import ujson as json import re from typing import Optional