Set Up Your IDE¶
Development is better with an IDE. For python, most of our team uses VSCode. Here’s how to install VSCode and set it up to work well with TCode.
Prerequisites¶
- We’re assuming that you’re coming from the previous tutorial and are assuming the following:
You have a compatible python version installed (3.11+)
You have
uvinstalled and available on your command lineYou have a
uvenvironment withtcode-apiinstalled
If any of this looks unfamiliar, back you go to the previous tutorial.
Note
We recommend using a virtual environment manager like uv to manage your python.
If you prefer to use venv or conda, you can still follow along, but some
commands will be different.
Install VSCode¶
Follow the instructions on their website for your computer’s operating system:
Open Project in VSCode¶
In your VSCode window’s top menu bar, select “File” > “Open…”, then select your project folder.
If you see the pop-up window below, select “Save” and save the workspace as a file. Now, we can easily re-open our workspace setup.
You should now have an “Explorer” window on the left-hand side of your screen with the files we
saw in the previous tutorial using ls.
Select Python Interpreter¶
Now we need to tell VSCode to use the python environment that we set up using uv.
In the VSCode search bar [TODO IMAGE], type the following:
> Python: Select Interpreter.
VSCode will then prompt you with a list of the python versions that you have available. If your
uvproject is open in VSCode, one of the entries should have a filepath that reads./.venv/bin/python. This is the python interpreter that uses the virtual environment (or “venv”) set up byuv. In my drop-down, it comes “Recommended” (fancy!). Select that one.
Install VSCode Python Extension¶
Finally, in order to get tools to make our Python dev work easier (typehints, docstrings, etc), we need to install VSCode’s handy-dandy python extension.
Navigate to the following link and click the “Install” button, then follow the prompts to open the installation page in VSCode itself. Clicking “Install” there gets you the packages.
https://marketplace.visualstudio.com/items?itemName=ms-python.python
Write Your First Script¶
Your environment should now be set up!