Registry / devops / eth-pydantic-types

eth-pydantic-types

JSON →
library0.2.6pypypi✓ verified 85d ago

Pydantic Types for Ethereum provides custom Pydantic data types for Ethereum addresses, hex strings, checksums, and more. Current version 0.2.6, actively maintained by ApeWorX, with monthly releases.

pip install eth-pydantic-types
INSTALL
IMPORT
SIG · ETH-PYDANTIC-TYPES
E
eth-pydantic-types
devopspythonv0.2.6
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

AddressType
from eth_pydantic_types import AddressType
HexStr
from eth_pydantic_types import HexStr
ChecksumAddress
from eth_pydantic_types import ChecksumAddress

Define a Pydantic model with Ethereum-specific types for validation.

from pydantic import BaseModel from eth_pydantic_types import AddressType, HexStr, ChecksumAddress class Contract(BaseModel): address: AddressType bytecode: HexStr # Example usage (for testing) contract = Contract( address='0xdAC17F958D2ee523a2206206994597C13D831ec7', bytecode='0x608060405260043610...' ) print(contract.model_dump())
Debug
Known issues
breakingVersion 0.2.0 changed the import base from `eth_pydantic_types.types` to `eth_pydantic_types`. Old imports like `from eth_pydantic_types.types import AddressType` will break.
fix
Update imports: `from eth_pydantic_types import AddressType`.
affects: >=0.2.0
gotchaThe library does not validate that a hex string has an even number of characters (except for AddressType which checks length). Use `HexStr` for arbitrary-length hex but ensure your application logic validates length.
fix
Add custom validators for hex length if needed.
affects: >=0.1.0
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'eth_pydantic_types'
Library not installed or installed in wrong environment.
fix
Run `pip install eth-pydantic-types` and ensure you're using the correct Python environment.
ImportError: cannot import name 'AddressType' from 'eth_pydantic_types'
Old import path (e.g., from eth_pydantic_types.types).
fix
Change to `from eth_pydantic_types import AddressType`.
Upgrade
Version history
0.2.6latest on PyPI · released Mar 25, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
21 hits · last 30 days
node
20
Amazon
1
Resources
eth-pydantic-types — pip install eth-pydantic-types · libregistry