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

Extension does not check python environment for modules #39

Open
PatrickAlphaC opened this issue Aug 1, 2024 · 2 comments
Open

Extension does not check python environment for modules #39

PatrickAlphaC opened this issue Aug 1, 2024 · 2 comments

Comments

@PatrickAlphaC
Copy link

  1. Install snekmate, and add to a contract
pip install snekmate

my_contract.vy

from snekmate.tokens import erc20
  1. Compile with vyper command
vyper my_contract.vy

(it will compile) but the extension will not find snekmate
Screenshot 2024-08-01 at 6 38 50 PM

@PatrickAlphaC
Copy link
Author

Ah, I needed to update the vyper executable in the settings.json. I think it would be good for it to showhow do like which vyper and have that be the path? I'm not sure how it's picking up the vyper executable right now.

I was able to fix this by adding a .vscode/settings.json like so:

{
    "vyper.command": "/my_virtual_env_path/.venv/bin/vyper",
}

@trocher
Copy link
Collaborator

trocher commented Aug 19, 2024

The extension simply calls vyper -f bytecode,..., so the problematic is rather which virtual env does VSCode uses for running extensions.

I haven't tried with venv but with pyenv, if there is a .python-version in your workspace specifying some virtual env, VSCode will use it for running extensions. Hence if you have installed vyper and snekmate in that virtual env, the extension will work fine without having to modify vyper.command since:

❯ which vyper
/Users/bob/.pyenv/shims/vyper

Example usage in the directory of the project:

pyenv virtualenv 3.11 temp1
pyenv local temp1
pip install vyper
pip install snekmate

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

No branches or pull requests

2 participants