diff --git a/.gitignore b/.gitignore index d7157d1321..359068dc2d 100644 --- a/.gitignore +++ b/.gitignore @@ -44,7 +44,6 @@ output/*/index.html # Sphinx docs/_build docs/modules.rst -docs/web3.auto.infura.rst docs/web3.auto.rst docs/web3.gas_strategies.rst docs/web3.middleware.rst diff --git a/docs/conf.py b/docs/conf.py index f40b54384d..8c1c903c39 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -82,7 +82,6 @@ "web3.rst", "modules.rst", "web3.auto.rst", - "web3.auto.infura.rst", "web3.gas_strategies.rst", "web3.middleware.rst", "web3.providers.rst", diff --git a/docs/contributing.rst b/docs/contributing.rst index cdc1da9266..c3c2235c99 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -380,7 +380,8 @@ virtualenv for smoke testing: # smoke test the release $ pip install ipython $ ipython - >>> from web3.auto import w3 + >>> from web3 import Web3, IPCProvider + >>> w3 = Web3(IPCProvider(provider_url)) >>> w3.is_connected() >>> ... diff --git a/docs/examples.rst b/docs/examples.rst index 1fb9ef7384..5d5c458155 100644 --- a/docs/examples.rst +++ b/docs/examples.rst @@ -422,10 +422,10 @@ it as a ``Package`` instance. .. code-block:: python3 - from web3.auto.infura import w3 - # Note. To use the web3.pm module, you will need to instantiate your w3 instance # with a web3 provider connected to the chain on which your registry lives. + from web3 import Web3, IPCProvider + w3 = Web3(IPCProvider(...)) # The ethPM module is still experimental and subject to change, # so for now we need to enable it via a temporary flag. @@ -471,8 +471,7 @@ within an ethPM package. # connected to your provider of choice. Now your factories will automatically # deploy to this new chain, and the deployments available on a package will # be automatically filtered to those located on the new chain. - from web3.auto.infura.goerli import w3 as goerli_w3 - goerli_registrar = ens_package.update_w3(goerli_w3) + goerli_registrar = ens_package.update_w3(goerli_w3_instance) Working with an ERC20 Token Contract diff --git a/docs/filters.rst b/docs/filters.rst index 0925d33cef..302712f4ff 100644 --- a/docs/filters.rst +++ b/docs/filters.rst @@ -8,18 +8,13 @@ Filtering .. note :: - Most one-liners below assume ``w3`` to be a :class:`web3.Web3` instance; - obtainable, for example, with: - - .. code-block:: python - - from web3.auto import w3 + Most one-liners below assume ``w3`` to be a :class:`web3.Web3` instance. The :meth:`web3.eth.Eth.filter` method can be used to set up filters for: -* Pending Transactions: ``web3.eth.filter('pending')`` +* Pending Transactions: ``w3.eth.filter("pending")`` -* New Blocks ``web3.eth.filter('latest')`` +* New Blocks ``w3.eth.filter("latest")`` * Event Logs @@ -27,7 +22,7 @@ The :meth:`web3.eth.Eth.filter` method can be used to set up filters for: .. code-block:: python - event_filter = mycontract.events.myEvent.create_filter(fromBlock='latest', argument_filters={'arg1':10}) + event_filter = mycontract.events.myEvent.create_filter(fromBlock="latest", argument_filters={"arg1":10}) Or built manually by supplying `valid filter params `_: @@ -203,9 +198,12 @@ Synchronous .. code-block:: python - from web3.auto import w3 + from web3 import Web3, IPCProvider import time + # instantiate Web3 instance + w3 = Web3(IPCProvider(...)) + def handle_event(event): print(event) @@ -242,9 +240,11 @@ entries to a handler. .. code-block:: python - from web3.auto import w3 + from web3 import Web3, IPCProvider import asyncio + # instantiate Web3 instance + w3 = Web3(IPCProvider(...)) def handle_event(event): print(event) @@ -281,10 +281,12 @@ releasing the ``main`` function for other tasks. .. code-block:: python - from web3.auto import w3 + from web3 import Web3, IPCProvider from threading import Thread import time + # instantiate Web3 instance + w3 = Web3(IPCProvider(...)) def handle_event(event): print(event) diff --git a/docs/providers.rst b/docs/providers.rst index 6423ca0781..1cae277aa5 100644 --- a/docs/providers.rst +++ b/docs/providers.rst @@ -65,86 +65,6 @@ Then you are ready to initialize your Web3 instance, like so: Finally, you are ready to :ref:`get started with Web3.py`. -.. _automatic_provider: - -Automatic vs Manual Providers ------------------------------ - -The ``Web3`` object will look for the Ethereum node in a few -standard locations if no providers are specified. Auto-detection happens -when you initialize like so: - -.. code-block:: python - - from web3.auto import w3 - - # which is equivalent to: - - from web3 import Web3 - w3 = Web3() - -Sometimes, web3 cannot automatically detect where your node is. - -- If you are not sure which kind of connection method to use, see - :ref:`choosing_provider`. -- If you know the connection method, but not the other information - needed to connect (like the path to the IPC file), you will need to look up - that information in your node's configuration. -- If you're not sure which node you are using, see :ref:`choosing_node` - -For a deeper dive into how automated detection works, see: - -.. _automatic_provider_detection: - -How Automated Detection Works -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Web3 attempts to connect to nodes in the following order, using the first -successful connection it can make: - -1. The connection specified by an environment variable, see :ref:`provider_uri` -2. :class:`~web3.providers.ipc.IPCProvider`, which looks for several IPC file locations. - ``IPCProvider`` will not automatically detect a testnet connection, it is suggested that the - user instead uses a ``w3`` instance from ``web3.auto.infura`` (e.g. - ``from web3.auto.infura.goerli import w3``) if they want to auto-detect a testnet. -3. :class:`~web3.providers.rpc.HTTPProvider`, which attempts to connect to "http://localhost:8545" -4. ``None`` - if no providers are successful, you can still use Web3 APIs - that do not require a connection, like: - - - :ref:`overview_type_conversions` - - :ref:`overview_currency_conversions` - - :ref:`overview_addresses` - - :ref:`eth-account` - - etc. - -.. _automatic_provider_detection_examples: - -Examples Using Automated Detection -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Some nodes provide APIs beyond the standards. Sometimes the same information is provided -in different ways across nodes. If you want to write code that works -across multiple nodes, you may want to look up the node type you are connected to. - -For example, the following retrieves the client enode endpoint for both geth and parity: - -.. code-block:: python - - from web3.auto import w3 - - connected = w3.is_connected() - - if connected and w3.client_version.startswith('Parity'): - enode = w3.parity.enode - - elif connected and w3.client_version.startswith('Geth'): - enode = w3.geth.admin.node_info['enode'] - - else: - enode = None - -.. _provider_uri: - Provider via Environment Variable ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -159,36 +79,9 @@ Valid formats for this environment variable are: - ``ws://127.0.0.1:8546`` -.. _custom_auto_providers: - Auto-initialization Provider Shortcuts -------------------------------------- -There are a couple auto-initialization shortcuts for common providers. - -Infura Mainnet -~~~~~~~~~~~~~~ - -To easily connect to the Infura Mainnet remote node, first register for a free -project ID if you don't have one at https://infura.io/register . - -Then set the environment variable ``WEB3_INFURA_PROJECT_ID`` with your Project ID:: - - $ export WEB3_INFURA_PROJECT_ID=YourProjectID - -If you have checked the box in the Infura UI indicating that requests need -an optional secret key, set the environment variable ``WEB3_INFURA_API_SECRET``:: - - $ export WEB3_INFURA_API_SECRET=YourProjectSecret - -.. code-block:: python - - >>> from web3.auto.infura import w3 - - # confirm that the connection succeeded - >>> w3.is_connected() - True - Geth dev Proof of Authority ~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/docs/quickstart.rst b/docs/quickstart.rst index ca6b18ab74..04435563b0 100644 --- a/docs/quickstart.rst +++ b/docs/quickstart.rst @@ -76,16 +76,6 @@ to this local node can be done as follows: >>> w3.is_connected() True -If you stick to the default ports or IPC file locations, you can utilize a -:ref:`convenience method ` to automatically detect the provider -and save a few keystrokes: - -.. code-block:: python - - >>> from web3.auto import w3 - >>> w3.is_connected() - True - Remote Providers **************** diff --git a/docs/releases.rst b/docs/releases.rst index da91bbbbee..3064c49b80 100644 --- a/docs/releases.rst +++ b/docs/releases.rst @@ -2272,7 +2272,7 @@ Released June 29, 2018 - :class:`~web3.providers.ipc.IPCProvider` now accepts a :class:`pathlib.Path` argument for the IPC path - - Docs explaining the :ref:`new custom autoproviders in web3 ` + - Docs explaining the new custom autoproviders in web3 v4.4.0 -------- diff --git a/docs/v5_migration.rst b/docs/v5_migration.rst index ec06bb455c..a0c2d8e116 100644 --- a/docs/v5_migration.rst +++ b/docs/v5_migration.rst @@ -117,8 +117,7 @@ Testnet Changes ~~~~~~~~~~~~~~~ Web3.py will no longer automatically look up a testnet connection -in IPCProvider. Something like ``from web3.auto.infura.ropsten import w3`` -should be used instead. +in IPCProvider. ENS --- diff --git a/docs/web3.eth.account.rst b/docs/web3.eth.account.rst index b4ce47b384..fdb555837b 100644 --- a/docs/web3.eth.account.rst +++ b/docs/web3.eth.account.rst @@ -78,9 +78,11 @@ Example ``account_test_script.py`` import os from eth_account import Account from eth_account.signers.local import LocalAccount - from web3.auto import w3 + from web3 import Web3, EthereumTesterProvider from web3.middleware import construct_sign_and_send_raw_middleware + w3 = Web3(EthereumTesterProvider()) + private_key = os.environ.get("PRIVATE_KEY") assert private_key is not None, "You must set PRIVATE_KEY environment variable" assert private_key.startswith("0x"), "Private key must start with 0x hex prefix" @@ -143,9 +145,10 @@ is provided by :meth:`w3.eth.sign() `. .. doctest:: - >>> from web3.auto import w3 + >>> from web3 import Web3, EthereumTesterProvider >>> from eth_account.messages import encode_defunct + >>> w3 = Web3(EthereumTesterProvider()) >>> msg = "I♥SF" >>> private_key = b"\xb2\\}\xb3\x1f\xee\xd9\x12''\xbf\t9\xdcv\x9a\x96VK-\xe4\xc4rm\x03[6\xec\xf1\xe5\xb3d" >>> message = encode_defunct(text=msg) @@ -334,7 +337,8 @@ To sign a transaction locally that will invoke a smart contract: # When running locally, execute the statements found in the file linked below to load the EIP20_ABI variable. # See: https://github.com/carver/ethtoken.py/blob/v0.0.1-alpha.4/ethtoken/abi.py - >>> from web3.auto import w3 + >>> from web3 import Web3, EthereumTesterProvider + >>> w3 = Web3(EthereumTesterProvider()) >>> unicorns = w3.eth.contract(address="0xfB6916095ca1df60bB79Ce92cE3Ea74c37c5d359", abi=EIP20_ABI) diff --git a/docs/web3.pm.rst b/docs/web3.pm.rst index 1ebc9a206d..f97db1c846 100644 --- a/docs/web3.pm.rst +++ b/docs/web3.pm.rst @@ -18,7 +18,8 @@ The ``web3.pm`` object exposes methods to interact with Packages as defined by ` .. code-block:: python - >>> from web3.auto import w3 + >>> from web3 import Web3, IPCProvider + >>> w3 = Web3(IPCProvider(...)) >>> w3.pm ... AttributeError: The Package Management feature is disabled by default ... diff --git a/ethpm/backends/registry.py b/ethpm/backends/registry.py index 5335a11e5b..ddaa29f778 100644 --- a/ethpm/backends/registry.py +++ b/ethpm/backends/registry.py @@ -46,7 +46,9 @@ class RegistryURIBackend(BaseURIBackend): """ def __init__(self) -> None: - from web3.auto.infura import w3 + from web3 import Web3, WebsocketProvider + + w3 = Web3(WebsocketProvider()) self.w3 = w3 @@ -88,7 +90,9 @@ def parse_registry_uri(uri: str) -> RegistryURI: Validate and return (authority, chain_id, pkg_name, version) from a valid registry URI. """ - from web3.auto.infura import w3 + from web3 import Web3, WebsocketProvider + + w3 = Web3(WebsocketProvider()) validate_registry_uri(uri) parsed_uri = parse.urlparse(uri) diff --git a/newsfragments/2706.removal.rst b/newsfragments/2706.removal.rst new file mode 100644 index 0000000000..620ccf145f --- /dev/null +++ b/newsfragments/2706.removal.rst @@ -0,0 +1 @@ +Removal of Infura auto provider support. diff --git a/tests/core/providers/test_auto_provider.py b/tests/core/providers/test_auto_provider.py index 9563b30e5a..cc20e1de52 100644 --- a/tests/core/providers/test_auto_provider.py +++ b/tests/core/providers/test_auto_provider.py @@ -1,14 +1,6 @@ -import importlib import os import pytest -from eth_utils import ( - ValidationError, -) - -from web3.exceptions import ( - InfuraProjectIdNotFound, -) from web3.providers import ( HTTPProvider, IPCProvider, @@ -23,9 +15,6 @@ # Ugly hack to import infura now that API KEY is required os.environ["WEB3_INFURA_PROJECT_ID"] = "test" -from web3.auto import ( # noqa E402 isort:skip - infura, -) @pytest.fixture(autouse=True) @@ -66,99 +55,3 @@ def test_get_dev_ipc_path(monkeypatch, tmp_path): monkeypatch.setenv("WEB3_PROVIDER_URI", uri) path = get_dev_ipc_path() assert path == uri - - -def test_web3_auto_infura_empty_key(monkeypatch): - monkeypatch.setenv("WEB3_INFURA_SCHEME", "https") - monkeypatch.setenv("WEB3_INFURA_PROJECT_ID", "") - - with pytest.raises(InfuraProjectIdNotFound): - importlib.reload(infura) - - -def test_web3_auto_infura_deleted_key(monkeypatch): - monkeypatch.setenv("WEB3_INFURA_SCHEME", "https") - - monkeypatch.delenv("WEB3_INFURA_PROJECT_ID", raising=False) - - with pytest.raises(InfuraProjectIdNotFound): - importlib.reload(infura) - - -def test_web3_auto_infura_websocket_empty_key(monkeypatch): - monkeypatch.setenv("WEB3_INFURA_PROJECT_ID", "") - - with pytest.raises(InfuraProjectIdNotFound): - importlib.reload(infura) - - -def test_web3_auto_infura_websocket_deleted_key(monkeypatch): - monkeypatch.delenv("WEB3_INFURA_PROJECT_ID", raising=False) - - with pytest.raises(InfuraProjectIdNotFound): - importlib.reload(infura) - - -def test_web3_auto_infura(monkeypatch, caplog): - monkeypatch.setenv("WEB3_INFURA_SCHEME", "https") - API_KEY = "aoeuhtns" - - monkeypatch.setenv("WEB3_INFURA_PROJECT_ID", API_KEY) - - importlib.reload(infura) - assert len(caplog.record_tuples) == 0 - - w3 = infura.w3 - assert isinstance(w3.provider, HTTPProvider) - expected_url = f"https://{infura.INFURA_MAINNET_DOMAIN}/v3/{API_KEY}" - assert getattr(w3.provider, "endpoint_uri") == expected_url - - -def test_web3_auto_infura_websocket_default(monkeypatch, caplog): - monkeypatch.setenv("WEB3_INFURA_SCHEME", "wss") - API_KEY = "aoeuhtns" - monkeypatch.setenv("WEB3_INFURA_PROJECT_ID", API_KEY) - expected_url = f"wss://{infura.INFURA_MAINNET_DOMAIN}/ws/v3/{API_KEY}" - - importlib.reload(infura) - assert len(caplog.record_tuples) == 0 - - w3 = infura.w3 - assert isinstance(w3.provider, WebsocketProvider) - assert getattr(w3.provider, "endpoint_uri") == expected_url - - -def test_web3_auto_infura_raises_error_with_nonexistent_scheme(monkeypatch): - monkeypatch.setenv("WEB3_INFURA_PROJECT_ID", "test") - monkeypatch.setenv("WEB3_INFURA_SCHEME", "not-a-scheme") - - error_msg = "Cannot connect to Infura with scheme 'not-a-scheme'" - with pytest.raises(ValidationError, match=error_msg): - importlib.reload(infura) - - -def test_web3_auto_infura_websocket_with_secret(monkeypatch): - monkeypatch.setenv("WEB3_INFURA_PROJECT_ID", "test") - monkeypatch.setenv("WEB3_INFURA_API_SECRET", "secret") - - importlib.reload(infura) - - w3 = infura.w3 - assert isinstance(w3.provider, WebsocketProvider) - expected_url = f"wss://:secret@{infura.INFURA_MAINNET_DOMAIN}/ws/v3/test" - assert getattr(w3.provider, "endpoint_uri") == expected_url - - -def test_web3_auto_infura_with_secret(monkeypatch): - monkeypatch.setenv("WEB3_INFURA_SCHEME", "https") - monkeypatch.setenv("WEB3_INFURA_PROJECT_ID", "test") - monkeypatch.setenv("WEB3_INFURA_API_SECRET", "secret") - - importlib.reload(infura) - - w3 = infura.w3 - assert isinstance(w3.provider, HTTPProvider) - expected_url = f"https://{infura.INFURA_MAINNET_DOMAIN}/v3/test" - expected_auth_value = ("", "secret") - assert getattr(w3.provider, "endpoint_uri") == expected_url - assert w3.provider.get_request_kwargs()["auth"] == expected_auth_value diff --git a/tox.ini b/tox.ini index c49ad89d8c..94358f3567 100644 --- a/tox.ini +++ b/tox.ini @@ -84,7 +84,7 @@ commands= /bin/rm -rf build dist python setup.py sdist bdist_wheel /bin/bash -c 'pip install --upgrade "$(ls dist/web3-*-py3-none-any.whl)" --progress-bar off' - python -c "from web3.auto import w3" + python -c "from web3 import Web3" [testenv:py37-wheel-cli] deps={[common-wheel-cli]deps} @@ -118,7 +118,7 @@ commands= bash.exe -c "rm -rf build dist" python setup.py sdist bdist_wheel bash.exe -c 'pip install --upgrade "$(ls dist/web3-*-py3-none-any.whl)" --progress-bar off' - python -c "from web3.auto import w3" + python -c "from web3 import Web3" [testenv:py37-wheel-cli-windows] deps={[common-wheel-cli]deps} diff --git a/web3/auto/http.py b/web3/auto/http.py deleted file mode 100644 index d21014a75e..0000000000 --- a/web3/auto/http.py +++ /dev/null @@ -1,6 +0,0 @@ -from web3 import ( - HTTPProvider, - Web3, -) - -w3 = Web3(HTTPProvider()) diff --git a/web3/auto/infura/__init__.py b/web3/auto/infura/__init__.py deleted file mode 100644 index b04e8ba37d..0000000000 --- a/web3/auto/infura/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -from web3 import Web3 -from web3.providers.auto import ( - load_provider_from_uri, -) - -from .endpoints import ( - INFURA_MAINNET_DOMAIN, - build_http_headers, - build_infura_url, -) - -_headers = build_http_headers() -_infura_url = build_infura_url(INFURA_MAINNET_DOMAIN) - -w3 = Web3(load_provider_from_uri(_infura_url, _headers)) diff --git a/web3/auto/infura/endpoints.py b/web3/auto/infura/endpoints.py deleted file mode 100644 index 6e599e7467..0000000000 --- a/web3/auto/infura/endpoints.py +++ /dev/null @@ -1,62 +0,0 @@ -import os -from typing import ( - Dict, - Optional, - Tuple, -) - -from eth_typing import ( - URI, -) -from eth_utils import ( - ValidationError, -) - -from web3.exceptions import ( - InfuraProjectIdNotFound, -) - -INFURA_MAINNET_DOMAIN = "mainnet.infura.io" -INFURA_GOERLI_DOMAIN = "goerli.infura.io" -INFURA_RINKEBY_DOMAIN = "rinkeby.infura.io" -INFURA_SEPOLIA_DOMAIN = "sepolia.infura.io" - -WEBSOCKET_SCHEME = "wss" -HTTP_SCHEME = "https" - - -def load_project_id() -> str: - key = os.environ.get("WEB3_INFURA_PROJECT_ID", "") - if key == "": - raise InfuraProjectIdNotFound( - "No Infura Project ID found. Please ensure " - "that the environment variable WEB3_INFURA_PROJECT_ID is set." - ) - return key - - -def load_secret() -> str: - return os.environ.get("WEB3_INFURA_API_SECRET", "") - - -def build_http_headers() -> Optional[Dict[str, Tuple[str, str]]]: - secret = load_secret() - if secret: - headers = {"auth": ("", secret)} - return headers - return None - - -def build_infura_url(domain: str) -> URI: - scheme = os.environ.get("WEB3_INFURA_SCHEME", WEBSOCKET_SCHEME) - key = load_project_id() - secret = load_secret() - - if scheme == WEBSOCKET_SCHEME and secret != "": - return URI(f"{scheme}://:{secret}@{domain}/ws/v3/{key}") - elif scheme == WEBSOCKET_SCHEME and secret == "": - return URI(f"{scheme}://{domain}/ws/v3/{key}") - elif scheme == HTTP_SCHEME: - return URI(f"{scheme}://{domain}/v3/{key}") - else: - raise ValidationError(f"Cannot connect to Infura with scheme {scheme!r}") diff --git a/web3/auto/infura/goerli.py b/web3/auto/infura/goerli.py deleted file mode 100644 index cffc1250af..0000000000 --- a/web3/auto/infura/goerli.py +++ /dev/null @@ -1,19 +0,0 @@ -from web3 import Web3 -from web3.middleware import ( - geth_poa_middleware, -) -from web3.providers.auto import ( - load_provider_from_uri, -) - -from .endpoints import ( - INFURA_GOERLI_DOMAIN, - build_http_headers, - build_infura_url, -) - -_headers = build_http_headers() -_infura_url = build_infura_url(INFURA_GOERLI_DOMAIN) - -w3 = Web3(load_provider_from_uri(_infura_url, _headers)) -w3.middleware_onion.inject(geth_poa_middleware, layer=0) diff --git a/web3/auto/infura/mainnet.py b/web3/auto/infura/mainnet.py deleted file mode 100644 index b04e8ba37d..0000000000 --- a/web3/auto/infura/mainnet.py +++ /dev/null @@ -1,15 +0,0 @@ -from web3 import Web3 -from web3.providers.auto import ( - load_provider_from_uri, -) - -from .endpoints import ( - INFURA_MAINNET_DOMAIN, - build_http_headers, - build_infura_url, -) - -_headers = build_http_headers() -_infura_url = build_infura_url(INFURA_MAINNET_DOMAIN) - -w3 = Web3(load_provider_from_uri(_infura_url, _headers)) diff --git a/web3/auto/infura/rinkeby.py b/web3/auto/infura/rinkeby.py deleted file mode 100644 index 972df83dfb..0000000000 --- a/web3/auto/infura/rinkeby.py +++ /dev/null @@ -1,19 +0,0 @@ -from web3 import Web3 -from web3.middleware import ( - geth_poa_middleware, -) -from web3.providers.auto import ( - load_provider_from_uri, -) - -from .endpoints import ( - INFURA_RINKEBY_DOMAIN, - build_http_headers, - build_infura_url, -) - -_headers = build_http_headers() -_infura_url = build_infura_url(INFURA_RINKEBY_DOMAIN) - -w3 = Web3(load_provider_from_uri(_infura_url, _headers)) -w3.middleware_onion.inject(geth_poa_middleware, layer=0) diff --git a/web3/auto/infura/sepolia.py b/web3/auto/infura/sepolia.py deleted file mode 100644 index d7f128800c..0000000000 --- a/web3/auto/infura/sepolia.py +++ /dev/null @@ -1,15 +0,0 @@ -from web3 import Web3 -from web3.providers.auto import ( - load_provider_from_uri, -) - -from .endpoints import ( - INFURA_SEPOLIA_DOMAIN, - build_http_headers, - build_infura_url, -) - -_headers = build_http_headers() -_infura_url = build_infura_url(INFURA_SEPOLIA_DOMAIN) - -w3 = Web3(load_provider_from_uri(_infura_url, _headers)) diff --git a/web3/auto/ipc.py b/web3/auto/ipc.py deleted file mode 100644 index a5ca6abc3a..0000000000 --- a/web3/auto/ipc.py +++ /dev/null @@ -1,6 +0,0 @@ -from web3 import ( - IPCProvider, - Web3, -) - -w3 = Web3(IPCProvider()) diff --git a/web3/auto/websocket.py b/web3/auto/websocket.py deleted file mode 100644 index 39a4556fb7..0000000000 --- a/web3/auto/websocket.py +++ /dev/null @@ -1,6 +0,0 @@ -from web3 import ( - Web3, - WebsocketProvider, -) - -w3 = Web3(WebsocketProvider()) diff --git a/web3/pm.py b/web3/pm.py index 37001440af..b9bc27aca5 100644 --- a/web3/pm.py +++ b/web3/pm.py @@ -68,7 +68,8 @@ # is not automatically available on a web3 instance. To use the `PM` module, # please enable the package management API on an individual web3 instance. # -# >>> from web3.auto import w3 +# >>> from web3 import Web3, IPCProvider +# >>> w3 = Web3(IPCProvider(...)) # >>> w3.pm # AttributeError: The Package Management feature is disabled by default ... # >>> w3.enable_unstable_package_management_api()