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

fix: Contract name underscoring #237

Conversation

pbukva
Copy link

@pbukva pbukva commented Mar 19, 2024

No description provided.


def __post_init__(self):
self.variable_name = self.name.replace("-", "_")
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is one of the most relevant changes.

@@ -30,7 +30,7 @@ def parse_contract(path: str, name: str) -> Contract:
cargo_contents = toml.load(cargo_file)

# extract the contract name and replace hyphens with underscores
contract_name = cargo_contents['package']['name'].replace("-", "_")
contract_name = cargo_contents['package']['name']
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is another most relevant change.

@@ -38,7 +38,7 @@ def load_shell_globals(cfg: Config, selected_profile: Profile) -> dict:
shell_globals = {}
contract_instances = {}

contracts = {contract.name: contract for contract in detect_contracts(PROJECT_PATH)}
contracts = {contract.variable_name: contract for contract in detect_contracts(PROJECT_PATH)}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the most relevant change.

@@ -24,6 +24,7 @@ jsonschema = "^4.15.0"
graphlib-backport = "^1.0.3"
jwskate = ">=0.4.1,<0.6.0"
makefun = "^1.15.0"
urllib3 = "==1.26.16"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was getting Docker error with newer version of urllib3. We shouldn't restrict it to only one exact version and we need to find a range of versions.

Traceback (most recent call last):
  File "/home/jiri/.local/share/virtualenvs/contract-fetch-compute-credit-cw20-gQdo6jWW/lib/python3.10/site-packages/docker/api/client.py", line 214, in _retrieve_server_version
    return self.version(api_version=False)["ApiVersion"]
  File "/home/jiri/.local/share/virtualenvs/contract-fetch-compute-credit-cw20-gQdo6jWW/lib/python3.10/site-packages/docker/api/daemon.py", line 181, in version
    return self._result(self._get(url), json=True)
  File "/home/jiri/.local/share/virtualenvs/contract-fetch-compute-credit-cw20-gQdo6jWW/lib/python3.10/site-packages/docker/utils/decorators.py", line 46, in inner
    return f(self, *args, **kwargs)
  File "/home/jiri/.local/share/virtualenvs/contract-fetch-compute-credit-cw20-gQdo6jWW/lib/python3.10/site-packages/docker/api/client.py", line 237, in _get
    return self.get(url, **self._set_request_timeout(kwargs))
  File "/home/jiri/.local/share/virtualenvs/contract-fetch-compute-credit-cw20-gQdo6jWW/lib/python3.10/site-packages/requests/sessions.py", line 602, in get
    return self.request("GET", url, **kwargs)
  File "/home/jiri/.local/share/virtualenvs/contract-fetch-compute-credit-cw20-gQdo6jWW/lib/python3.10/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/jiri/.local/share/virtualenvs/contract-fetch-compute-credit-cw20-gQdo6jWW/lib/python3.10/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
  File "/home/jiri/.local/share/virtualenvs/contract-fetch-compute-credit-cw20-gQdo6jWW/lib/python3.10/site-packages/requests/adapters.py", line 486, in send
    resp = conn.urlopen(
  File "/home/jiri/.local/share/virtualenvs/contract-fetch-compute-credit-cw20-gQdo6jWW/lib/python3.10/site-packages/urllib3/connectionpool.py", line 793, in urlopen
    response = self._make_request(
  File "/home/jiri/.local/share/virtualenvs/contract-fetch-compute-credit-cw20-gQdo6jWW/lib/python3.10/site-packages/urllib3/connectionpool.py", line 496, in _make_request
    conn.request(
TypeError: HTTPConnection.request() got an unexpected keyword argument 'chunked'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/jiri/.local/share/virtualenvs/contract-fetch-compute-credit-cw20-gQdo6jWW/bin/jenesis", line 5, in <module>
    from jenesis.cli import main
  File "/home/jiri/.local/share/virtualenvs/contract-fetch-compute-credit-cw20-gQdo6jWW/src/jenesis/src/jenesis/cli.py", line 6, in <module>
    from jenesis.cmd.compile import add_compile_command
  File "/home/jiri/.local/share/virtualenvs/contract-fetch-compute-credit-cw20-gQdo6jWW/src/jenesis/src/jenesis/cmd/compile.py", line 13, in <module>
    from jenesis.tasks.image import image_exists, pull_image
  File "/home/jiri/.local/share/virtualenvs/contract-fetch-compute-credit-cw20-gQdo6jWW/src/jenesis/src/jenesis/tasks/image.py", line 13, in <module>
    image_collection = ImageCollection(from_env())
  File "/home/jiri/.local/share/virtualenvs/contract-fetch-compute-credit-cw20-gQdo6jWW/lib/python3.10/site-packages/docker/client.py", line 96, in from_env
    return cls(
  File "/home/jiri/.local/share/virtualenvs/contract-fetch-compute-credit-cw20-gQdo6jWW/lib/python3.10/site-packages/docker/client.py", line 45, in __init__
    self.api = APIClient(*args, **kwargs)
  File "/home/jiri/.local/share/virtualenvs/contract-fetch-compute-credit-cw20-gQdo6jWW/lib/python3.10/site-packages/docker/api/client.py", line 197, in __init__
    self._version = self._retrieve_server_version()
  File "/home/jiri/.local/share/virtualenvs/contract-fetch-compute-credit-cw20-gQdo6jWW/lib/python3.10/site-packages/docker/api/client.py", line 221, in _retrieve_server_version
    raise DockerException(
docker.errors.DockerException: Error while fetching server API version: HTTPConnection.request() got an unexpected keyword argument 'chunked'

@pbukva pbukva changed the base branch from main to contract_name_underscoring March 22, 2024 17:05
Copy link
Contributor

@MissingNO57 MissingNO57 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pbukva pbukva merged commit 6339300 into fetchai:contract_name_underscoring Mar 22, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants