Skip to main content
Look at the import requests line in your __main__.py file. In your editor, it probably appears with some yellow squiggle underscores, indicating that you won’t have features like auto-complete, jump-to-definition, docs-on-hover, and so on. Or it might be functional, but leaking through to somewhere else in the environment that doesn’t have the same version. bad yellow Let’s fix that. Python tooling expects a Virtual Environment (”virtualenv”) which is a specially-constructed folder with a linked Python interpreter, and packages installed in a site-packages subfolder. Since the repository gets the py_binary from aspect_rules_py, it includes a venv target which produces this virtual environment. Run bazel query --output=label_kind app:all to see what targets are available.
app:app_bin.venv is an option, so run that:
Once this has run, the editor should see that a virtualenv now exists in the source folder, and offer to use it to resolve dependencies. Here’s Visual Studio Code with the standard Python extension, for example: venv found Once you activate this virtualenv, the yellow squiggles should disappear, and you should be able to navigate through the import statement to the requests package. intellisense