Repository: ethereum/web3.py

Issue:
Rename `encodeABI` in base_contract
### What was wrong?

Method doesn't follow standard Python conventions, should be `encode_abi`.

### How can it be fixed?

Deprecate in v6.
For v7, rename the class method and update references.


Discussion:

Resolving patch:
diff --git a/ens/async_ens.py b/ens/async_ens.py
--- a/ens/async_ens.py
+++ b/ens/async_ens.py
@@ -490,7 +490,7 @@ async def _resolve(
         ):
             contract_func_with_args = (fn_name, [node])
 
-            calldata = resolver.encodeABI(*contract_func_with_args)
+            calldata = resolver.encode_abi(*contract_func_with_args)
             contract_call_result = await resolver.caller.resolve(
                 ens_encode_name(normal_name),
                 calldata,
diff --git a/ens/ens.py b/ens/ens.py
--- a/ens/ens.py
+++ b/ens/ens.py
@@ -477,7 +477,7 @@ def _resolve(
         if _resolver_supports_interface(resolver, ENS_EXTENDED_RESOLVER_INTERFACE_ID):
             contract_func_with_args = (fn_name, [node])
 
-            calldata = resolver.encodeABI(*contract_func_with_args)
+            calldata = resolver.encode_abi(*contract_func_with_args)
             contract_call_result = resolver.caller.resolve(
                 ens_encode_name(normal_name),
                 calldata,
diff --git a/web3/contract/base_contract.py b/web3/contract/base_contract.py
--- a/web3/contract/base_contract.py
+++ b/web3/contract/base_contract.py
@@ -723,7 +723,7 @@ class BaseContract:
     #  Public API
     #
     @combomethod
-    def encodeABI(
+    def encode_abi(
         cls,
         fn_name: str,
         args: Optional[Any] = None,


Test patch:
diff --git a/tests/core/contracts/test_contract_method_abi_encoding.py b/tests/core/contracts/test_contract_method_abi_encoding.py
--- a/tests/core/contracts/test_contract_method_abi_encoding.py
+++ b/tests/core/contracts/test_contract_method_abi_encoding.py
@@ -64,7 +64,7 @@
 )
 def test_contract_abi_encoding(w3, abi, arguments, data, expected):
     contract = w3.eth.contract(abi=abi)
-    actual = contract.encodeABI("a", arguments, data=data)
+    actual = contract.encode_abi("a", arguments, data=data)
     assert actual == expected
 
 
@@ -116,7 +116,7 @@ def test_contract_abi_encoding_non_strict(
     w3_non_strict_abi, abi, arguments, data, expected
 ):
     contract = w3_non_strict_abi.eth.contract(abi=abi)
-    actual = contract.encodeABI("a", arguments, data=data)
+    actual = contract.encode_abi("a", arguments, data=data)
     assert actual == expected
 
 
@@ -128,7 +128,7 @@ def test_contract_abi_encoding_kwargs(w3):
             "0x6f8d2fa18448afbfe4f82143c384484ad09a0271f3a3c0eb9f629e703f883125",
         ],
     }
-    actual = contract.encodeABI("byte_array", kwargs=kwargs)
+    actual = contract.encode_abi("byte_array", kwargs=kwargs)
     assert (
         actual
         == "0xf166d6f8000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000025595c210956e7721f9b692e702708556aa9aabb14ea163e96afa56ffbe9fa8096f8d2fa18448afbfe4f82143c384484ad09a0271f3a3c0eb9f629e703f883125"  # noqa: E501
@@ -146,7 +146,7 @@ def test_contract_abi_encoding_kwargs(w3):
 def test_contract_abi_encoding_strict_with_error(w3, arguments):
     contract = w3.eth.contract(abi=ABI_C)
     with pytest.raises(Web3ValidationError):
-        contract.encodeABI("a", arguments, data=None)
+        contract.encode_abi("a", arguments, data=None)
 
 
 @pytest.mark.parametrize(
@@ -195,5 +195,5 @@ def test_contract_abi_encoding_strict_with_error(w3, arguments):
 )
 def test_contract_abi_encoding_strict(w3, abi, arguments, data, expected):
     contract = w3.eth.contract(abi=abi)
-    actual = contract.encodeABI("a", arguments, data=data)
+    actual = contract.encode_abi("a", arguments, data=data)
     assert actual == expected
diff --git a/web3/_utils/module_testing/eth_module.py b/web3/_utils/module_testing/eth_module.py
--- a/web3/_utils/module_testing/eth_module.py
+++ b/web3/_utils/module_testing/eth_module.py
@@ -1336,7 +1336,7 @@ async def test_eth_call_revert_custom_error_with_msg(
         async_revert_contract: "Contract",
         async_unlocked_account: ChecksumAddress,
     ) -> None:
-        data = async_revert_contract.encodeABI(
+        data = async_revert_contract.encode_abi(
             fn_name="UnauthorizedWithMessage", args=["You are not authorized"]
         )
         txn_params = async_revert_contract._prepare_transaction(
@@ -1356,7 +1356,7 @@ async def test_eth_call_revert_custom_error_without_msg(
         async_revert_contract: "Contract",
         async_unlocked_account: ChecksumAddress,
     ) -> None:
-        data = async_revert_contract.encodeABI(fn_name="Unauthorized")
+        data = async_revert_contract.encode_abi(fn_name="Unauthorized")
         txn_params = async_revert_contract._prepare_transaction(
             fn_name="customErrorWithoutMessage",
             transaction={
@@ -3788,7 +3788,7 @@ def test_eth_call_custom_error_revert_with_msg(
         revert_contract: "Contract",
         unlocked_account: ChecksumAddress,
     ) -> None:
-        data = revert_contract.encodeABI(
+        data = revert_contract.encode_abi(
             fn_name="UnauthorizedWithMessage", args=["You are not authorized"]
         )
         txn_params = revert_contract._prepare_transaction(
@@ -3808,7 +3808,7 @@ def test_eth_call_custom_error_revert_without_msg(
         revert_contract: "Contract",
         unlocked_account: ChecksumAddress,
     ) -> None:
-        data = revert_contract.encodeABI(fn_name="Unauthorized")
+        data = revert_contract.encode_abi(fn_name="Unauthorized")
         txn_params = revert_contract._prepare_transaction(
             fn_name="customErrorWithoutMessage",
             transaction={
@@ -4097,7 +4097,7 @@ def test_eth_estimate_gas_custom_error_revert_with_msg(
         revert_contract: "Contract",
         unlocked_account: ChecksumAddress,
     ) -> None:
-        data = revert_contract.encodeABI(
+        data = revert_contract.encode_abi(
             fn_name="UnauthorizedWithMessage", args=["You are not authorized"]
         )
         txn_params = revert_contract._prepare_transaction(
@@ -4117,7 +4117,7 @@ def test_eth_estimate_gas_custom_error_revert_without_msg(
         revert_contract: "Contract",
         unlocked_account: ChecksumAddress,
     ) -> None:
-        data = revert_contract.encodeABI(fn_name="Unauthorized")
+        data = revert_contract.encode_abi(fn_name="Unauthorized")
         txn_params = revert_contract._prepare_transaction(
             fn_name="customErrorWithoutMessage",
             transaction={