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: update vyper path resolution logic #127

Merged
merged 2 commits into from
May 23, 2024
Merged

Conversation

klkvr
Copy link
Member

@klkvr klkvr commented May 22, 2024

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.

Also added more tests for path resolution

@klkvr klkvr requested review from DaniPopes and Evalir as code owners May 22, 2024 23:59
@klkvr klkvr requested a review from mattsse May 23, 2024 00:04
@mattsse mattsse merged commit 49010aa into main May 23, 2024
14 checks passed
@DaniPopes DaniPopes deleted the klkvr/fix-vyper-imports branch May 23, 2024 09:37
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