eth-abi-lite


Nameeth-abi-lite JSON
Version 3.2.0 PyPI version JSON
download
home_pagehttps://github.com/sslivkoff/eth-abi-lite
Summaryeth_abi_lite is a lite fork of `eth_abi`, aiming to support EVM abi encode/decode functionality without external dependencies on `eth_utils`, `eth_typing`, `toolz`, or `cytoolz`
upload_time2023-04-12 18:46:52
maintainer
docs_urlNone
author
requires_python>=3.7, <4
licenseMIT
keywords ethereum
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# `eth_abi_lite`

`eth_abi_lite` is a lite fork of `eth_abi`, aiming to support EVM abi encode/decode functionality without external dependencies on `eth_utils`, `eth_typing`, `toolz`, or `cytoolz`.

`eth_abi_lite` can be used as a drop-in replacement for `eth_abi==3.0.0`.

Install with `pip install eth_abi_lite`

#### Motivation
1) Many packages in the ethereum ecosystem have conflicting version requirements for dependencies such as `eth_utils`, `eth_typing`, `toolz`, or `cytoolz`. Removing these dependencies allows a package to be used in more environments.
2) These dependencies are rather heavy if all you want is basic abi encoding/decoding functionality.

#### Does `eth_abi_lite` work the same as `eth_abi`?

`eth_abi_lite` can be used as a drop-in replacement for `eth_abi==3.0.0`. The one functional difference is that `eth_abi`'s low level pad functions are no longer curry-able. In most cases this difference will not be noticed.

`eth_abi_lite` passes `eth_abi`'s standard test suite when running `tox`:

```
...
======================== 751 passed, 3 skipped in 18.45s ========================
____________________________________ summary ____________________________________
  py37-core: commands succeeded                                                  
  py38-core: commands succeeded                                                  
  py39-core: commands succeeded                                                  
  py310-core: commands succeeded                                                 
  congratulations :)                                                             
```

(tests for linting and docs removed)


#### Is `eth_abi_lite` faster?

According to testing with [tuna](https://github.com/nschloe/tuna) on a good laptop:
- `eth_abi_lite` takes about **18 ms** to import
- `eth_abi` takes about **180 ms** to import

`eth_abi_lite` is faster to import because it loads fewer dependencies. This is useful in the context of cli tools where startup times matter.


## Survey of imported items

`eth_abi_lite` imports the following items from its dependencies:

#### Items Imported From `eth_utils`
- `big_endian_to_int`
- `compose_if_tuple`
- `int_to_big_endian`
- `is_address`
- `is_boolean`
- `is_bytes`
- `is_integer`
- `is_list_like`
- `is_number`
- `is_text`
- `to_canonical_address`
- `to_checksum_address`
- `to_normalized_address`
- `to_tuple`

#### Items Imported From `eth_typing`
- `TypeStr`
- `Decodable`

#### Items Imported From `eth_utils.toolz`
- `toolz.functoolz.curry`


## The Changes
The changes from `eth_abi` to `eth_abi_lite` consist mostly of copying portions of `eth_utils` and `eth_typing`.

The basic idea is that every time something is imported from `eth_utils` or `eth_typing`, that thing is instead imported from a lite version of that package.


#### Step 1. Create `eth_utils_lite`

Copy these items from `eth_utils` to `eth_utils_lite`
- `eth_utils/abi.py`
- `eth_utils/address.py`
- `eth_utils/conversions.py`
- `eth_utils/crypto.py`
- `eth_utils/decorators.py`
- `eth_utils/encoding.py`
- `eth_utils/functional.py`
- `eth_utils/hexadecimal.py`
- `eth_utils/types.py`

The only non-mutual dependency in these modules is `eth_hash.keccak()` in `eth_utils/crypto.py`. Replace this function with `pycryptodome`'s keccak implementation directly.

Also in `eth_utils/functional.py`, remove the functions that are decorated by `toolz.compose`.

It is possible to prune these files more aggressively, but leaving the files unchanged minimizes the chances of introducing bugs.

#### Step 2. Create `eth_typing_lite`

Copy these items from `eth_typing` to `eth_typing_lite`:
- `Address`
- `AnyAddress`
- `ChecksumAddress`
- `Decodable`
- `HexAddress`
- `HexStr`
- `Primitives`
- `TypeStr`

These are all of the `eth_typing` types used by `eth_abi_lite` and `eth_utils_lite`.


#### Step 3. Create `eth_abi_lite`

1. Copy all files from `eth_abi` into `eth_abi_lite`
2. Replace all instances of
    - `eth_utils` with `eth_utils`
    - `eth_typing` with `eth_typing_lite`
    - `eth_abi` with `eth_abi_lite`
3. Replace the `toolz.curry` decoration on `eth_abi.zpad` and `eth_abi.fpad` with `functools.partial` decoration.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/sslivkoff/eth-abi-lite",
    "name": "eth-abi-lite",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7, <4",
    "maintainer_email": "",
    "keywords": "ethereum",
    "author": "",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/aa/50/cc55803212241bb4768c15b08547632c43d1afcb82ce2daa7b0eed3fefc4/eth_abi_lite-3.2.0.tar.gz",
    "platform": null,
    "description": "\n# `eth_abi_lite`\n\n`eth_abi_lite` is a lite fork of `eth_abi`, aiming to support EVM abi encode/decode functionality without external dependencies on `eth_utils`, `eth_typing`, `toolz`, or `cytoolz`.\n\n`eth_abi_lite` can be used as a drop-in replacement for `eth_abi==3.0.0`.\n\nInstall with `pip install eth_abi_lite`\n\n#### Motivation\n1) Many packages in the ethereum ecosystem have conflicting version requirements for dependencies such as `eth_utils`, `eth_typing`, `toolz`, or `cytoolz`. Removing these dependencies allows a package to be used in more environments.\n2) These dependencies are rather heavy if all you want is basic abi encoding/decoding functionality.\n\n#### Does `eth_abi_lite` work the same as `eth_abi`?\n\n`eth_abi_lite` can be used as a drop-in replacement for `eth_abi==3.0.0`. The one functional difference is that `eth_abi`'s low level pad functions are no longer curry-able. In most cases this difference will not be noticed.\n\n`eth_abi_lite` passes `eth_abi`'s standard test suite when running `tox`:\n\n```\n...\n======================== 751 passed, 3 skipped in 18.45s ========================\n____________________________________ summary ____________________________________\n  py37-core: commands succeeded                                                  \n  py38-core: commands succeeded                                                  \n  py39-core: commands succeeded                                                  \n  py310-core: commands succeeded                                                 \n  congratulations :)                                                             \n```\n\n(tests for linting and docs removed)\n\n\n#### Is `eth_abi_lite` faster?\n\nAccording to testing with [tuna](https://github.com/nschloe/tuna) on a good laptop:\n- `eth_abi_lite` takes about **18 ms** to import\n- `eth_abi` takes about **180 ms** to import\n\n`eth_abi_lite` is faster to import because it loads fewer dependencies. This is useful in the context of cli tools where startup times matter.\n\n\n## Survey of imported items\n\n`eth_abi_lite` imports the following items from its dependencies:\n\n#### Items Imported From `eth_utils`\n- `big_endian_to_int`\n- `compose_if_tuple`\n- `int_to_big_endian`\n- `is_address`\n- `is_boolean`\n- `is_bytes`\n- `is_integer`\n- `is_list_like`\n- `is_number`\n- `is_text`\n- `to_canonical_address`\n- `to_checksum_address`\n- `to_normalized_address`\n- `to_tuple`\n\n#### Items Imported From `eth_typing`\n- `TypeStr`\n- `Decodable`\n\n#### Items Imported From `eth_utils.toolz`\n- `toolz.functoolz.curry`\n\n\n## The Changes\nThe changes from `eth_abi` to `eth_abi_lite` consist mostly of copying portions of `eth_utils` and `eth_typing`.\n\nThe basic idea is that every time something is imported from `eth_utils` or `eth_typing`, that thing is instead imported from a lite version of that package.\n\n\n#### Step 1. Create `eth_utils_lite`\n\nCopy these items from `eth_utils` to `eth_utils_lite`\n- `eth_utils/abi.py`\n- `eth_utils/address.py`\n- `eth_utils/conversions.py`\n- `eth_utils/crypto.py`\n- `eth_utils/decorators.py`\n- `eth_utils/encoding.py`\n- `eth_utils/functional.py`\n- `eth_utils/hexadecimal.py`\n- `eth_utils/types.py`\n\nThe only non-mutual dependency in these modules is `eth_hash.keccak()` in `eth_utils/crypto.py`. Replace this function with `pycryptodome`'s keccak implementation directly.\n\nAlso in `eth_utils/functional.py`, remove the functions that are decorated by `toolz.compose`.\n\nIt is possible to prune these files more aggressively, but leaving the files unchanged minimizes the chances of introducing bugs.\n\n#### Step 2. Create `eth_typing_lite`\n\nCopy these items from `eth_typing` to `eth_typing_lite`:\n- `Address`\n- `AnyAddress`\n- `ChecksumAddress`\n- `Decodable`\n- `HexAddress`\n- `HexStr`\n- `Primitives`\n- `TypeStr`\n\nThese are all of the `eth_typing` types used by `eth_abi_lite` and `eth_utils_lite`.\n\n\n#### Step 3. Create `eth_abi_lite`\n\n1. Copy all files from `eth_abi` into `eth_abi_lite`\n2. Replace all instances of\n    - `eth_utils` with `eth_utils`\n    - `eth_typing` with `eth_typing_lite`\n    - `eth_abi` with `eth_abi_lite`\n3. Replace the `toolz.curry` decoration on `eth_abi.zpad` and `eth_abi.fpad` with `functools.partial` decoration.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "eth_abi_lite is a lite fork of `eth_abi`, aiming to support EVM abi encode/decode functionality without external dependencies on `eth_utils`, `eth_typing`, `toolz`, or `cytoolz`",
    "version": "3.2.0",
    "split_keywords": [
        "ethereum"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5ab2ecbcab5a769671448bf813690eac2c21f1fad6f41b2d5713f0b4cbd13f47",
                "md5": "1a7e24a2a8c9d3d90a2642532de43257",
                "sha256": "2ace29952e7682598446c996e956536847d7951edc3532f41c5c0f3b89784e7e"
            },
            "downloads": -1,
            "filename": "eth_abi_lite-3.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1a7e24a2a8c9d3d90a2642532de43257",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7, <4",
            "size": 65394,
            "upload_time": "2023-04-12T18:46:50",
            "upload_time_iso_8601": "2023-04-12T18:46:50.107584Z",
            "url": "https://files.pythonhosted.org/packages/5a/b2/ecbcab5a769671448bf813690eac2c21f1fad6f41b2d5713f0b4cbd13f47/eth_abi_lite-3.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "aa50cc55803212241bb4768c15b08547632c43d1afcb82ce2daa7b0eed3fefc4",
                "md5": "a467293a735c2d1ddbff5b9a19ad094a",
                "sha256": "53e8b4028d671f2aa217ecee85865bb3960b7d54d199eff53f1daeba71dfef5f"
            },
            "downloads": -1,
            "filename": "eth_abi_lite-3.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "a467293a735c2d1ddbff5b9a19ad094a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7, <4",
            "size": 56690,
            "upload_time": "2023-04-12T18:46:52",
            "upload_time_iso_8601": "2023-04-12T18:46:52.410976Z",
            "url": "https://files.pythonhosted.org/packages/aa/50/cc55803212241bb4768c15b08547632c43d1afcb82ce2daa7b0eed3fefc4/eth_abi_lite-3.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-04-12 18:46:52",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "sslivkoff",
    "github_project": "eth-abi-lite",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "circle": true,
    "tox": true,
    "lcname": "eth-abi-lite"
}
        
Elapsed time: 0.05971s