# Quick Start
EthPM is an Ethereum package manifest containing data types for contracts, deployments, and source code using [EIP-2678](https://eips.ethereum.org/EIPS/eip-2678).
The library validates and serializes contract related data and provides JSON schemas.
## Dependencies
- [python3](https://www.python.org/downloads) version 3.9 to 3.12.
## Installation
### via `pip`
You can install the latest release via [`pip`](https://pypi.org/project/pip/):
```bash
pip install ethpm-types
```
### via `setuptools`
You can clone the repository and use [`setuptools`](https://github.com/pypa/setuptools) for the most up-to-date version:
```bash
git clone https://github.com/ApeWorX/ethpm-types.git
cd ethpm-types
python3 setup.py install
```
## Quick Usage
Starting with a dictionary of attribute data, such as a contract instance, you can build an EthPM typed object.
```python
from ethpm_types import ContractInstance
contract = ContractInstance(contractType="ContractClassName", address="0x123...")
print(contract.contract_type)
```
### Contract Type
Perhaps the most common artifact type from `ethmp_types` is `ContractType`.
`ContractType` represents components of a compiled contract, such as the `.abi` or the `.runtime_bytecode`.
```python
from ethpm_types import ContractType
contract = ContractType(abi=[], runtimeBytecode="0x...")
```
For convenience, you can also initialize a `ContractType` using the `.from_signature()` classmethod:
```python
from ethpm_types.abi import MethodABI, EventABI
MethodABI.from_signature("function_name(uint256 arg1)")
# => MethodABI(type='function', name='function_name', inputs=[...], ...)
EventABI.from_signature("Transfer(address indexed from, address indexed to, uint256 value)")
# => EventABI(type='event', name='Transfer', inputs=[...], ...)
```
#### ABI JSON
To easily acquire the ABI JSON for a `ContractType` artifact, `.model_dump_json()` the `.abi` property:
```python
from ethpm_types import ContractType
contract_type = ContractType(abi=[], runtimeBytecode="0x...")
# Use the ABI in other application requiring ABI JSON.
abi = contract_type.abi.model_dump_json()
```
Raw data
{
"_id": null,
"home_page": "https://github.com/ApeWorX/ethpm-types",
"name": "ethpm-types",
"maintainer": null,
"docs_url": null,
"requires_python": "<4,>=3.9",
"maintainer_email": null,
"keywords": "ethereum",
"author": "ApeWorX Ltd.",
"author_email": "admin@apeworx.io",
"download_url": "https://files.pythonhosted.org/packages/ce/05/58d503f4fd7f4cc552637569aced7e2ba71a423f078bfc377e990b65f8cd/ethpm_types-0.6.28.tar.gz",
"platform": null,
"description": "# Quick Start\n\nEthPM is an Ethereum package manifest containing data types for contracts, deployments, and source code using [EIP-2678](https://eips.ethereum.org/EIPS/eip-2678).\nThe library validates and serializes contract related data and provides JSON schemas.\n\n## Dependencies\n\n- [python3](https://www.python.org/downloads) version 3.9 to 3.12.\n\n## Installation\n\n### via `pip`\n\nYou can install the latest release via [`pip`](https://pypi.org/project/pip/):\n\n```bash\npip install ethpm-types\n```\n\n### via `setuptools`\n\nYou can clone the repository and use [`setuptools`](https://github.com/pypa/setuptools) for the most up-to-date version:\n\n```bash\ngit clone https://github.com/ApeWorX/ethpm-types.git\ncd ethpm-types\npython3 setup.py install\n```\n\n## Quick Usage\n\nStarting with a dictionary of attribute data, such as a contract instance, you can build an EthPM typed object.\n\n```python\nfrom ethpm_types import ContractInstance\n\ncontract = ContractInstance(contractType=\"ContractClassName\", address=\"0x123...\")\nprint(contract.contract_type)\n```\n\n### Contract Type\n\nPerhaps the most common artifact type from `ethmp_types` is `ContractType`.\n`ContractType` represents components of a compiled contract, such as the `.abi` or the `.runtime_bytecode`.\n\n```python\nfrom ethpm_types import ContractType\n\ncontract = ContractType(abi=[], runtimeBytecode=\"0x...\")\n```\n\nFor convenience, you can also initialize a `ContractType` using the `.from_signature()` classmethod:\n\n```python\nfrom ethpm_types.abi import MethodABI, EventABI\n\nMethodABI.from_signature(\"function_name(uint256 arg1)\")\n# => MethodABI(type='function', name='function_name', inputs=[...], ...)\n\nEventABI.from_signature(\"Transfer(address indexed from, address indexed to, uint256 value)\")\n# => EventABI(type='event', name='Transfer', inputs=[...], ...)\n```\n\n#### ABI JSON\n\nTo easily acquire the ABI JSON for a `ContractType` artifact, `.model_dump_json()` the `.abi` property:\n\n```python\nfrom ethpm_types import ContractType\n\ncontract_type = ContractType(abi=[], runtimeBytecode=\"0x...\")\n\n# Use the ABI in other application requiring ABI JSON.\nabi = contract_type.abi.model_dump_json()\n```\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "ethpm_types: Implementation of EIP-2678",
"version": "0.6.28",
"project_urls": {
"Homepage": "https://github.com/ApeWorX/ethpm-types"
},
"split_keywords": [
"ethereum"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "9d17f9eb2aaefe41dca8916df4922936d2f8ca29e996b1437a110069bd26a0ba",
"md5": "fd9d5bc3e193ced5fb37c0eaa706ec08",
"sha256": "c6dc77aa1f75ccfd7a7845bcde829adb16a7ab6fc782f14f6f219def59cd7954"
},
"downloads": -1,
"filename": "ethpm_types-0.6.28-py3-none-any.whl",
"has_sig": false,
"md5_digest": "fd9d5bc3e193ced5fb37c0eaa706ec08",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4,>=3.9",
"size": 35743,
"upload_time": "2025-10-08T21:25:59",
"upload_time_iso_8601": "2025-10-08T21:25:59.238203Z",
"url": "https://files.pythonhosted.org/packages/9d/17/f9eb2aaefe41dca8916df4922936d2f8ca29e996b1437a110069bd26a0ba/ethpm_types-0.6.28-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "ce0558d503f4fd7f4cc552637569aced7e2ba71a423f078bfc377e990b65f8cd",
"md5": "42459aaf3b08b97b5873ef22645f531e",
"sha256": "4777d73ab74ea3ad3b5881386e9c3df19c857f7d2b0b9dca8312385bc2d1e13e"
},
"downloads": -1,
"filename": "ethpm_types-0.6.28.tar.gz",
"has_sig": false,
"md5_digest": "42459aaf3b08b97b5873ef22645f531e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4,>=3.9",
"size": 1229490,
"upload_time": "2025-10-08T21:26:00",
"upload_time_iso_8601": "2025-10-08T21:26:00.738041Z",
"url": "https://files.pythonhosted.org/packages/ce/05/58d503f4fd7f4cc552637569aced7e2ba71a423f078bfc377e990b65f8cd/ethpm_types-0.6.28.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-10-08 21:26:00",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ApeWorX",
"github_project": "ethpm-types",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "ethpm-types"
}