Use Poetry for Python dependency management with Visual Studio Code
Python has been the most popular programming language for years, but despite this dependency management has been a weak spot for a long time as well. Pipenv was (and is) a good attempt to fix this, but in late 2019 Poetry 1.0 was released and it is very good. Seriously, give it a try.
There is a small problem though: Poetry uses
venv for installing dependencies: when you add dependencies to a Poetry Python project, a new virtual environment is created where the dependencies are installed. However, Visual Studio Code doesn't automatically detect
venv virtual environments which results in linting errors where the editor complains that dependencies cannot be resolved.
There is a fix though: in your
settings.json you can specify the path where your virtual environments are stored. You can specify it like this:
You can also use the GUI to edit this setting:
Now you can select the correct Python interpreter that is located in your virtual environment for your Poetry project. You can open the dialog to do this in two ways:
- On the bottom left corner, click on the Python version used
CTRL + Shift + Pand search for "Python: select interpreter"
In this dialog the virtual environments stored in the path you specified in the settings should now appear.
Self-hosting enthusiasts often run their own services such as NextCloud, Jellyfin, Home Assistant, Pihole and many others. When you start self-hosting you quickly accumulate a lot of services. Soon you will find out that accessing services by an IP address and port number is not very user-friendly, and if this sounds familiar, you've probably heard about something called a reverse proxy: A reverse proxy is a service that sits in fronts of web services and handles all traffic towards those web s
Thu May 28 2020
As you might know, starting from Ubuntu 20.04 LTS, Python 2 is no longer a dependency and not installed by default anymore. However, there are still some caveats.
Thu Apr 30 2020