Microsoft… The technological locomotive of our time. It’s no secret that they’re cool, and that they’re absorbing more and more…
of everything. Fortunately, lately they have only been encouraging me with their potential. And after the presentation by Satya Nadella, where he told the world that Windows is no longer the main product of the company, as they set their course on the implementation of their APIs… Everywhere…
They aren’t skimping for software developers either. C#, Azure, Visual Studio… But right now we’ll talk about Python, since they warmed up a spot for it as well.
With a Windows update it became possibly to use WSL (Windows Subsystem for Linux). Not too long ago WSL2 appeared with VERY cool improvements. WSL2 uses the latest and newest virtualization technology to launch a Linux kernel inside a simplified service virtual machine. That means that attributes like isolation and slow downs are now absent.
Sooner or later, developers decide on what environment to develop in, and that is a very important moment. A fairly important role is played by the operating system, where the code is run. Since the issue is not just about the compiler and interpreter, but also the services that work in a close and friendly circle. And the OS answers for the correctness of the work of these fighting units. The conversation is going to be Windows and Linux. And it’s not going to be about IT’S better, or IT’S worse, since the choice of editor or system is no more than a matter of taste these days. ALL of them these days provide a mass of tools for implementing something. The reason that I prefer Linux is flexibility. Unfortunately, not all additions to Python work on the brainchild of Microsoft. For example, celery/redis, git, work with local web servers, docker…. I think those who worked with at least those technologies met with “some difficulties”. So I think that for any Python programmer, working with Linux (MacOS) is necessary, to put it mildly…
And so, you set a flag in Windows components
and downloaded your favorite distribution from the official store.
After some simple user creation manipulations, you get access to the Linux terminal. Nothing unusual, if you don’t take into account, that the file system of both operating systems isn’t isolated from one another, making it possible to manipulate the Windows file system from inside Linux. All logical partitions are available at the mount point.
Now we proceed directly to the development. When choosing an editor, I would stay with Visual Studio Code. It includes a lot of tools, including a debugger, which makes it a full-fledged IDE. The creation of a virtual environment on different systems is different. For example, after a applying the command
python -m venv venv
on windows it creates a .bat activator and a python.exe file, while Linux copies the Python binary system. VS Code is fairly flexibly set up with the help of extensions.
allows you to quickly jump to add-ons. It necessary to enter WSL into search and download the first extension from the list.
For convenient development it’s worth adding Python, Git History, Django… And then whatever your heart desires.
After that, boldly restart the editor, after which you can open your project
File -> Open Folder
After loading, pay attention to the lower left corner of the screen.
This will allow you to re-open the folder using WSL
The difference being, that VS Code in this case switches to the Linux kernel, which happens to be the bottom layer of the Windows kernel. This will allow you to use the desired interpreter, as well as the terminal directly from the editor.
In the same way, it’s possible to use the Windows Terminal. This will greatly increase the effectiveness of your work, since WSL is also integrated into it.
All in all, this ensures comfortable work in Windows with the capabilities of Linux. And also the predominant factor being that, the work environment has access to the main system, but is isolated from it by the kernel and the base file system.