Current Vyper path resolution does not correctly handle relative paths (from . import X, from .. import X).
This PR fixes this and changes parser to parse into VyperImport which tracks final_part (X at from ... import X expression).
Currently vyper allows doing imports like from Contract import Contract which is equivalent to import Contract as Contract and only requires Contract.vy to be present. However, such format is only supported when invoking vyper from command like, and for standard JSON input it does not work, which is why we can't compile snekmate right away without small import fixes.
I believe in the future Vyper versions that will be fixed and thus VyperImport tracks final_part additionaly.
Current Vyper path resolution does not correctly handle relative paths (
from . import X
,from .. import X
).This PR fixes this and changes parser to parse into
VyperImport
which tracksfinal_part
(X atfrom ... import X
expression).Currently vyper allows doing imports like
from Contract import Contract
which is equivalent toimport Contract as Contract
and only requiresContract.vy
to be present. However, such format is only supported when invokingvyper
from command like, and for standard JSON input it does not work, which is why we can't compile snekmate right away without small import fixes.I believe in the future Vyper versions that will be fixed and thus
VyperImport
tracksfinal_part
additionaly.Also added more tests for path resolution