From a58f4f53a1fd8cf979b26d31653150f7aa44b4d7 Mon Sep 17 00:00:00 2001 From: slush Date: Tue, 26 Nov 2024 06:45:20 -0600 Subject: [PATCH 1/2] chore: clean up perf improvements --- .pre-commit-config.yaml | 4 ++-- ape_foundry/__init__.py | 29 +++++++++++++++++++++++++++-- setup.py | 5 +++-- 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index dbfaf7c..094dd21 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,7 +19,7 @@ repos: rev: 7.1.1 hooks: - id: flake8 - additional_dependencies: [flake8-breakpoint, flake8-print, flake8-pydantic] + additional_dependencies: [flake8-breakpoint, flake8-print, flake8-pydantic, flake8-type-checking] - repo: https://github.com/pre-commit/mirrors-mypy rev: v1.13.0 @@ -28,7 +28,7 @@ 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, mdformat-pyproject] diff --git a/ape_foundry/__init__.py b/ape_foundry/__init__.py index 8b094ba..e494c32 100644 --- a/ape_foundry/__init__.py +++ b/ape_foundry/__init__.py @@ -59,12 +59,37 @@ def providers(): def __getattr__(name: str): - import ape_foundry.provider as module + if name == "FoundryForkProvider": + from ape_foundry.provider import FoundryForkProvider - return getattr(module, name) + return FoundryForkProvider + + elif name == "FoundryNetworkConfig": + from ape_foundry.provider import FoundryNetworkConfig + + return FoundryNetworkConfig + + elif name == "FoundryProvider": + from ape_foundry.provider import FoundryProvider + + return FoundryProvider + + elif name == "FoundryProviderError": + from ape_foundry.provider import FoundryProviderError + + return FoundryProviderError + + elif name == "FoundrySubprocessError": + from ape_foundry.provider import FoundrySubprocessError + + return FoundrySubprocessError + + else: + raise AttributeError(name) __all__ = [ + "FoundryForkProvider", "FoundryNetworkConfig", "FoundryProvider", "FoundryProviderError", diff --git a/setup.py b/setup.py index 8d03d55..b25d963 100644 --- a/setup.py +++ b/setup.py @@ -24,11 +24,12 @@ "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": [ "Sphinx>=6.1.3,<7", # Documentation generator From 4c678277abbd10a0662eb7a3a3b6ad8fcd40a889 Mon Sep 17 00:00:00 2001 From: slush Date: Tue, 26 Nov 2024 06:48:20 -0600 Subject: [PATCH 2/2] chore: pins setuptools to version that supports PEP-625 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index f1ef041..313ed9b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["setuptools>=51.1.1", "wheel", "setuptools_scm[toml]>=5.0"] +requires = ["setuptools>=70.2.0", "wheel", "setuptools_scm[toml]>=5.0"] [tool.mypy] exclude = "build/"