ApeWorX / ape-vyper

Vyper compiler plugin for the Ape Framework, using VVM
https://www.apeworx.io/
Apache License 2.0
23 stars 9 forks source link

Compilation failure when importing own interface #121

Open xrchz opened 3 days ago

xrchz commented 3 days ago

Environment information

$ ape --version
0.8.5

$ ape plugins list
Installed Plugins
  etherscan    0.8.0
  foundry      0.8.0
  vyper        0.8.1

What went wrong?

ape compile

produces

Traceback (most recent call last):
  File "/home/ramana/.local/pipx/venvs/eth-ape/lib/python3.12/site-packages/ape_vyper/compiler.py", line 386, in _get_imports
    sub_imports = self._get_imports((full_path,), project=project, handled=handled)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ramana/.local/pipx/venvs/eth-ape/lib/python3.12/site-packages/ape_vyper/compiler.py", line 386, in _get_imports
    sub_imports = self._get_imports((full_path,), project=project, handled=handled)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ramana/.local/pipx/venvs/eth-ape/lib/python3.12/site-packages/ape_vyper/compiler.py", line 386, in _get_imports
    sub_imports = self._get_imports((full_path,), project=project, handled=handled)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  [Previous line repeated 993 more times]
  File "/home/ramana/.local/pipx/venvs/eth-ape/lib/python3.12/site-packages/ape_vyper/compiler.py", line 298, in _get_imports
    dependencies = self.get_dependencies(project=pm)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ramana/.local/pipx/venvs/eth-ape/lib/python3.12/site-packages/ape_vyper/compiler.py", line 488, in get_dependencies
    config = self.get_config(project=pm)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ramana/.local/pipx/venvs/eth-ape/lib/python3.12/site-packages/ape/api/compiler.py", line 65, in get_config
    return config.model_validate(data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ramana/.local/pipx/venvs/eth-ape/lib/python3.12/site-packages/pydantic/main.py", line 551, in model_validate
    return cls.__pydantic_validator__.validate_python(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.ValidationError: 1 validation error for VyperConfig
  Value error, error getting value for field "version" from source "DotEnvSettingsSource" [type=value_error, input_value={'version': None, 'evm_ve... 'import_remapping': []}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.7/v/value_error

where contracts/test.vy contains

#pragma version ~=0.4.0

import test as TestInterface

@deploy
def __init__():
  pass
linear[bot] commented 3 days ago

APE-1778 Compilation failure when importing own interface

dtdang commented 2 days ago

Issue should be fixed with #122 and in the newest release of 0.8.2. Can you please check and comment if you're still running into any issues?

xrchz commented 2 days ago

I believe it is fixed, although the example code I gave above does not work still: I don't know actually what the correct syntax is for importing one's own interface.