From 272baabdda092f350836e3b6cd1664126b22b08c Mon Sep 17 00:00:00 2001 From: slush Date: Mon, 25 Nov 2024 09:49:33 -0600 Subject: [PATCH 1/4] chore: adds back in __all__ to library and adds flake8 and mdformat deps --- .pre-commit-config.yaml | 5 +++-- ape_infura/__init__.py | 3 +++ setup.py | 6 ++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4632577..094dd21 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,6 +19,7 @@ repos: rev: 7.1.1 hooks: - id: flake8 + additional_dependencies: [flake8-breakpoint, flake8-print, flake8-pydantic, flake8-type-checking] - repo: https://github.com/pre-commit/mirrors-mypy rev: v1.13.0 @@ -27,10 +28,10 @@ repos: additional_dependencies: [types-PyYAML, types-requests, types-setuptools, pydantic] - repo: https://github.com/executablebooks/mdformat - rev: 0.7.18 + rev: 0.7.19 hooks: - id: mdformat - additional_dependencies: [mdformat-gfm, mdformat-frontmatter] + additional_dependencies: [mdformat-gfm, mdformat-frontmatter, mdformat-pyproject] default_language_version: python: python3 diff --git a/ape_infura/__init__.py b/ape_infura/__init__.py index 8819a65..c960469 100644 --- a/ape_infura/__init__.py +++ b/ape_infura/__init__.py @@ -20,3 +20,6 @@ def __getattr__(name: str): import ape_infura.provider as module return getattr(module, name) + + +__all__ = ["NETWORKS"] diff --git a/setup.py b/setup.py index 2fb6607..66b9e0c 100644 --- a/setup.py +++ b/setup.py @@ -24,11 +24,13 @@ "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.18", # Auto-formatter for markdown + "mdformat>=0.7.19", # Auto-formatter for markdown "mdformat-gfm>=0.3.5", # Needed for formatting GitHub-flavored markdown "mdformat-frontmatter>=0.4.1", # Needed for frontmatters-style headers in issue templates - "mdformat-pyproject>=0.0.1", # Allows configuring in pyproject.toml + "mdformat-pyproject>=0.0.2", # Allows configuring in pyproject.toml ], "doc": [ "myst-parser>=1.0.0,<2", # Parse markdown docs From 7f7f7e2f212944e4a6b7b272e00c1f225b9ac986 Mon Sep 17 00:00:00 2001 From: slush Date: Mon, 25 Nov 2024 10:31:24 -0600 Subject: [PATCH 2/4] fix: adds Infura to library --- ape_infura/__init__.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ape_infura/__init__.py b/ape_infura/__init__.py index c960469..ba16b43 100644 --- a/ape_infura/__init__.py +++ b/ape_infura/__init__.py @@ -12,7 +12,12 @@ def providers(): def __getattr__(name: str): - if name == "NETWORKS": + if name == "Infura": + from ape_infura.provider import Infura + + return Infura + + elif name == "NETWORKS": from ape_infura.utils import NETWORKS return NETWORKS @@ -22,4 +27,7 @@ def __getattr__(name: str): return getattr(module, name) -__all__ = ["NETWORKS"] +__all__ = [ + "Infura", + "NETWORKS", +] From 707948664887b48fe109c538e08764239f4f8bd7 Mon Sep 17 00:00:00 2001 From: slush Date: Mon, 25 Nov 2024 10:34:44 -0600 Subject: [PATCH 3/4] fix: raise attr error if explicitly defined ones are not requested --- ape_infura/__init__.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ape_infura/__init__.py b/ape_infura/__init__.py index ba16b43..e20f9aa 100644 --- a/ape_infura/__init__.py +++ b/ape_infura/__init__.py @@ -22,9 +22,8 @@ def __getattr__(name: str): return NETWORKS - import ape_infura.provider as module - - return getattr(module, name) + else: + raise AttributeError(name) __all__ = [ From abf425953cd7b001b39761897285431dc205dd56 Mon Sep 17 00:00:00 2001 From: slush Date: Mon, 25 Nov 2024 10:43:00 -0600 Subject: [PATCH 4/4] chore: lint --- ape_infura/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ape_infura/__init__.py b/ape_infura/__init__.py index e20f9aa..184ea4a 100644 --- a/ape_infura/__init__.py +++ b/ape_infura/__init__.py @@ -16,7 +16,7 @@ def __getattr__(name: str): from ape_infura.provider import Infura return Infura - + elif name == "NETWORKS": from ape_infura.utils import NETWORKS