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

perf: plugin load time #35

Merged
merged 3 commits into from
Nov 21, 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
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ repos:
- id: flake8

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.12.0
rev: v1.13.0
hooks:
- id: mypy
additional_dependencies: [types-setuptools, pydantic]
Expand Down
37 changes: 32 additions & 5 deletions ape_arbitrum/__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, Arbitrum, ArbitrumConfig


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

return ArbitrumConfig


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

yield Arbitrum


@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 "arbitrum", network_name, create_network_type(*network_params)
yield "arbitrum", f"{network_name}-fork", ForkedNetworkAPI
Expand All @@ -28,7 +36,26 @@ 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 "arbitrum", network_name, Node

yield "arbitrum", LOCAL_NETWORK_NAME, LocalProvider


def __getattr__(name: str):
import ape_arbitrum.ecosystem as module

return getattr(module, name)


__all__ = [
"NETWORKS",
"Arbitrum",
"ArbitrumConfig",
]
3 changes: 2 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
[flake8]
max-line-length = 100
ignore = E704,W503,PYD002
ignore = E704,W503,PYD002,TC003,TC006
exclude =
.venv*
venv*
.eggs
docs
build
type-checking-pydantic-enabled = True
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@
],
"lint": [
"black>=24.10.0,<25", # Auto-formatter and linter
"mypy>=1.12.0,<2", # Static type analyzer
"mypy>=1.13.0,<2", # Static type analyzer
"types-setuptools", # Needed for mypy type shed
"flake8>=7.1.1,<8", # Style linter
"flake8-breakpoint>=1.1.0,<2", # Detect breakpoints left in code
"flake8-print>=5.0.0,<6", # Detect print statements left in code
"flake8-pydantic", # For detecting issues with Pydantic models
"flake8-type-checking", # Detect imports to move in/out of type-checking blocks
"isort>=5.13.2,<6", # Import sorting linter
"mdformat>=0.7.1", # Auto-formatter for markdown
"mdformat-gfm>=0.3.5", # Needed for formatting GitHub-flavored markdown
Expand Down
Loading