Skip to content

Commit

Permalink
chore: relax pydantic dependency [APE-1373] (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
banteg authored Sep 21, 2023
1 parent 46f45f2 commit 9a5feb3
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 12 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repos:
- id: isort

- repo: https://github.com/psf/black
rev: 23.7.0
rev: 23.9.1
hooks:
- id: black
name: black
Expand All @@ -21,13 +21,13 @@ repos:
- id: flake8

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.4.1
rev: v1.5.1
hooks:
- id: mypy
additional_dependencies: [types-PyYAML, types-requests, types-setuptools, pydantic]

- repo: https://github.com/executablebooks/mdformat
rev: 0.7.16
rev: 0.7.17
hooks:
- id: mdformat
additional_dependencies: [mdformat-gfm, mdformat-frontmatter]
Expand Down
7 changes: 7 additions & 0 deletions evm_trace/_pydantic_compat.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
try:
from pydantic.v1 import Field, ValidationError, validator # type: ignore
except ImportError:
from pydantic import Field, ValidationError, validator # type: ignore


__all__ = ["Field", "validator", "ValidationError"]
2 changes: 1 addition & 1 deletion evm_trace/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

from ethpm_types import BaseModel as _BaseModel
from ethpm_types import HexBytes
from pydantic import validator

from evm_trace._pydantic_compat import validator
from evm_trace.display import get_tree_display
from evm_trace.enums import CallType

Expand Down
2 changes: 1 addition & 1 deletion evm_trace/geth.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

from eth_utils import to_int
from ethpm_types import HexBytes
from pydantic import Field, validator

from evm_trace._pydantic_compat import Field, validator
from evm_trace.base import BaseModel, CallTreeNode
from evm_trace.enums import CALL_OPCODES, CallType
from evm_trace.utils import to_address
Expand Down
3 changes: 1 addition & 2 deletions evm_trace/parity.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from typing import Any, Dict, List, Optional, Union, cast

from pydantic import Field, validator

from evm_trace._pydantic_compat import Field, validator
from evm_trace.base import BaseModel, CallTreeNode
from evm_trace.enums import CallType

Expand Down
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
"eth-hash[pysha3]", # For eth-utils address checksumming
],
"lint": [
"black>=23.7.0,<24", # Auto-formatter and linter
"mypy>=1.4.1,<2", # Static type analyzer
"black>=23.9.1,<24", # Auto-formatter and linter
"mypy>=1.5.1,<2", # Static type analyzer
"types-setuptools", # Needed for mypy type shed
"flake8>=6.1.0,<7", # Style linter
"isort>=5.10.1,<6", # Import sorting linter
"mdformat>=0.7.16", # Auto-formatter for markdown
"mdformat>=0.7.17", # 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
],
Expand Down Expand Up @@ -57,7 +57,7 @@
url="https://github.com/ApeWorX/evm-trace",
include_package_data=True,
install_requires=[
"pydantic>=1.10.1,<2",
"pydantic>=1.10.1,<3",
"py-evm>=0.7.0a3,<0.8",
"eth-utils>=2.1,<3",
"ethpm-types>=0.5.0,<0.6",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_geth.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import pytest
from ethpm_types import HexBytes
from pydantic import ValidationError

from evm_trace._pydantic_compat import ValidationError
from evm_trace.enums import CallType
from evm_trace.geth import (
TraceFrame,
Expand Down

0 comments on commit 9a5feb3

Please sign in to comment.