Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove json sempai. #1334

Merged
merged 2 commits into from
Feb 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion READMEs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
9 changes: 6 additions & 3 deletions ocean_lib/example_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand Down
12 changes: 8 additions & 4 deletions ocean_lib/web3_internal/contract_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down