diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index af6e06203..e2d26c20f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -45,7 +45,7 @@ jobs: - name: Install Mac OS specific dependencies if: ${{ matrix.os == 'macos-latest' }} run: | - brew install autoconf automake libtool + brew install autoconf automake libtool pkg-config - name: Install dependencies working-directory: ${{ github.workspace }} # vyper is grounded here until it declares explicit support for Python 3.11 diff --git a/READMEs/install.md b/READMEs/install.md index 93ec3edbd..3c6a957e9 100644 --- a/READMEs/install.md +++ b/READMEs/install.md @@ -38,7 +38,7 @@ pip install ocean-lib Issue: M1 * `coincurve` or `cryptography` - If you have an Apple M1 processor, `coincurve` and `cryptography` installation may fail due missing packages, which come pre-packaged in other operating systems. -- Workaround: ensure you have `autoconf`, `automake` and `libtool` installed, e.g. using Homebrew or MacPorts. +- Workaround: ensure you have `autoconf`, `automake`, `libtool` and `pkg-config` installed, e.g. using Homebrew or MacPorts. Issue: MacOS "Unsupported Architecture" - If you run MacOS, you may encounter an "Unsupported Architecture" issue. diff --git a/ocean_lib/example_config.py b/ocean_lib/example_config.py index 734af2685..726695954 100644 --- a/ocean_lib/example_config.py +++ b/ocean_lib/example_config.py @@ -8,8 +8,7 @@ import os from pathlib import Path -from jsonsempai import magic # noqa: F401 -from addresses import address as contract_addresses # noqa: F401 +import addresses logging.basicConfig(level=logging.INFO) @@ -64,7 +63,11 @@ def get_config_dict(network_name=None) -> dict: else: # `contract_addresses` comes from "ocean-contracts" pypi library, # a JSON blob holding addresses of contract deployments, per network - address_file = Path(contract_addresses.__file__).expanduser().resolve() + address_file = ( + Path(os.path.join(addresses.__file__, "..", "address.json")) + .expanduser() + .resolve() + ) assert os.path.exists(address_file), f"Could not find address_file={address_file}." config_dict["ADDRESS_FILE"] = address_file diff --git a/ocean_lib/web3_internal/contract_utils.py b/ocean_lib/web3_internal/contract_utils.py index 8d3de0088..fa6f0a5b0 100644 --- a/ocean_lib/web3_internal/contract_utils.py +++ b/ocean_lib/web3_internal/contract_utils.py @@ -2,10 +2,10 @@ # Copyright 2022 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # -import importlib import json import logging import os +from pathlib import Path from typing import Any, Dict, Optional from brownie import Contract @@ -21,11 +21,15 @@ @enforce_types def get_contract_definition(contract_name: str) -> Dict[str, Any]: """Returns the abi JSON for a contract name.""" - try: - return importlib.import_module("artifacts." + contract_name).__dict__ - except ModuleNotFoundError: + path = os.path.join(artifacts.__file__, "..", f"{contract_name}.json") + path = Path(path).expanduser().resolve() + + if not path.exists(): raise TypeError("Contract name does not exist in artifacts.") + with open(path) as f: + return json.load(f) + @enforce_types def load_contract(contract_name: str, address: Optional[str]) -> Contract: diff --git a/setup.py b/setup.py index b5276a733..ecb58e872 100644 --- a/setup.py +++ b/setup.py @@ -23,7 +23,6 @@ "requests>=2.21.0", "pytz", # used minimally and unlikely to change, common dependency "enforce-typing==1.0.0.post1", - "json-sempai==0.4.0", "eciespy==0.3.11", "eth-brownie==1.19.3", "yarl==1.8.1",