Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: pep-625 compliance and type checking performance refactors #18

Merged
merged 1 commit into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 37 additions & 39 deletions ape_tenderly/__init__.py
Original file line number Diff line number Diff line change
@@ -1,52 +1,50 @@
from ape import plugins

from .provider import TenderlyConfig, TenderlyForkProvider, TenderlyGatewayProvider

NETWORKS = {
"ethereum": [
("mainnet", TenderlyGatewayProvider),
("mainnet-fork", TenderlyForkProvider),
("sepolia", TenderlyGatewayProvider),
("sepolia-fork", TenderlyForkProvider),
],
"polygon": [
("mainnet", TenderlyGatewayProvider),
("mainnet-fork", TenderlyForkProvider),
("amoy", TenderlyGatewayProvider),
("amoy-fork", TenderlyForkProvider),
],
"arbitrum": [
("mainnet-fork", TenderlyForkProvider),
("sepolia-fork", TenderlyForkProvider),
],
"optimism": [
("mainnet", TenderlyGatewayProvider),
("mainnet-fork", TenderlyForkProvider),
("sepolia", TenderlyGatewayProvider),
("sepolia-fork", TenderlyForkProvider),
],
"base": [
("mainnet", TenderlyGatewayProvider),
("mainnet-fork", TenderlyForkProvider),
("sepolia", TenderlyGatewayProvider),
("sepolia-fork", TenderlyForkProvider),
],
"avalanche": [
("mainnet-fork", TenderlyForkProvider),
],
"fantom": [
("opera-fork", TenderlyForkProvider),
],
}


@plugins.register(plugins.Config)
def config_class():
from ape_tenderly.provider import TenderlyConfig

return TenderlyConfig


@plugins.register(plugins.ProviderPlugin)
def providers():
from ape_tenderly.provider import NETWORKS

for ecosystem_name in NETWORKS:
for network_name, provider in NETWORKS[ecosystem_name]:
yield ecosystem_name, network_name, provider


def __getattr__(name: str):
if name == "NETWORKS":
from ape_tenderly.provider import NETWORKS

return NETWORKS

elif name == "TenderlyConfig":
from ape_tenderly.provider import TenderlyConfig

return TenderlyConfig

elif name == "TenderlyForkProvider":
from ape_tenderly.provider import TenderlyForkProvider

return TenderlyForkProvider

elif name == "TenderlyGatewayProvider":
from ape_tenderly.provider import TenderlyGatewayProvider

return TenderlyGatewayProvider

else:
raise AttributeError(name)


__all__ = [
"NETWORKS",
"TenderlyConfig",
"TenderlyForkProvider",
"TenderlyGatewayProvider",
]
38 changes: 38 additions & 0 deletions ape_tenderly/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,41 @@ def connect(self):

def disconnect(self):
self._web3 = None


NETWORKS = {
"ethereum": [
("mainnet", TenderlyGatewayProvider),
("mainnet-fork", TenderlyForkProvider),
("sepolia", TenderlyGatewayProvider),
("sepolia-fork", TenderlyForkProvider),
],
"polygon": [
("mainnet", TenderlyGatewayProvider),
("mainnet-fork", TenderlyForkProvider),
("amoy", TenderlyGatewayProvider),
("amoy-fork", TenderlyForkProvider),
],
"arbitrum": [
("mainnet-fork", TenderlyForkProvider),
("sepolia-fork", TenderlyForkProvider),
],
"optimism": [
("mainnet", TenderlyGatewayProvider),
("mainnet-fork", TenderlyForkProvider),
("sepolia", TenderlyGatewayProvider),
("sepolia-fork", TenderlyForkProvider),
],
"base": [
("mainnet", TenderlyGatewayProvider),
("mainnet-fork", TenderlyForkProvider),
("sepolia", TenderlyGatewayProvider),
("sepolia-fork", TenderlyForkProvider),
],
"avalanche": [
("mainnet-fork", TenderlyForkProvider),
],
"fantom": [
("opera-fork", TenderlyForkProvider),
],
}
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["setuptools>=51.1.1", "wheel", "setuptools_scm[toml]>=5.0"]
requires = ["setuptools>=75.6.0", "wheel", "setuptools_scm[toml]>=5.0"]

[tool.mypy]
exclude = "build/"
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"mdformat-pyproject>=0.0.2", # Allows configuring in pyproject.toml
],
"release": [ # `release` GitHub Action job uses this
"setuptools", # Installation tool
"setuptools>=75.6.0", # Installation tool
"wheel", # Packaging tool
"twine", # Package upload tool
],
Expand Down
Loading