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

chore: templating updates #75

Merged
merged 4 commits into from
Dec 16, 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
11 changes: 6 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-yaml

Expand All @@ -10,7 +10,7 @@ repos:
- id: isort

- repo: https://github.com/psf/black
rev: 24.8.0
rev: 24.10.0
hooks:
- id: black
name: black
Expand All @@ -19,18 +19,19 @@ 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.11.1
rev: v1.13.0
hooks:
- id: mypy
additional_dependencies: [types-PyYAML, types-requests, types-setuptools, pydantic]

- repo: https://github.com/executablebooks/mdformat
rev: 0.7.17
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
7 changes: 4 additions & 3 deletions evm_trace/gas.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import copy
from typing import TypeVar
from typing import TYPE_CHECKING, TypeVar

from evm_trace.base import CallTreeNode
if TYPE_CHECKING:
from evm_trace.base import CallTreeNode

ContractID = TypeVar("ContractID")
MethodID = TypeVar("MethodID")
GasReport = dict[ContractID, dict[MethodID, list[int]]]


def get_gas_report(calltree: CallTreeNode) -> GasReport:
def get_gas_report(calltree: "CallTreeNode") -> GasReport:
"""
Extracts a gas report object from a :class:`~evm_trace.base.CallTreeNode`.

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ write_to = "evm_trace/version.py"

[tool.black]
line-length = 100
target-version = ['py38', 'py39', 'py310', 'py311', 'py312']
target-version = ['py39', 'py310', 'py311', 'py312', 'py313']
include = '\.pyi?$'

[tool.pytest.ini_options]
Expand Down
3 changes: 2 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ exclude =
docs
build
evm_trace/version.py
ignore = E704,W503,PYD002
ignore = E704,W503,PYD002,TC003,TC006
per-file-ignores =
# The traces have to be formatted this way for the tests.
tests/expected_traces.py: E501
type-checking-pydantic-enabled = True
20 changes: 11 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,19 @@
"eth-hash[pysha3]", # For eth-utils address checksumming
],
"lint": [
"black>=24.8.0,<25", # Auto-formatter and linter
"mypy>=1.11.1,<2", # Static type analyzer
"black>=24.10.0,<25", # Auto-formatter and linter
"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-print>=4.0.1,<5", # 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.10.1,<6", # Import sorting linter
"mdformat>=0.7.17", # 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
],
"release": [ # `release` GitHub Action job uses this
"setuptools>=75.6.0", # Installation tool
Expand Down Expand Up @@ -60,12 +62,12 @@
url="https://github.com/ApeWorX/evm-trace",
include_package_data=True,
install_requires=[
"pydantic>=2.5.2,<3",
"py-evm>=0.10.1b1,<0.11",
"cchecksum>=0.0.3,<1",
"eth-pydantic-types>=0.1.3,<0.2",
"eth-utils>=2.3.1,<6",
"msgspec>=0.8; python_version < '3.13'",
"eth-pydantic-types>=0.1.3,<0.2",
"cchecksum>=0.0.3,<1",
"pydantic>=2.5.2,<3",
"py-evm>=0.10.1b1,<0.11",
],
python_requires=">=3.9,<4",
extras_require=extras_require,
Expand Down
3 changes: 2 additions & 1 deletion tests/test_geth.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import re

import pytest
from cchecksum import to_checksum_address
from eth_pydantic_types import HexBytes
from eth_utils import to_checksum_address, to_hex
from eth_utils import to_hex
from pydantic import ValidationError

from evm_trace.enums import CallType
Expand Down
Loading