When working with tech and dealing with complex environments it helps to be organised and structured so its easy to share and find projects.
Since I often have the need to work on multiple Python projects I decided to have virtual environments and manage them with Make.
However since I use VSCode with linting, I often need to download packages so that I'm able to use black, boto3 etc.
You could create one large venv for VSCode to use as the default python interpreter but I find it better to keep envs smaller and not risk of packages colliding with each other.
Much of the makefile has been inspired from this repo so don't forget to say your thanks to the author.
This assumes you have the following installed:
- vscode
- pyenv
- pyenv-virtualenv
The more I think about it I often find myself working around APIs, weather its Google Workspaces or checking the local public transport public data etc.
With this in mind I've added a basic example in the main.py with API query and response.
I also use and recommend Postman since it allows me to check that I understand the API before implementing it in code.
As much as I don't like using one for many there are cases like with the extension AWS boto3 which needs to be configured on a more generalised level.
-
Install the extension Python Environment Manager.
-
Create a global vscode env.
pyenv virtualenv PYTHON_VERSION --force vscode-global-PYTHON_VERSION
-
Select it for each workspace/project so they default to it; "Python: Select Interpreter" and then "select at workspace level" at the bottom.
-
Install AWS boto3 extension.
-
"AWS boto3: Quick Start", by now it'll promt the vscode-global env.
-
"Install" and finally select the desired AWS services.
Messages echoed out on the terminal are using tput coloring in order to make sure the information is clearly presented. For more info on how to use it, please visit this site.