Skip to content

Commit

Permalink
perf: faster plugin load
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey committed Nov 7, 2024
1 parent 36914c9 commit 86cbc8b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
24 changes: 19 additions & 5 deletions ape_fantom/__init__.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,31 @@
from ape import plugins
from ape.api.networks import LOCAL_NETWORK_NAME, ForkedNetworkAPI, NetworkAPI, create_network_type
from ape_node import Node
from ape_test import LocalProvider

from .ecosystem import NETWORKS, Fantom, FantomConfig


@plugins.register(plugins.Config)
def config_class():
from .ecosystem import FantomConfig

return FantomConfig


@plugins.register(plugins.EcosystemPlugin)
def ecosystems():
from .ecosystem import Fantom

yield Fantom


@plugins.register(plugins.NetworkPlugin)
def networks():
from ape.api.networks import (
LOCAL_NETWORK_NAME,
ForkedNetworkAPI,
NetworkAPI,
create_network_type,
)

from .ecosystem import NETWORKS

for network_name, network_params in NETWORKS.items():
yield "fantom", network_name, create_network_type(*network_params)
yield "fantom", f"{network_name}-fork", ForkedNetworkAPI
Expand All @@ -28,6 +36,12 @@ def networks():

@plugins.register(plugins.ProviderPlugin)
def providers():
from ape.api.networks import LOCAL_NETWORK_NAME
from ape_node import Node
from ape_test import LocalProvider

from .ecosystem import NETWORKS

for network_name in NETWORKS:
yield "fantom", network_name, Node

Expand Down
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
[flake8]
max-line-length = 100
ignore = E704,W503,PYD002,TC003,TC006
exclude =
venv*
.eggs
docs
build
type-checking-pydantic-enabled = True

0 comments on commit 86cbc8b

Please sign in to comment.