ape.api
Accounts
- class ape.api.accounts.AccountAPI
Bases:
BaseInterfaceModel
,BaseAddress
An API class representing an account.
- __class_vars__: ClassVar[set[str]] = {'Project', '_test_runner', 'account_manager', 'chain_manager', 'compiler_manager', 'config_manager', 'conversion_manager', 'local_project', 'network_manager', 'plugin_manager', 'query_manager'}
The names of the class variables defined on the model.
- __private_attributes__: ClassVar[Dict[str, ModelPrivateAttr]] = {}
Metadata about the private attributes of the model.
- __pydantic_complete__: ClassVar[bool] = True
Whether model building is completed, or if there are still undefined fields.
- __pydantic_core_schema__: ClassVar[CoreSchema] = {'cls': <class 'ape.api.accounts.AccountAPI'>, 'config': {'title': 'AccountAPI'}, 'custom_init': False, 'metadata': {'pydantic_js_annotation_functions': [], 'pydantic_js_functions': [functools.partial(<function modify_model_json_schema>, cls=<class 'ape.api.accounts.AccountAPI'>, title=None), <bound method BaseModel.__get_pydantic_json_schema__ of <class 'ape.api.accounts.AccountAPI'>>]}, 'ref': 'ape.api.accounts.AccountAPI:94763145421936', 'root_model': False, 'schema': {'computed_fields': [], 'fields': {}, 'model_name': 'AccountAPI', 'type': 'model-fields'}, 'type': 'model'}
The core schema of the model.
- __pydantic_custom_init__: ClassVar[bool] = False
Whether the model has a custom __init__ method.
- __pydantic_decorators__: ClassVar[_decorators.DecoratorInfos] = DecoratorInfos(validators={}, field_validators={}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={}, computed_fields={})
Metadata containing the decorators defined on the model. This replaces Model.__validators__ and Model.__root_validators__ from Pydantic V1.
- __pydantic_generic_metadata__: ClassVar[_generics.PydanticGenericMetadata] = {'args': (), 'origin': None, 'parameters': ()}
Metadata for generic models; contains data used for a similar purpose to __args__, __origin__, __parameters__ in typing-module generics. May eventually be replaced by these.
- __pydantic_parent_namespace__: ClassVar[Dict[str, Any] | None] = None
Parent namespace of the model, used for automatic rebuilding of models.
- __pydantic_post_init__: ClassVar[None | Literal['model_post_init']] = None
The name of the post-init method for the model, if defined.
- __pydantic_serializer__: ClassVar[SchemaSerializer] = SchemaSerializer(serializer=Model( ModelSerializer { class: Py( 0x0000562fc39ee470, ), serializer: Fields( GeneralFieldsSerializer { fields: {}, computed_fields: Some( ComputedFields( [], ), ), mode: SimpleDict, extra_serializer: None, filter: SchemaFilter { include: None, exclude: None, }, required_fields: 0, }, ), has_extra: false, root_model: false, name: "AccountAPI", }, ), definitions=[])
The pydantic-core SchemaSerializer used to dump instances of the model.
- __pydantic_validator__: ClassVar[SchemaValidator | PluggableSchemaValidator] = SchemaValidator(title="AccountAPI", validator=Model( ModelValidator { revalidate: Never, validator: ModelFields( ModelFieldsValidator { fields: [], model_name: "AccountAPI", extra_behavior: Ignore, extras_validator: None, strict: false, from_attributes: false, loc_by_alias: true, }, ), class: Py( 0x0000562fc39ee470, ), post_init: None, frozen: false, custom_init: false, root_model: false, undefined: Py( 0x00007ff1dc854dc0, ), name: "AccountAPI", }, ), definitions=[], cache_strings=True)
The pydantic-core SchemaValidator used to validate instances of the model.
- __signature__: ClassVar[Signature] = <Signature () -> None>
The synthesized __init__ [Signature][inspect.Signature] of the model.
- property alias: str | None
A shortened-name for quicker access to the account.
- call(txn: TransactionAPI, send_everything: bool = False, private: bool = False, **signer_options) ReceiptAPI
Make a transaction call.
- Raises:
AccountsError – When the nonce is invalid or the sender does not have enough funds.
TransactionError – When the required confirmations are negative.
SignatureError – When the user does not sign the transaction.
APINotImplementedError – When setting
private=True
and using a provider that does not support private transactions.
- Parameters:
txn (
TransactionAPI
) – An invoke-transaction.send_everything (bool) –
True
will send the difference from balance and fee. Defaults toFalse
.private (bool) –
True
will use thesend_private_transaction()
method.**signer_options – Additional kwargs given to the signer to modify the signing operation.
- Returns:
- check_signature(data: SignableMessage | TransactionAPI | str | EIP712Message | int | bytes, signature: MessageSignature | None = None, recover_using_eip191: bool = True) bool
Verify a message or transaction was signed by this account.
- Parameters:
data (Union[
SignableMessage
,TransactionAPI
]) – # noqa: E501 The message or transaction to verify.signature (Optional[
MessageSignature
]) – The signature to check. Defaults toNone
and is not needed when the first argument is a transaction class.recover_using_eip191 (bool) – Perform recovery using EIP-191 signed message check. If set False, then will attempt recovery as raw hash. data` must be a 32 byte hash if this is set False. Defaults to
True
.
- Returns:
True
if the data was signed by this account.False
otherwise.- Return type:
bool
- declare(contract: ContractContainer, *args, **kwargs) ReceiptAPI
Deploy the “blueprint” of a contract type. For EVM providers, this likely means using EIP-5202, which is implemented in the core
ape-ethereum
plugin.- Parameters:
contract (
ContractContainer
) – The contract container to declare.- Returns:
The receipt of the declare transaction.
- Return type:
- deploy(contract: ContractContainer, *args, publish: bool = False, **kwargs) ContractInstance
Create a smart contract on the blockchain. The smart contract must compile before deploying and a provider must be active.
- Parameters:
contract (
ContractContainer
) – The type of contract to deploy.publish (bool) – Set to
True
to attempt explorer contract verification. Defaults toFalse
.
- Returns:
An instance of the deployed contract.
- Return type:
ContractInstance
- prepare_transaction(txn: TransactionAPI) TransactionAPI
Set default values on a transaction.
- Raises:
AccountsError – When the account cannot afford the transaction or the nonce is invalid.
TransactionError – When given negative required confirmations.
- Parameters:
txn (
TransactionAPI
) – The transaction to prepare.- Returns:
- abstract sign_message(msg: Any, **signer_options) MessageSignature | None
Sign a message.
- Parameters:
msg (Any) – The message to sign. Account plugins can handle various types of messages. For example,
KeyfileAccount
can handleSignableMessage
, str, int, and bytes. See these docs # noqa: E501 for more type information on theSignableMessage
type.**signer_options – Additional kwargs given to the signer to modify the signing operation.
- Returns:
The signature corresponding to the message.
- Return type:
MessageSignature
(optional)
- sign_raw_msghash(msghash: HexBytes) MessageSignature | None
Sign a raw message hash.
- Parameters:
msghash (
HexBytes
) – The message hash to sign. Plugins may or may not support this operation. Default implementation is to raiseNotImplementedError
.- Returns:
The signature corresponding to the message.
- Return type:
MessageSignature
(optional)
- abstract sign_transaction(txn: TransactionAPI, **signer_options) TransactionAPI | None
Sign a transaction.
- Parameters:
txn (
TransactionAPI
) – The transaction to sign.**signer_options – Additional kwargs given to the signer to modify the signing operation.
- Returns:
- A signed transaction.
The
TransactionAPI
returned by this method may not correspond totxn
given as input, however returning a properly-formatted transaction here is meant to be executed. ReturnsNone
if the account does not have a transaction it wishes to execute.
- Return type:
TransactionAPI
(optional)
- transfer(account: str | Annotated[ChecksumAddress, _AddressValidator] | BaseAddress, value: str | int | None = None, data: bytes | str | None = None, private: bool = False, **kwargs) ReceiptAPI
Send funds to an account.
- Raises:
APINotImplementedError – When setting
private=True
and using a provider that does not support private transactions.- Parameters:
account (Union[str, AddressType, BaseAddress]) – The receiver of the funds.
value (Optional[Union[str, int]]) – The amount to send.
data (Optional[Union[bytes, str]]) – Extra data to include in the transaction.
private (bool) –
True
asks the provider to make the transaction private. For example, EVM providers typically use the RPCeth_sendPrivateTransaction
to achieve this. Local providers may ignore this value.**kwargs – Additional transaction kwargs passed to
create_transaction()
, such asgas
max_fee
, ormax_priority_fee
. For a list of available transaction kwargs, seeTransactionAPI
.
- Returns:
- class ape.api.accounts.AccountContainerAPI(*, name: str, account_type: type[AccountAPI])
Bases:
BaseInterfaceModel
An API class representing a collection of
AccountAPI
instances.- __class_vars__: ClassVar[set[str]] = {'Project', '_test_runner', 'account_manager', 'chain_manager', 'compiler_manager', 'config_manager', 'conversion_manager', 'local_project', 'network_manager', 'plugin_manager', 'query_manager'}
The names of the class variables defined on the model.
- __contains__(address: Annotated[ChecksumAddress, _AddressValidator]) bool
Check if the address is an existing account in
ape
.- Raises:
IndexError – When the given account address is not in this container.
- Parameters:
address (
AddressType
) – An account address.- Returns:
True
ifape
manages the account with the given address.- Return type:
bool
- __delitem__(address: Annotated[ChecksumAddress, _AddressValidator])
Delete an account.
- Raises:
NotImplementError – When not overridden within a plugin.
- Parameters:
address (
AddressType
) – The address of the account to delete.
- __getitem__(address: Annotated[ChecksumAddress, _AddressValidator]) AccountAPI
Get an account by address.
- Parameters:
address (
AddressType
) – The address to get. The type is an alias to ChecksumAddress. # noqa: E501- Raises:
KeyError – When there is no local account with the given address.
- Returns:
- abstract __len__() int
Number of accounts.
- __private_attributes__: ClassVar[Dict[str, ModelPrivateAttr]] = {}
Metadata about the private attributes of the model.
- __pydantic_complete__: ClassVar[bool] = True
Whether model building is completed, or if there are still undefined fields.
- __pydantic_core_schema__: ClassVar[CoreSchema] = {'cls': <class 'ape.api.accounts.AccountContainerAPI'>, 'config': {'title': 'AccountContainerAPI'}, 'custom_init': False, 'metadata': {'pydantic_js_annotation_functions': [], 'pydantic_js_functions': [functools.partial(<function modify_model_json_schema>, cls=<class 'ape.api.accounts.AccountContainerAPI'>, title=None), <bound method BaseModel.__get_pydantic_json_schema__ of <class 'ape.api.accounts.AccountContainerAPI'>>]}, 'ref': 'ape.api.accounts.AccountContainerAPI:94763145493344', 'root_model': False, 'schema': {'computed_fields': [], 'fields': {'account_type': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'cls': <class 'ape.api.accounts.AccountAPI'>, 'type': 'is-subclass'}, 'type': 'model-field'}, 'name': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'type': 'str'}, 'type': 'model-field'}}, 'model_name': 'AccountContainerAPI', 'type': 'model-fields'}, 'type': 'model'}
The core schema of the model.
- __pydantic_custom_init__: ClassVar[bool] = False
Whether the model has a custom __init__ method.
- __pydantic_decorators__: ClassVar[_decorators.DecoratorInfos] = DecoratorInfos(validators={}, field_validators={}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={}, computed_fields={})
Metadata containing the decorators defined on the model. This replaces Model.__validators__ and Model.__root_validators__ from Pydantic V1.
- __pydantic_generic_metadata__: ClassVar[_generics.PydanticGenericMetadata] = {'args': (), 'origin': None, 'parameters': ()}
Metadata for generic models; contains data used for a similar purpose to __args__, __origin__, __parameters__ in typing-module generics. May eventually be replaced by these.
- __pydantic_parent_namespace__: ClassVar[Dict[str, Any] | None] = None
Parent namespace of the model, used for automatic rebuilding of models.
- __pydantic_post_init__: ClassVar[None | Literal['model_post_init']] = None
The name of the post-init method for the model, if defined.
- __pydantic_serializer__: ClassVar[SchemaSerializer] = SchemaSerializer(serializer=Model( ModelSerializer { class: Py( 0x0000562fc39ffb60, ), serializer: Fields( GeneralFieldsSerializer { fields: { "account_type": SerField { key_py: Py( 0x00007ff1db1e8270, ), alias: None, alias_py: None, serializer: Some( Any( AnySerializer, ), ), required: true, }, "name": SerField { key_py: Py( 0x00007ff1df754af0, ), alias: None, alias_py: None, serializer: Some( Str( StrSerializer, ), ), required: true, }, }, computed_fields: Some( ComputedFields( [], ), ), mode: SimpleDict, extra_serializer: None, filter: SchemaFilter { include: None, exclude: None, }, required_fields: 2, }, ), has_extra: false, root_model: false, name: "AccountContainerAPI", }, ), definitions=[])
The pydantic-core SchemaSerializer used to dump instances of the model.
- __pydantic_validator__: ClassVar[SchemaValidator | PluggableSchemaValidator] = SchemaValidator(title="AccountContainerAPI", validator=Model( ModelValidator { revalidate: Never, validator: ModelFields( ModelFieldsValidator { fields: [ Field { name: "name", lookup_key: Simple { key: "name", py_key: Py( 0x00007ff1d83d45f0, ), path: LookupPath( [ S( "name", Py( 0x00007ff1d83d4df0, ), ), ], ), }, name_py: Py( 0x00007ff1df754af0, ), validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), frozen: false, }, Field { name: "account_type", lookup_key: Simple { key: "account_type", py_key: Py( 0x00007ff1d83d4ef0, ), path: LookupPath( [ S( "account_type", Py( 0x00007ff1d83d4230, ), ), ], ), }, name_py: Py( 0x00007ff1db1e8270, ), validator: IsSubclass( IsSubclassValidator { class: Py( 0x0000562fc39ee470, ), class_repr: "AccountAPI", name: "is-subclass[AccountAPI]", }, ), frozen: false, }, ], model_name: "AccountContainerAPI", extra_behavior: Ignore, extras_validator: None, strict: false, from_attributes: false, loc_by_alias: true, }, ), class: Py( 0x0000562fc39ffb60, ), post_init: None, frozen: false, custom_init: false, root_model: false, undefined: Py( 0x00007ff1dc854dc0, ), name: "AccountContainerAPI", }, ), definitions=[], cache_strings=True)
The pydantic-core SchemaValidator used to validate instances of the model.
- __signature__: ClassVar[Signature] = <Signature (*, name: str, account_type: type[ape.api.accounts.AccountAPI]) -> None>
The synthesized __init__ [Signature][inspect.Signature] of the model.
- account_type: type[AccountAPI]
The type of account in this container. See
AccountAPI
.
- abstract property accounts: Iterator[AccountAPI]
All accounts.
- Returns:
Iterator[
AccountAPI
]
- abstract property aliases: Iterator[str]
All available aliases.
- Returns:
Iterator[str]
- append(account: AccountAPI)
Add an account to the container.
- Raises:
AccountsError – When the account is already in the container.
- Parameters:
account (
AccountAPI
) – The account to add.
- property data_folder: Path
The path to the account data files. Defaults to
$HOME/.ape/<plugin_name>
unless overridden.
- name: str
The name of the account container. For example, the
ape-ledger
plugin uses"ledger"
as its name.
- remove(account: AccountAPI)
Delete an account.
- Raises:
AccountsError – When the account is not known to
ape
.- Parameters:
account (
AccountAPI
) – The account to remove.
- class ape.api.accounts.ImpersonatedAccount(*, raw_address: Annotated[ChecksumAddress, _AddressValidator])
Bases:
AccountAPI
An account to use that does not require signing.
- __class_vars__: ClassVar[set[str]] = {'Project', '_test_runner', 'account_manager', 'chain_manager', 'compiler_manager', 'config_manager', 'conversion_manager', 'local_project', 'network_manager', 'plugin_manager', 'query_manager'}
The names of the class variables defined on the model.
- __private_attributes__: ClassVar[Dict[str, ModelPrivateAttr]] = {}
Metadata about the private attributes of the model.
- __pydantic_complete__: ClassVar[bool] = True
Whether model building is completed, or if there are still undefined fields.
- __pydantic_core_schema__: ClassVar[CoreSchema] = {'cls': <class 'ape.api.accounts.ImpersonatedAccount'>, 'config': {'title': 'ImpersonatedAccount'}, 'custom_init': False, 'metadata': {'pydantic_js_annotation_functions': [], 'pydantic_js_functions': [functools.partial(<function modify_model_json_schema>, cls=<class 'ape.api.accounts.ImpersonatedAccount'>, title=None), <bound method BaseModel.__get_pydantic_json_schema__ of <class 'ape.api.accounts.ImpersonatedAccount'>>]}, 'ref': 'ape.api.accounts.ImpersonatedAccount:94763145513888', 'root_model': False, 'schema': {'computed_fields': [], 'fields': {'raw_address': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'function': {'function': <bound method _AddressValidator.__eth_pydantic_validate__ of <class 'ape.types.address._AddressValidator'>>, 'type': 'with-info'}, 'metadata': {'pydantic_js_annotation_functions': [<bound method BaseHex.__get_pydantic_json_schema__ of <class 'ape.types.address._AddressValidator'>>]}, 'schema': {'max_length': 42, 'min_length': 42, 'type': 'str'}, 'type': 'function-before'}, 'type': 'model-field'}}, 'model_name': 'ImpersonatedAccount', 'type': 'model-fields'}, 'type': 'model'}
The core schema of the model.
- __pydantic_custom_init__: ClassVar[bool] = False
Whether the model has a custom __init__ method.
- __pydantic_decorators__: ClassVar[_decorators.DecoratorInfos] = DecoratorInfos(validators={}, field_validators={}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={}, computed_fields={})
Metadata containing the decorators defined on the model. This replaces Model.__validators__ and Model.__root_validators__ from Pydantic V1.
- __pydantic_generic_metadata__: ClassVar[_generics.PydanticGenericMetadata] = {'args': (), 'origin': None, 'parameters': ()}
Metadata for generic models; contains data used for a similar purpose to __args__, __origin__, __parameters__ in typing-module generics. May eventually be replaced by these.
- __pydantic_parent_namespace__: ClassVar[Dict[str, Any] | None] = None
Parent namespace of the model, used for automatic rebuilding of models.
- __pydantic_post_init__: ClassVar[None | Literal['model_post_init']] = None
The name of the post-init method for the model, if defined.
- __pydantic_serializer__: ClassVar[SchemaSerializer] = SchemaSerializer(serializer=Model( ModelSerializer { class: Py( 0x0000562fc3a04ba0, ), serializer: Fields( GeneralFieldsSerializer { fields: { "raw_address": SerField { key_py: Py( 0x00007ff1db1e8cf0, ), alias: None, alias_py: None, serializer: Some( Str( StrSerializer, ), ), required: true, }, }, computed_fields: Some( ComputedFields( [], ), ), mode: SimpleDict, extra_serializer: None, filter: SchemaFilter { include: None, exclude: None, }, required_fields: 1, }, ), has_extra: false, root_model: false, name: "ImpersonatedAccount", }, ), definitions=[])
The pydantic-core SchemaSerializer used to dump instances of the model.
- __pydantic_validator__: ClassVar[SchemaValidator | PluggableSchemaValidator] = SchemaValidator(title="ImpersonatedAccount", validator=Model( ModelValidator { revalidate: Never, validator: ModelFields( ModelFieldsValidator { fields: [ Field { name: "raw_address", lookup_key: Simple { key: "raw_address", py_key: Py( 0x00007ff1d83f33f0, ), path: LookupPath( [ S( "raw_address", Py( 0x00007ff1d83f2df0, ), ), ], ), }, name_py: Py( 0x00007ff1db1e8cf0, ), validator: FunctionBefore( FunctionBeforeValidator { validator: StrConstrained( StrConstrainedValidator { strict: false, pattern: None, max_length: Some( 42, ), min_length: Some( 42, ), strip_whitespace: false, to_lower: false, to_upper: false, coerce_numbers_to_str: false, }, ), func: Py( 0x00007ff1d83f30c0, ), config: Py( 0x00007ff1d83e58c0, ), name: "function-before[__eth_pydantic_validate__(), constrained-str]", field_name: None, info_arg: true, }, ), frozen: false, }, ], model_name: "ImpersonatedAccount", extra_behavior: Ignore, extras_validator: None, strict: false, from_attributes: false, loc_by_alias: true, }, ), class: Py( 0x0000562fc3a04ba0, ), post_init: None, frozen: false, custom_init: false, root_model: false, undefined: Py( 0x00007ff1dc854dc0, ), name: "ImpersonatedAccount", }, ), definitions=[], cache_strings=True)
The pydantic-core SchemaValidator used to validate instances of the model.
- __signature__: ClassVar[Signature] = <Signature (*, raw_address: typing.Annotated[eth_typing.evm.ChecksumAddress, <class 'ape.types.address._AddressValidator'>]) -> None>
The synthesized __init__ [Signature][inspect.Signature] of the model.
- property address: Annotated[ChecksumAddress, _AddressValidator]
The address of this account. Subclasses must override and provide this value.
- call(txn: TransactionAPI, send_everything: bool = False, private: bool = False, **kwargs) ReceiptAPI
Make a transaction call.
- Raises:
AccountsError – When the nonce is invalid or the sender does not have enough funds.
TransactionError – When the required confirmations are negative.
SignatureError – When the user does not sign the transaction.
APINotImplementedError – When setting
private=True
and using a provider that does not support private transactions.
- Parameters:
txn (
TransactionAPI
) – An invoke-transaction.send_everything (bool) –
True
will send the difference from balance and fee. Defaults toFalse
.private (bool) –
True
will use thesend_private_transaction()
method.**signer_options – Additional kwargs given to the signer to modify the signing operation.
- Returns:
- raw_address: Annotated[ChecksumAddress, _AddressValidator]
The field-address of the account.
- sign_message(msg: Any, **signer_options) MessageSignature | None
Sign a message.
- Parameters:
msg (Any) – The message to sign. Account plugins can handle various types of messages. For example,
KeyfileAccount
can handleSignableMessage
, str, int, and bytes. See these docs # noqa: E501 for more type information on theSignableMessage
type.**signer_options – Additional kwargs given to the signer to modify the signing operation.
- Returns:
The signature corresponding to the message.
- Return type:
MessageSignature
(optional)
- sign_transaction(txn: TransactionAPI, **signer_options) TransactionAPI | None
Sign a transaction.
- Parameters:
txn (
TransactionAPI
) – The transaction to sign.**signer_options – Additional kwargs given to the signer to modify the signing operation.
- Returns:
- A signed transaction.
The
TransactionAPI
returned by this method may not correspond totxn
given as input, however returning a properly-formatted transaction here is meant to be executed. ReturnsNone
if the account does not have a transaction it wishes to execute.
- Return type:
TransactionAPI
(optional)
- class ape.api.accounts.TestAccountAPI
Bases:
AccountAPI
Test accounts for
ape test
(such accounts that useGeneratedDevAccounts
) should implement this API instead ofAccountAPI
directly. Then, they show up in theaccounts
test fixture.- __class_vars__: ClassVar[set[str]] = {'Project', '_test_runner', 'account_manager', 'chain_manager', 'compiler_manager', 'config_manager', 'conversion_manager', 'local_project', 'network_manager', 'plugin_manager', 'query_manager'}
The names of the class variables defined on the model.
- __private_attributes__: ClassVar[Dict[str, ModelPrivateAttr]] = {}
Metadata about the private attributes of the model.
- __pydantic_complete__: ClassVar[bool] = True
Whether model building is completed, or if there are still undefined fields.
- __pydantic_core_schema__: ClassVar[CoreSchema] = {'cls': <class 'ape.api.accounts.TestAccountAPI'>, 'config': {'title': 'TestAccountAPI'}, 'custom_init': False, 'metadata': {'pydantic_js_annotation_functions': [], 'pydantic_js_functions': [functools.partial(<function modify_model_json_schema>, cls=<class 'ape.api.accounts.TestAccountAPI'>, title=None), <bound method BaseModel.__get_pydantic_json_schema__ of <class 'ape.api.accounts.TestAccountAPI'>>]}, 'ref': 'ape.api.accounts.TestAccountAPI:94763129841472', 'root_model': False, 'schema': {'computed_fields': [], 'fields': {}, 'model_name': 'TestAccountAPI', 'type': 'model-fields'}, 'type': 'model'}
The core schema of the model.
- __pydantic_custom_init__: ClassVar[bool] = False
Whether the model has a custom __init__ method.
- __pydantic_decorators__: ClassVar[_decorators.DecoratorInfos] = DecoratorInfos(validators={}, field_validators={}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={}, computed_fields={})
Metadata containing the decorators defined on the model. This replaces Model.__validators__ and Model.__root_validators__ from Pydantic V1.
- __pydantic_generic_metadata__: ClassVar[_generics.PydanticGenericMetadata] = {'args': (), 'origin': None, 'parameters': ()}
Metadata for generic models; contains data used for a similar purpose to __args__, __origin__, __parameters__ in typing-module generics. May eventually be replaced by these.
- __pydantic_parent_namespace__: ClassVar[Dict[str, Any] | None] = None
Parent namespace of the model, used for automatic rebuilding of models.
- __pydantic_post_init__: ClassVar[None | Literal['model_post_init']] = None
The name of the post-init method for the model, if defined.
- __pydantic_serializer__: ClassVar[SchemaSerializer] = SchemaSerializer(serializer=Model( ModelSerializer { class: Py( 0x0000562fc2b12740, ), serializer: Fields( GeneralFieldsSerializer { fields: {}, computed_fields: Some( ComputedFields( [], ), ), mode: SimpleDict, extra_serializer: None, filter: SchemaFilter { include: None, exclude: None, }, required_fields: 0, }, ), has_extra: false, root_model: false, name: "TestAccountAPI", }, ), definitions=[])
The pydantic-core SchemaSerializer used to dump instances of the model.
- __pydantic_validator__: ClassVar[SchemaValidator | PluggableSchemaValidator] = SchemaValidator(title="TestAccountAPI", validator=Model( ModelValidator { revalidate: Never, validator: ModelFields( ModelFieldsValidator { fields: [], model_name: "TestAccountAPI", extra_behavior: Ignore, extras_validator: None, strict: false, from_attributes: false, loc_by_alias: true, }, ), class: Py( 0x0000562fc2b12740, ), post_init: None, frozen: false, custom_init: false, root_model: false, undefined: Py( 0x00007ff1dc854dc0, ), name: "TestAccountAPI", }, ), definitions=[], cache_strings=True)
The pydantic-core SchemaValidator used to validate instances of the model.
- __signature__: ClassVar[Signature] = <Signature () -> None>
The synthesized __init__ [Signature][inspect.Signature] of the model.
- class ape.api.accounts.TestAccountContainerAPI(*, name: str, account_type: type[AccountAPI])
Bases:
AccountContainerAPI
Test account containers for
ape test
(such containers that generate accounts usingGeneratedDevAccounts
) should implement this API instead ofAccountContainerAPI
directly. Then, they show up in theaccounts
test fixture.- __class_vars__: ClassVar[set[str]] = {'Project', '_test_runner', 'account_manager', 'chain_manager', 'compiler_manager', 'config_manager', 'conversion_manager', 'local_project', 'network_manager', 'plugin_manager', 'query_manager'}
The names of the class variables defined on the model.
- __private_attributes__: ClassVar[Dict[str, ModelPrivateAttr]] = {}
Metadata about the private attributes of the model.
- __pydantic_complete__: ClassVar[bool] = True
Whether model building is completed, or if there are still undefined fields.
- __pydantic_core_schema__: ClassVar[CoreSchema] = {'cls': <class 'ape.api.accounts.TestAccountContainerAPI'>, 'config': {'title': 'TestAccountContainerAPI'}, 'custom_init': False, 'metadata': {'pydantic_js_annotation_functions': [], 'pydantic_js_functions': [functools.partial(<function modify_model_json_schema>, cls=<class 'ape.api.accounts.TestAccountContainerAPI'>, title=None), <bound method BaseModel.__get_pydantic_json_schema__ of <class 'ape.api.accounts.TestAccountContainerAPI'>>]}, 'ref': 'ape.api.accounts.TestAccountContainerAPI:94763145497040', 'root_model': False, 'schema': {'computed_fields': [], 'fields': {'account_type': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'cls': <class 'ape.api.accounts.AccountAPI'>, 'type': 'is-subclass'}, 'type': 'model-field'}, 'name': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'type': 'str'}, 'type': 'model-field'}}, 'model_name': 'TestAccountContainerAPI', 'type': 'model-fields'}, 'type': 'model'}
The core schema of the model.
- __pydantic_custom_init__: ClassVar[bool] = False
Whether the model has a custom __init__ method.
- __pydantic_decorators__: ClassVar[_decorators.DecoratorInfos] = DecoratorInfos(validators={}, field_validators={}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={}, computed_fields={})
Metadata containing the decorators defined on the model. This replaces Model.__validators__ and Model.__root_validators__ from Pydantic V1.
- __pydantic_generic_metadata__: ClassVar[_generics.PydanticGenericMetadata] = {'args': (), 'origin': None, 'parameters': ()}
Metadata for generic models; contains data used for a similar purpose to __args__, __origin__, __parameters__ in typing-module generics. May eventually be replaced by these.
- __pydantic_parent_namespace__: ClassVar[Dict[str, Any] | None] = None
Parent namespace of the model, used for automatic rebuilding of models.
- __pydantic_post_init__: ClassVar[None | Literal['model_post_init']] = None
The name of the post-init method for the model, if defined.
- __pydantic_serializer__: ClassVar[SchemaSerializer] = SchemaSerializer(serializer=Model( ModelSerializer { class: Py( 0x0000562fc3a009d0, ), serializer: Fields( GeneralFieldsSerializer { fields: { "account_type": SerField { key_py: Py( 0x00007ff1db1e8270, ), alias: None, alias_py: None, serializer: Some( Any( AnySerializer, ), ), required: true, }, "name": SerField { key_py: Py( 0x00007ff1df754af0, ), alias: None, alias_py: None, serializer: Some( Str( StrSerializer, ), ), required: true, }, }, computed_fields: Some( ComputedFields( [], ), ), mode: SimpleDict, extra_serializer: None, filter: SchemaFilter { include: None, exclude: None, }, required_fields: 2, }, ), has_extra: false, root_model: false, name: "TestAccountContainerAPI", }, ), definitions=[])
The pydantic-core SchemaSerializer used to dump instances of the model.
- __pydantic_validator__: ClassVar[SchemaValidator | PluggableSchemaValidator] = SchemaValidator(title="TestAccountContainerAPI", validator=Model( ModelValidator { revalidate: Never, validator: ModelFields( ModelFieldsValidator { fields: [ Field { name: "name", lookup_key: Simple { key: "name", py_key: Py( 0x00007ff1d83e5af0, ), path: LookupPath( [ S( "name", Py( 0x00007ff1d83e6770, ), ), ], ), }, name_py: Py( 0x00007ff1df754af0, ), validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), frozen: false, }, Field { name: "account_type", lookup_key: Simple { key: "account_type", py_key: Py( 0x00007ff1d83e5bb0, ), path: LookupPath( [ S( "account_type", Py( 0x00007ff1d83e5c70, ), ), ], ), }, name_py: Py( 0x00007ff1db1e8270, ), validator: IsSubclass( IsSubclassValidator { class: Py( 0x0000562fc39ee470, ), class_repr: "AccountAPI", name: "is-subclass[AccountAPI]", }, ), frozen: false, }, ], model_name: "TestAccountContainerAPI", extra_behavior: Ignore, extras_validator: None, strict: false, from_attributes: false, loc_by_alias: true, }, ), class: Py( 0x0000562fc3a009d0, ), post_init: None, frozen: false, custom_init: false, root_model: false, undefined: Py( 0x00007ff1dc854dc0, ), name: "TestAccountContainerAPI", }, ), definitions=[], cache_strings=True)
The pydantic-core SchemaValidator used to validate instances of the model.
- __signature__: ClassVar[Signature] = <Signature (*, name: str, account_type: type[ape.api.accounts.AccountAPI]) -> None>
The synthesized __init__ [Signature][inspect.Signature] of the model.
- property data_folder: Path
Test account containers do not touch persistent data. By default and unless overridden, this property returns the path to
/dev/null
and it is not used for anything.- Type:
NOTE
- abstract generate_account(index: int | None = None) TestAccountAPI
Generate a new test account.
- get_test_account(**kwargs)
Get the test account at the given index.
- Parameters:
index (int) – The index of the test account.
- Returns:
- reset()
Reset the account container to an original state.
Address
- class ape.api.address.Address(address: Annotated[ChecksumAddress, _AddressValidator])
Bases:
BaseAddress
A generic blockchain address.
Typically, this is used when we do not know the contract type at a given address, or to refer to an EOA the user doesn’t personally control.
- property address: Annotated[ChecksumAddress, _AddressValidator]
The raw address type.
- Returns:
An alias to ChecksumAddress. # noqa: E501
- Return type:
- class ape.api.address.BaseAddress
Bases:
BaseInterface
A base address API class. All account-types subclass this type.
- abstract property address: Annotated[ChecksumAddress, _AddressValidator]
The address of this account. Subclasses must override and provide this value.
- property balance: int
The total balance of the account.
- property code: str | bytes | HexBytes
The raw bytes of the smart-contract code at the address.
- property codesize: int
The number of bytes in the smart contract.
- property history: AccountHistory
The list of transactions that this account has made on the current chain.
- property is_contract: bool
True
when there is code associated with the address.
- property nonce: int
The number of transactions associated with the address.
Compiler
- class ape.api.compiler.CompilerAPI(*, compiler_settings: dict = {})
Bases:
BaseInterfaceModel
Compiler plugins, such as for languages like Solidity or Vyper, implement this API.
See the repository for the ape-solidity plugin or the ape-vyper plugin as example implementations of this API.
- abstract compile(contract_filepaths: Iterable[Path], project: ProjectManager | None, settings: dict | None = None) Iterator[ContractType]
Compile the given source files. All compiler plugins must implement this function.
- Parameters:
contract_filepaths (Iterable[pathlib.Path]) – A list of source file paths to compile.
project (Optional[
ProjectManager
]) – Optionally provide the project containing the base paths and full source set. Defaults to the local project. Dependencies will change this value to their respective projects.settings (Optional[dict]) – Adhoc compiler settings.
- Returns:
list[
ContractType
]
- compile_code(**kwargs)
Compile a program.
- Parameters:
code (str) – The code to compile.
project (Optional[
ProjectManager
]) – Optionally provide the project containing the base paths and full source set. Defaults to the local project. Dependencies will change this value to their respective projects.settings (Optional[Dict]) – Adhoc compiler settings.
**kwargs – Additional overrides for the
ethpm_types.ContractType
model.
- Returns:
A compiled contract artifact.
- Return type:
ContractType
- compiler_settings: dict
Adhoc compiler settings.
- enrich_error(err: ContractLogicError) ContractLogicError
Enrich a contract logic error using compiler information, such as known PC locations for compiler runtime errors.
- Parameters:
err (
ContractLogicError
) – The exception to enrich.- Returns:
The enriched exception.
- Return type:
- flatten_contract(**kwargs)
Get the content of a flattened contract via its source path. Plugin implementations handle import resolution, SPDX de-duplication, and anything else needed.
- Parameters:
path (
pathlib.Path
) – The source path of the contract.project (Optional[
ProjectManager
]) – Optionally provide the project containing the base paths and full source set. Defaults to the local project. Dependencies will change this value to their respective projects.**kwargs (Any) – Additional compiler-specific settings. See specific compiler plugins when applicable.
- Returns:
The flattened contract content.
- Return type:
ethpm_types.source.Content
- get_compiler_settings(**kwargs)
Get a mapping of the settings that would be used to compile each of the sources by the compiler version number.
- Parameters:
contract_filepaths (Iterable[pathlib.Path]) – The list of paths.
project (Optional[
ProjectManager
]) – Optionally provide the project containing the base paths and full source set. Defaults to the local project. Dependencies will change this value to their respective projects.**overrides – Settings overrides.
- Returns:
A dict of compiler settings by compiler version.
- Return type:
dict[Version, dict]
- get_config(project: ProjectManager | None = None) PluginConfig
The combination of settings from
ape-config.yaml
and.compiler_settings
.- Parameters:
project (Optional[
ProjectManager
]) – Optionally provide the project containing the base paths and full source set. Defaults to the local project. Dependencies will change this value to their respective projects.- Returns:
- get_imports(**kwargs)
Returns a list of imports as source_ids for each contract’s source_id in a given compiler.
- Parameters:
contract_filepaths (Iterable[pathlib.Path]) – A list of source file paths to compile.
project (Optional[
ProjectManager
]) – Optionally provide the project containing the base paths and full source set. Defaults to the local project. Dependencies will change this value to their respective projects.
- Returns:
A dictionary like
{source_id: [import_source_id, ...], ...}
- Return type:
dict[str, list[str]]
- get_version_map(**kwargs)
Get a map of versions to source paths.
- Parameters:
contract_filepaths (Iterable[Path]) – Input source paths. Defaults to all source paths per compiler.
project (Optional[
ProjectManager
]) – Optionally provide the project containing the base paths and full source set. Defaults to the local project. Dependencies will change this value to their respective projects.
- Returns:
dict[Version, set[Path]]
- get_versions(**kwargs)
Retrieve the set of available compiler versions for this plugin to compile
all_paths
.- Parameters:
all_paths (Iterable[pathlib.Path]) – The list of paths.
- Returns:
A set of available compiler versions.
- Return type:
set[str]
- init_coverage_profile(**kwargs)
Initialize an empty report for the given source ID. Modifies the given source coverage in-place.
- Parameters:
source_coverage (
SourceCoverage
) – The source to generate an empty coverage profile for.contract_source (
ethpm_types.source.ContractSource
) – The contract with source content.
- abstract property name: str
The name of the compiler.
- property supports_source_tracing: bool
Returns
True
if this compiler is able to provider a source traceback for a given trace.
- trace_source(**kwargs)
Get a source-traceback for the given contract type. The source traceback object contains all the control paths taken in the transaction. When available, source-code location information is accessible from the object.
- Parameters:
contract_source (
ContractSource
) – A contract type with a local-source that was compiled by this compiler.trace (
TraceAPI
]) – The resulting trace from executing a function defined in the given contract type.calldata (
HexBytes
) – Calldata passed to the top-level call.
- Returns:
SourceTraceback
Config
- class ape.api.config.ApeConfig(*args, contracts_folder: str | None = None, default_ecosystem: str = 'ethereum', dependencies: list[dict] = [], deployments: dict[str, dict[str, list[DeploymentConfig]]] = None, interfaces_folder: str = 'interfaces', meta: PackageMeta = PackageMeta(authors=None, license=None, description=None, keywords=None, links=None), name: str = '', base_path: str | None = None, request_headers: dict = {}, version: str = '', **kwargs)
Bases:
ExtraAttributesMixin
,BaseSettings
,ManagerAccessMixin
The top-level config.
- __class_vars__: ClassVar[set[str]] = {'Project', '_test_runner', 'account_manager', 'chain_manager', 'compiler_manager', 'config_manager', 'conversion_manager', 'local_project', 'network_manager', 'plugin_manager', 'query_manager'}
The names of the class variables defined on the model.
- __private_attributes__: ClassVar[Dict[str, ModelPrivateAttr]] = {}
Metadata about the private attributes of the model.
- __pydantic_complete__: ClassVar[bool] = True
Whether model building is completed, or if there are still undefined fields.
- __pydantic_core_schema__: ClassVar[CoreSchema] = {'cls': <class 'ape.api.config.ApeConfig'>, 'config': {'extra_fields_behavior': 'allow', 'title': 'ApeConfig', 'validate_default': True}, 'custom_init': True, 'metadata': {'pydantic_js_annotation_functions': [], 'pydantic_js_functions': [functools.partial(<function modify_model_json_schema>, cls=<class 'ape.api.config.ApeConfig'>, title=None), <bound method BaseModel.__get_pydantic_json_schema__ of <class 'ape.api.config.ApeConfig'>>]}, 'ref': 'ape.api.config.ApeConfig:94763144988224', 'root_model': False, 'schema': {'function': {'function': <bound method ApeConfig.validate_model of <class 'ape.api.config.ApeConfig'>>, 'type': 'no-info'}, 'schema': {'computed_fields': [], 'fields': {'base_path': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'default': None, 'schema': {'schema': {'type': 'str'}, 'type': 'nullable'}, 'type': 'default'}, 'type': 'model-field'}, 'contracts_folder': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'default': None, 'schema': {'schema': {'type': 'str'}, 'type': 'nullable'}, 'type': 'default'}, 'type': 'model-field'}, 'default_ecosystem': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'default': 'ethereum', 'schema': {'type': 'str'}, 'type': 'default'}, 'type': 'model-field'}, 'dependencies': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'default': [], 'schema': {'items_schema': {'keys_schema': {'type': 'any'}, 'type': 'dict', 'values_schema': {'type': 'any'}}, 'type': 'list'}, 'type': 'default'}, 'type': 'model-field'}, 'deployment_data': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'default_factory': <class 'dict'>, 'schema': {'keys_schema': {'type': 'str'}, 'type': 'dict', 'values_schema': {'keys_schema': {'type': 'str'}, 'type': 'dict', 'values_schema': {'items_schema': {'cls': <class 'ape.api.config.DeploymentConfig'>, 'config': {'extra_fields_behavior': 'allow', 'title': 'DeploymentConfig', 'validate_default': True}, 'custom_init': True, 'metadata': {'pydantic_js_annotation_functions': [], 'pydantic_js_functions': [functools.partial(<function modify_model_json_schema>, cls=<class 'ape.api.config.DeploymentConfig'>, title=None), <bound method BaseModel.__get_pydantic_json_schema__ of <class 'ape.api.config.DeploymentConfig'>>]}, 'ref': 'ape.api.config.DeploymentConfig:94763144978848', 'root_model': False, 'schema': {'computed_fields': [], 'fields': {'address': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'function': {'function': <bound method _AddressValidator.__eth_pydantic_validate__ of <class 'ape.types.address._AddressValidator'>>, 'type': 'with-info'}, 'metadata': {'pydantic_js_annotation_functions': [<bound method BaseHex.__get_pydantic_json_schema__ of <class 'ape.types.address._AddressValidator'>>]}, 'schema': {'max_length': 42, 'min_length': 42, 'type': 'str'}, 'type': 'function-before'}, 'type': 'model-field'}, 'contract_type': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'type': 'str'}, 'type': 'model-field'}}, 'model_name': 'DeploymentConfig', 'type': 'model-fields'}, 'type': 'model'}, 'type': 'list'}}}, 'type': 'default'}, 'serialization_alias': 'deployments', 'type': 'model-field', 'validation_alias': 'deployments'}, 'interfaces_folder': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'default': 'interfaces', 'schema': {'type': 'str'}, 'type': 'default'}, 'type': 'model-field'}, 'meta': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'default': PackageMeta(authors=None, license=None, description=None, keywords=None, links=None), 'schema': {'cls': <class 'ethpm_types.manifest.PackageMeta'>, 'config': {'title': 'PackageMeta'}, 'custom_init': False, 'metadata': {'pydantic_js_annotation_functions': [], 'pydantic_js_functions': [functools.partial(<function modify_model_json_schema>, cls=<class 'ethpm_types.manifest.PackageMeta'>, title=None), <bound method BaseModel.__get_pydantic_json_schema__ of <class 'ethpm_types.manifest.PackageMeta'>>]}, 'ref': 'ethpm_types.manifest.PackageMeta:94763127368480', 'root_model': False, 'schema': {'computed_fields': [], 'fields': {'authors': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'default': None, 'schema': {'schema': {'items_schema': {'type': 'str'}, 'type': 'list'}, 'type': 'nullable'}, 'type': 'default'}, 'type': 'model-field'}, 'description': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'default': None, 'schema': {'schema': {'type': 'str'}, 'type': 'nullable'}, 'type': 'default'}, 'type': 'model-field'}, 'keywords': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'default': None, 'schema': {'schema': {'items_schema': {'type': 'str'}, 'type': 'list'}, 'type': 'nullable'}, 'type': 'default'}, 'type': 'model-field'}, 'license': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'default': None, 'schema': {'schema': {'type': 'str'}, 'type': 'nullable'}, 'type': 'default'}, 'type': 'model-field'}, 'links': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'default': None, 'schema': {'schema': {'keys_schema': {'type': 'str'}, 'type': 'dict', 'values_schema': {'type': 'url'}}, 'type': 'nullable'}, 'type': 'default'}, 'type': 'model-field'}}, 'model_name': 'PackageMeta', 'type': 'model-fields'}, 'type': 'model'}, 'type': 'default'}, 'type': 'model-field'}, 'name': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'default': '', 'schema': {'type': 'str'}, 'type': 'default'}, 'type': 'model-field'}, 'request_headers': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'default': {}, 'schema': {'keys_schema': {'type': 'any'}, 'type': 'dict', 'values_schema': {'type': 'any'}}, 'type': 'default'}, 'type': 'model-field'}, 'version': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'default': '', 'schema': {'type': 'str'}, 'type': 'default'}, 'type': 'model-field'}}, 'model_name': 'ApeConfig', 'type': 'model-fields'}, 'type': 'function-before'}, 'type': 'model'}
The core schema of the model.
- __pydantic_custom_init__: ClassVar[bool] = True
Whether the model has a custom __init__ method.
- __pydantic_decorators__: ClassVar[_decorators.DecoratorInfos] = DecoratorInfos(validators={}, field_validators={}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={'validate_model': Decorator(cls_ref='ape.api.config.ApeConfig:94763144988224', cls_var_name='validate_model', func=<bound method ApeConfig.validate_model of <class 'ape.api.config.ApeConfig'>>, shim=None, info=ModelValidatorDecoratorInfo(mode='before'))}, computed_fields={})
Metadata containing the decorators defined on the model. This replaces Model.__validators__ and Model.__root_validators__ from Pydantic V1.
- __pydantic_extra__: dict[str, Any] | None
A dictionary containing extra values, if [extra][pydantic.config.ConfigDict.extra] is set to ‘allow’.
- __pydantic_fields_set__: set[str]
The names of fields explicitly set during instantiation.
- __pydantic_generic_metadata__: ClassVar[_generics.PydanticGenericMetadata] = {'args': (), 'origin': None, 'parameters': ()}
Metadata for generic models; contains data used for a similar purpose to __args__, __origin__, __parameters__ in typing-module generics. May eventually be replaced by these.
- __pydantic_parent_namespace__: ClassVar[Dict[str, Any] | None] = None
Parent namespace of the model, used for automatic rebuilding of models.
- __pydantic_post_init__: ClassVar[None | Literal['model_post_init']] = None
The name of the post-init method for the model, if defined.
- __pydantic_private__: dict[str, Any] | None
Values of private attributes set on the model instance.
- __pydantic_serializer__: ClassVar[SchemaSerializer] = SchemaSerializer(serializer=Model( ModelSerializer { class: Py( 0x0000562fc3984640, ), serializer: Fields( GeneralFieldsSerializer { fields: { "name": SerField { key_py: Py( 0x00007ff1df754af0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007ff1df708030, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, "base_path": SerField { key_py: Py( 0x00007ff1df7e1530, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007ff1dfb78940, ), ), serializer: Nullable( NullableSerializer { serializer: Str( StrSerializer, ), }, ), }, ), ), required: true, }, "interfaces_folder": SerField { key_py: Py( 0x00007ff1d8344bc0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007ff1dde68ef0, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, "meta": SerField { key_py: Py( 0x00007ff1df395070, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007ff1d838d710, ), ), serializer: Model( ModelSerializer { class: Py( 0x0000562fc28b6b20, ), serializer: Fields( GeneralFieldsSerializer { fields: { "license": SerField { key_py: Py( 0x00007ff1df3480b0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007ff1dfb78940, ), ), serializer: Nullable( NullableSerializer { serializer: Str( StrSerializer, ), }, ), }, ), ), required: true, }, "description": SerField { key_py: Py( 0x00007ff1def54ff0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007ff1dfb78940, ), ), serializer: Nullable( NullableSerializer { serializer: Str( StrSerializer, ), }, ), }, ), ), required: true, }, "keywords": SerField { key_py: Py( 0x00007ff1df3eebb0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007ff1dfb78940, ), ), serializer: Nullable( NullableSerializer { serializer: List( ListSerializer { item_serializer: Str( StrSerializer, ), filter: SchemaFilter { include: None, exclude: None, }, name: "list[str]", }, ), }, ), }, ), ), required: true, }, "links": SerField { key_py: Py( 0x00007ff1dd8c01b0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007ff1dfb78940, ), ), serializer: Nullable( NullableSerializer { serializer: Dict( DictSerializer { key_serializer: Str( StrSerializer, ), value_serializer: Url( UrlSerializer, ), filter: SchemaFilter { include: None, exclude: None, }, name: "dict[str, url]", }, ), }, ), }, ), ), required: true, }, "authors": SerField { key_py: Py( 0x00007ff1dec516f0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007ff1dfb78940, ), ), serializer: Nullable( NullableSerializer { serializer: List( ListSerializer { item_serializer: Str( StrSerializer, ), filter: SchemaFilter { include: None, exclude: None, }, name: "list[str]", }, ), }, ), }, ), ), required: true, }, }, computed_fields: Some( ComputedFields( [], ), ), mode: SimpleDict, extra_serializer: None, filter: SchemaFilter { include: None, exclude: None, }, required_fields: 5, }, ), has_extra: false, root_model: false, name: "PackageMeta", }, ), }, ), ), required: true, }, "default_ecosystem": SerField { key_py: Py( 0x00007ff1d8339160, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007ff1dc981cf0, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, "request_headers": SerField { key_py: Py( 0x00007ff1dd3b0c30, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007ff1d8383200, ), ), serializer: Dict( DictSerializer { key_serializer: Any( AnySerializer, ), value_serializer: Any( AnySerializer, ), filter: SchemaFilter { include: None, exclude: None, }, name: "dict[any, any]", }, ), }, ), ), required: true, }, "version": SerField { key_py: Py( 0x00007ff1df7775f0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007ff1df708030, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, "deployment_data": SerField { key_py: Py( 0x00007ff1d83378f0, ), alias: Some( "deployments", ), alias_py: Some( Py( 0x00007ff1d83bc670, ), ), serializer: Some( WithDefault( WithDefaultSerializer { default: DefaultFactory( Py( 0x00007ff1dfb75ba0, ), ), serializer: Dict( DictSerializer { key_serializer: Str( StrSerializer, ), value_serializer: Dict( DictSerializer { key_serializer: Str( StrSerializer, ), value_serializer: List( ListSerializer { item_serializer: Model( ModelSerializer { class: Py( 0x0000562fc39821a0, ), serializer: Fields( GeneralFieldsSerializer { fields: { "contract_type": SerField { key_py: Py( 0x00007ff1db938c30, ), alias: None, alias_py: None, serializer: Some( Str( StrSerializer, ), ), required: true, }, "address": SerField { key_py: Py( 0x00007ff1deefac30, ), alias: None, alias_py: None, serializer: Some( Str( StrSerializer, ), ), required: true, }, }, computed_fields: Some( ComputedFields( [], ), ), mode: ModelExtra, extra_serializer: None, filter: SchemaFilter { include: None, exclude: None, }, required_fields: 2, }, ), has_extra: true, root_model: false, name: "DeploymentConfig", }, ), filter: SchemaFilter { include: None, exclude: None, }, name: "list[DeploymentConfig]", }, ), filter: SchemaFilter { include: None, exclude: None, }, name: "dict[str, list[DeploymentConfig]]", }, ), filter: SchemaFilter { include: None, exclude: None, }, name: "dict[str, dict[str, list[DeploymentConfig]]]", }, ), }, ), ), required: true, }, "contracts_folder": SerField { key_py: Py( 0x00007ff1d8344b70, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007ff1dfb78940, ), ), serializer: Nullable( NullableSerializer { serializer: Str( StrSerializer, ), }, ), }, ), ), required: true, }, "dependencies": SerField { key_py: Py( 0x00007ff1ded64af0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007ff1d8383280, ), ), serializer: List( ListSerializer { item_serializer: Dict( DictSerializer { key_serializer: Any( AnySerializer, ), value_serializer: Any( AnySerializer, ), filter: SchemaFilter { include: None, exclude: None, }, name: "dict[any, any]", }, ), filter: SchemaFilter { include: None, exclude: None, }, name: "list[dict[any, any]]", }, ), }, ), ), required: true, }, }, computed_fields: Some( ComputedFields( [], ), ), mode: ModelExtra, extra_serializer: None, filter: SchemaFilter { include: None, exclude: None, }, required_fields: 10, }, ), has_extra: true, root_model: false, name: "ApeConfig", }, ), definitions=[])
The pydantic-core SchemaSerializer used to dump instances of the model.
- __pydantic_validator__: ClassVar[SchemaValidator | PluggableSchemaValidator] = SchemaValidator(title="ApeConfig", validator=Model( ModelValidator { revalidate: Never, validator: FunctionBefore( FunctionBeforeValidator { validator: ModelFields( ModelFieldsValidator { fields: [ Field { name: "contracts_folder", lookup_key: Simple { key: "contracts_folder", py_key: Py( 0x00007ff1d83a6790, ), path: LookupPath( [ S( "contracts_folder", Py( 0x00007ff1d83a67e0, ), ), ], ), }, name_py: Py( 0x00007ff1d8344b70, ), validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007ff1dfb78940, ), ), on_error: Raise, validator: Nullable( NullableValidator { validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), name: "nullable[str]", }, ), validate_default: true, copy_default: false, name: "default[nullable[str]]", undefined: Py( 0x00007ff1dc854dc0, ), }, ), frozen: false, }, Field { name: "default_ecosystem", lookup_key: Simple { key: "default_ecosystem", py_key: Py( 0x00007ff1d83a6880, ), path: LookupPath( [ S( "default_ecosystem", Py( 0x00007ff1d83a6830, ), ), ], ), }, name_py: Py( 0x00007ff1d8339160, ), validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007ff1dc981cf0, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: true, copy_default: false, name: "default[str]", undefined: Py( 0x00007ff1dc854dc0, ), }, ), frozen: false, }, Field { name: "dependencies", lookup_key: Simple { key: "dependencies", py_key: Py( 0x00007ff1d83affb0, ), path: LookupPath( [ S( "dependencies", Py( 0x00007ff1d83bc0b0, ), ), ], ), }, name_py: Py( 0x00007ff1ded64af0, ), validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007ff1d8383280, ), ), on_error: Raise, validator: List( ListValidator { strict: false, item_validator: Some( Dict( DictValidator { strict: false, key_validator: Any( AnyValidator, ), value_validator: Any( AnyValidator, ), min_length: None, max_length: None, name: "dict[any,any]", }, ), ), min_length: None, max_length: None, name: OnceLock( "list[dict[any,any]]", ), fail_fast: false, }, ), validate_default: true, copy_default: true, name: "default[list[dict[any,any]]]", undefined: Py( 0x00007ff1dc854dc0, ), }, ), frozen: false, }, Field { name: "deployment_data", lookup_key: Simple { key: "deployments", py_key: Py( 0x00007ff1dbaed9f0, ), path: LookupPath( [ S( "deployments", Py( 0x00007ff1dbaed9f0, ), ), ], ), }, name_py: Py( 0x00007ff1d83378f0, ), validator: WithDefault( WithDefaultValidator { default: DefaultFactory( Py( 0x00007ff1dfb75ba0, ), ), on_error: Raise, validator: Dict( DictValidator { strict: false, key_validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), value_validator: Dict( DictValidator { strict: false, key_validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), value_validator: List( ListValidator { strict: false, item_validator: Some( Model( ModelValidator { revalidate: Never, validator: ModelFields( ModelFieldsValidator { fields: [ Field { name: "address", lookup_key: Simple { key: "address", py_key: Py( 0x00007ff1d83bc070, ), path: LookupPath( [ S( "address", Py( 0x00007ff1d83bc030, ), ), ], ), }, name_py: Py( 0x00007ff1deefac30, ), validator: FunctionBefore( FunctionBeforeValidator { validator: StrConstrained( StrConstrainedValidator { strict: false, pattern: None, max_length: Some( 42, ), min_length: Some( 42, ), strip_whitespace: false, to_lower: false, to_upper: false, coerce_numbers_to_str: false, }, ), func: Py( 0x00007ff1d8383bc0, ), config: Py( 0x00007ff1d83aef80, ), name: "function-before[__eth_pydantic_validate__(), constrained-str]", field_name: None, info_arg: true, }, ), frozen: false, }, Field { name: "contract_type", lookup_key: Simple { key: "contract_type", py_key: Py( 0x00007ff1d83bc0f0, ), path: LookupPath( [ S( "contract_type", Py( 0x00007ff1d83bc130, ), ), ], ), }, name_py: Py( 0x00007ff1db938c30, ), validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), frozen: false, }, ], model_name: "DeploymentConfig", extra_behavior: Allow, extras_validator: None, strict: false, from_attributes: false, loc_by_alias: true, }, ), class: Py( 0x0000562fc39821a0, ), post_init: None, frozen: false, custom_init: true, root_model: false, undefined: Py( 0x00007ff1dc854dc0, ), name: "DeploymentConfig", }, ), ), min_length: None, max_length: None, name: OnceLock( "list[DeploymentConfig]", ), fail_fast: false, }, ), min_length: None, max_length: None, name: "dict[str,list[DeploymentConfig]]", }, ), min_length: None, max_length: None, name: "dict[str,dict[str,list[DeploymentConfig]]]", }, ), validate_default: true, copy_default: false, name: "default[dict[str,dict[str,list[DeploymentConfig]]]]", undefined: Py( 0x00007ff1dc854dc0, ), }, ), frozen: false, }, Field { name: "interfaces_folder", lookup_key: Simple { key: "interfaces_folder", py_key: Py( 0x00007ff1d83a68d0, ), path: LookupPath( [ S( "interfaces_folder", Py( 0x00007ff1d83a6920, ), ), ], ), }, name_py: Py( 0x00007ff1d8344bc0, ), validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007ff1dde68ef0, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: true, copy_default: false, name: "default[str]", undefined: Py( 0x00007ff1dc854dc0, ), }, ), frozen: false, }, Field { name: "meta", lookup_key: Simple { key: "meta", py_key: Py( 0x00007ff1d83bc3f0, ), path: LookupPath( [ S( "meta", Py( 0x00007ff1d83bc430, ), ), ], ), }, name_py: Py( 0x00007ff1df395070, ), validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007ff1d838d710, ), ), on_error: Raise, validator: Model( ModelValidator { revalidate: Never, validator: ModelFields( ModelFieldsValidator { fields: [ Field { name: "authors", lookup_key: Simple { key: "authors", py_key: Py( 0x00007ff1d83bc170, ), path: LookupPath( [ S( "authors", Py( 0x00007ff1d83bc1b0, ), ), ], ), }, name_py: Py( 0x00007ff1dec516f0, ), validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007ff1dfb78940, ), ), on_error: Raise, validator: Nullable( NullableValidator { validator: List( ListValidator { strict: false, item_validator: Some( Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), ), min_length: None, max_length: None, name: OnceLock( "list[str]", ), fail_fast: false, }, ), name: "nullable[list[str]]", }, ), validate_default: false, copy_default: false, name: "default[nullable[list[str]]]", undefined: Py( 0x00007ff1dc854dc0, ), }, ), frozen: false, }, Field { name: "license", lookup_key: Simple { key: "license", py_key: Py( 0x00007ff1d83bc1f0, ), path: LookupPath( [ S( "license", Py( 0x00007ff1d83bc230, ), ), ], ), }, name_py: Py( 0x00007ff1df3480b0, ), validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007ff1dfb78940, ), ), on_error: Raise, validator: Nullable( NullableValidator { validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), name: "nullable[str]", }, ), validate_default: false, copy_default: false, name: "default[nullable[str]]", undefined: Py( 0x00007ff1dc854dc0, ), }, ), frozen: false, }, Field { name: "description", lookup_key: Simple { key: "description", py_key: Py( 0x00007ff1d83bc270, ), path: LookupPath( [ S( "description", Py( 0x00007ff1d83bc2b0, ), ), ], ), }, name_py: Py( 0x00007ff1def54ff0, ), validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007ff1dfb78940, ), ), on_error: Raise, validator: Nullable( NullableValidator { validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), name: "nullable[str]", }, ), validate_default: false, copy_default: false, name: "default[nullable[str]]", undefined: Py( 0x00007ff1dc854dc0, ), }, ), frozen: false, }, Field { name: "keywords", lookup_key: Simple { key: "keywords", py_key: Py( 0x00007ff1d83bc2f0, ), path: LookupPath( [ S( "keywords", Py( 0x00007ff1d83bc330, ), ), ], ), }, name_py: Py( 0x00007ff1df3eebb0, ), validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007ff1dfb78940, ), ), on_error: Raise, validator: Nullable( NullableValidator { validator: List( ListValidator { strict: false, item_validator: Some( Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), ), min_length: None, max_length: None, name: OnceLock( "list[str]", ), fail_fast: false, }, ), name: "nullable[list[str]]", }, ), validate_default: false, copy_default: false, name: "default[nullable[list[str]]]", undefined: Py( 0x00007ff1dc854dc0, ), }, ), frozen: false, }, Field { name: "links", lookup_key: Simple { key: "links", py_key: Py( 0x00007ff1d83bc370, ), path: LookupPath( [ S( "links", Py( 0x00007ff1d83bc3b0, ), ), ], ), }, name_py: Py( 0x00007ff1dd8c01b0, ), validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007ff1dfb78940, ), ), on_error: Raise, validator: Nullable( NullableValidator { validator: Dict( DictValidator { strict: false, key_validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), value_validator: Url( UrlValidator { strict: false, max_length: None, allowed_schemes: None, host_required: false, default_host: None, default_port: None, default_path: None, name: "url", }, ), min_length: None, max_length: None, name: "dict[str,url]", }, ), name: "nullable[dict[str,url]]", }, ), validate_default: false, copy_default: false, name: "default[nullable[dict[str,url]]]", undefined: Py( 0x00007ff1dc854dc0, ), }, ), frozen: false, }, ], model_name: "PackageMeta", extra_behavior: Ignore, extras_validator: None, strict: false, from_attributes: false, loc_by_alias: true, }, ), class: Py( 0x0000562fc28b6b20, ), post_init: None, frozen: false, custom_init: false, root_model: false, undefined: Py( 0x00007ff1dc854dc0, ), name: "PackageMeta", }, ), validate_default: true, copy_default: true, name: "default[PackageMeta]", undefined: Py( 0x00007ff1dc854dc0, ), }, ), frozen: false, }, Field { name: "name", lookup_key: Simple { key: "name", py_key: Py( 0x00007ff1d83bc470, ), path: LookupPath( [ S( "name", Py( 0x00007ff1d83bc4b0, ), ), ], ), }, name_py: Py( 0x00007ff1df754af0, ), validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007ff1df708030, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: true, copy_default: false, name: "default[str]", undefined: Py( 0x00007ff1dc854dc0, ), }, ), frozen: false, }, Field { name: "base_path", lookup_key: Simple { key: "base_path", py_key: Py( 0x00007ff1d83bc4f0, ), path: LookupPath( [ S( "base_path", Py( 0x00007ff1d83bc530, ), ), ], ), }, name_py: Py( 0x00007ff1df7e1530, ), validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007ff1dfb78940, ), ), on_error: Raise, validator: Nullable( NullableValidator { validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), name: "nullable[str]", }, ), validate_default: true, copy_default: false, name: "default[nullable[str]]", undefined: Py( 0x00007ff1dc854dc0, ), }, ), frozen: false, }, Field { name: "request_headers", lookup_key: Simple { key: "request_headers", py_key: Py( 0x00007ff1d83bc570, ), path: LookupPath( [ S( "request_headers", Py( 0x00007ff1d83bc5b0, ), ), ], ), }, name_py: Py( 0x00007ff1dd3b0c30, ), validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007ff1d8383200, ), ), on_error: Raise, validator: Dict( DictValidator { strict: false, key_validator: Any( AnyValidator, ), value_validator: Any( AnyValidator, ), min_length: None, max_length: None, name: "dict[any,any]", }, ), validate_default: true, copy_default: true, name: "default[dict[any,any]]", undefined: Py( 0x00007ff1dc854dc0, ), }, ), frozen: false, }, Field { name: "version", lookup_key: Simple { key: "version", py_key: Py( 0x00007ff1d83bc5f0, ), path: LookupPath( [ S( "version", Py( 0x00007ff1d83bc630, ), ), ], ), }, name_py: Py( 0x00007ff1df7775f0, ), validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007ff1df708030, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: true, copy_default: false, name: "default[str]", undefined: Py( 0x00007ff1dc854dc0, ), }, ), frozen: false, }, ], model_name: "ApeConfig", extra_behavior: Allow, extras_validator: None, strict: false, from_attributes: false, loc_by_alias: true, }, ), func: Py( 0x00007ff1d83a25c0, ), config: Py( 0x00007ff1d83aff40, ), name: "function-before[validate_model(), model-fields]", field_name: None, info_arg: false, }, ), class: Py( 0x0000562fc3984640, ), post_init: None, frozen: false, custom_init: true, root_model: false, undefined: Py( 0x00007ff1dc854dc0, ), name: "ApeConfig", }, ), definitions=[], cache_strings=True)
The pydantic-core SchemaValidator used to validate instances of the model.
- __repr__()
Return repr(self).
- __signature__: ClassVar[Signature] = <Signature (*args, contracts_folder: Optional[str] = None, default_ecosystem: str = 'ethereum', dependencies: list[dict] = [], deployments: dict[str, dict[str, list[ape.api.config.DeploymentConfig]]] = None, interfaces_folder: str = 'interfaces', meta: ethpm_types.manifest.PackageMeta = PackageMeta(authors=None, license=None, description=None, keywords=None, links=None), name: str = '', base_path: Optional[str] = None, request_headers: dict = {}, version: str = '', **kwargs) -> None>
The synthesized __init__ [Signature][inspect.Signature] of the model.
- __str__() str
Return str(self).
- base_path: str | None
Use this when the project’s base-path is not the root of the project.
- contracts_folder: str | None
The path to the folder containing the contract source files. NOTE: Non-absolute paths are relative to the project-root. If not set, defaults to deducing the contracts folder. When deducing, Ape first tries
"contracts"
, but if that folder does not exist, Ape tries to find a folder with contracts.
- default_ecosystem: str
The default ecosystem to use in Ape.
- dependencies: list[dict]
Project dependency declarations. Note: The actual dependency classes are decoded later.
- deployment_data: dict[str, dict[str, list[DeploymentConfig]]]
Data for deployed contracts from the project.
- interfaces_folder: str
The path to the project’s interfaces.
- meta: PackageMeta
Metadata about the active project as per EIP https://eips.ethereum.org/EIPS/eip-2678#the-package-meta-object
- model_dump(*args, **kwargs)
Usage docs: https://docs.pydantic.dev/2.9/concepts/serialization/#modelmodel_dump
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
- Parameters:
mode – The mode in which to_python should run. If mode is ‘json’, the output will only contain JSON serializable types. If mode is ‘python’, the output may contain non-JSON-serializable Python objects.
include – A set of fields to include in the output.
exclude – A set of fields to exclude from the output.
context – Additional context to pass to the serializer.
by_alias – Whether to use the field’s alias in the dictionary key if defined.
exclude_unset – Whether to exclude fields that have not been explicitly set.
exclude_defaults – Whether to exclude fields that are set to their default value.
exclude_none – Whether to exclude fields that have a value of None.
round_trip – If True, dumped values should be valid as input for non-idempotent types such as Json[T].
warnings – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].
serialize_as_any – Whether to serialize fields with duck-typing serialization behavior.
- Returns:
A dictionary representation of the model.
- name: str
The name of the project.
- request_headers: dict
Extra request headers for all HTTP requests.
- version: str
The version of the project.
- class ape.api.config.ConfigEnum(value)
Bases:
str
,Enum
A configuration Enum type. Use this to limit the values of a config item, such as colors
"RED"
,"BLUE"
,"GREEN"
, rather than any arbitrarystr
.Usage example:
class MyEnum(ConfigEnum): FOO = "FOO" BAR = "BAR" class MyConfig(PluginConfig): my_enum: MyEnum model = MyConfig(my_enum="FOO")
- __repr__()
Return repr(self).
- __str__()
Return str(self).
- class ape.api.config.DeploymentConfig(_case_sensitive: bool | None = None, _nested_model_default_partial_update: bool | None = None, _env_prefix: str | None = None, _env_file: DotenvType | None = PosixPath('.'), _env_file_encoding: str | None = None, _env_ignore_empty: bool | None = None, _env_nested_delimiter: str | None = None, _env_parse_none_str: str | None = None, _env_parse_enums: bool | None = None, _cli_prog_name: str | None = None, _cli_parse_args: bool | list[str] | tuple[str, ...] | None = None, _cli_settings_source: CliSettingsSource[Any] | None = None, _cli_parse_none_str: str | None = None, _cli_hide_none_type: bool | None = None, _cli_avoid_json: bool | None = None, _cli_enforce_required: bool | None = None, _cli_use_class_docs_for_groups: bool | None = None, _cli_exit_on_error: bool | None = None, _cli_prefix: str | None = None, _cli_implicit_flags: bool | None = None, _secrets_dir: PathType | None = None, *, address: Annotated[ChecksumAddress, _AddressValidator], contract_type: str, **values: Any)
Bases:
PluginConfig
Add ‘deployments’ to your config.
- __class_vars__: ClassVar[set[str]] = {}
The names of the class variables defined on the model.
- __private_attributes__: ClassVar[Dict[str, ModelPrivateAttr]] = {}
Metadata about the private attributes of the model.
- __pydantic_complete__: ClassVar[bool] = True
Whether model building is completed, or if there are still undefined fields.
- __pydantic_core_schema__: ClassVar[CoreSchema] = {'cls': <class 'ape.api.config.DeploymentConfig'>, 'config': {'extra_fields_behavior': 'allow', 'title': 'DeploymentConfig', 'validate_default': True}, 'custom_init': True, 'metadata': {'pydantic_js_annotation_functions': [], 'pydantic_js_functions': [functools.partial(<function modify_model_json_schema>, cls=<class 'ape.api.config.DeploymentConfig'>, title=None), <bound method BaseModel.__get_pydantic_json_schema__ of <class 'ape.api.config.DeploymentConfig'>>]}, 'ref': 'ape.api.config.DeploymentConfig:94763144978848', 'root_model': False, 'schema': {'computed_fields': [], 'fields': {'address': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'function': {'function': <bound method _AddressValidator.__eth_pydantic_validate__ of <class 'ape.types.address._AddressValidator'>>, 'type': 'with-info'}, 'metadata': {'pydantic_js_annotation_functions': [<bound method BaseHex.__get_pydantic_json_schema__ of <class 'ape.types.address._AddressValidator'>>]}, 'schema': {'max_length': 42, 'min_length': 42, 'type': 'str'}, 'type': 'function-before'}, 'type': 'model-field'}, 'contract_type': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'type': 'str'}, 'type': 'model-field'}}, 'model_name': 'DeploymentConfig', 'type': 'model-fields'}, 'type': 'model'}
The core schema of the model.
- __pydantic_custom_init__: ClassVar[bool] = True
Whether the model has a custom __init__ method.
- __pydantic_decorators__: ClassVar[_decorators.DecoratorInfos] = DecoratorInfos(validators={}, field_validators={}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={}, computed_fields={})
Metadata containing the decorators defined on the model. This replaces Model.__validators__ and Model.__root_validators__ from Pydantic V1.
- __pydantic_extra__: dict[str, Any] | None
A dictionary containing extra values, if [extra][pydantic.config.ConfigDict.extra] is set to ‘allow’.
- __pydantic_fields_set__: set[str]
The names of fields explicitly set during instantiation.
- __pydantic_generic_metadata__: ClassVar[_generics.PydanticGenericMetadata] = {'args': (), 'origin': None, 'parameters': ()}
Metadata for generic models; contains data used for a similar purpose to __args__, __origin__, __parameters__ in typing-module generics. May eventually be replaced by these.
- __pydantic_parent_namespace__: ClassVar[Dict[str, Any] | None] = None
Parent namespace of the model, used for automatic rebuilding of models.