How to Access Future Python Versions Like 3.12 Before the Masses | by Bex T. | Jun, 2023


Step 4: Linking VSCode to the container

You didn’t think we would come all the way here to run a bunch of expressions in the stupid shell, did you?

Oh no. We are going to link the container with Python 3.12 to VSCode and write up some scripts to test the new version for real.

So, in any directory on your machine, open VSCode (I hope you have it configured for Python and data science).

$ cd some_dir
$ code . # Launches VSCode

Then, install the Remote Development extension:

image.png
Image by me

Reload VSCode. Then, jump over to your Docker Desktop and click on Containers menu:

image.png
Image by me

You will see a list of running containers. My version of Python 3.12 is called adoring_dirac. Right now, it isn’t running because I exited out of the Python shell in my CLI. To run it, I press the play button which launches the container.

Now, go to VSCode again and open the command palette (Ctrl + Shift + P) and search for “Attach to running containers”. Here is a helpful GIF:

As soon as you click on a running container instance with Python 3.12 as the base image, a new VSCode window will pop up that is directly linked to the container.

Remember, this container is isolated from your operating system, so any files you create or edit or any terminal sessions you launch will be isolated as well and won’t be visible.

So, this is your green light to try anything inside the container to test Python 3.12. Apart from creating scripts,

you can also install other software like Conda, Git, DVC, and pretty much treat the container like you have a brand new, empty computer with only Python 3.12 installed.



Source link

Leave a Comment