A Python IDE in VIM

One of the threads in my dive into propellerhead territory is coding. I’d like to be able to complete the challenges in Project Euler in a few languages.

The question you run into is what IDE and OS to use.

For the purposes of an Edx course I took in Python last year, I just downloaded Anaconda and Spyder. It was their recommendation, and it worked just fine, but I felt a desire to go a bit deeper.

You see, I’m the kind of guy who drives a manual transmission. I’m not super concerned with staying on the absolute bleeding edge of technology, as it’s a space (imho) often defined by overzealous marketers rather than engineers. You can spend a great deal of time (your most precious asset) becoming fluent in a particular toolset, only to encounter inexplicable malfunctions and unresponsive vendors. So you migrate to the new whiz-bang tool with slick marketing material, only to begin the cycle anew. This is not to say I don’t believe in the sincerity and dedication of the Anaconda/Spyder devs, I simply would like to remove as many layers of abstraction between myself and the code as possible.

I feel my time would be much better spent becoming fluent in a tool that has survived the test of time even if it perhaps lacks a few fancy features. I also don’t care for tools that try to be all things to all people.

Therefore, my choice in the (voluminous) IDE wars is to just use VIM. It’s focused (unlike the general-purpose emacs), it’s been around for nearly thirty years, it comes already installed on ‘nix systems, and even represents an opportunity to become fluent in regex.

Now, regarding OS; Windows was out, as I know myself well enough to know I should remove the opportunity to rely on the GUI gVim provides. I don’t own a Mac, nor am I enthused about becoming locked into that pricey ecosystem. So that leaves Linux. I settled on a PopOS iso spun up in VirtualBox. As an Ubuntu derivative, it’s got the backing of dedicated developers, is widely deployed as desktops and servers, and System76 seems to be on a good trajectory.

So, settled; Python VIM IDE in PopOS.

I spent most of the day yesterday savoring the vimtutor walkthrough, while generating multiple post-its.

Today, I’m going to try and get a barebones Python IDE stood up.

######
First, we did an update
sudo apt-get update
sudo apt-get -y upgrade
python3 -V
Python 3.6.9

Dope. Working. Following the tutorial from DigitalOcean here:
pip is evidently a package manager for python for sorting out dependencies and whatnot, so we’ll follow DO’s direction:
sudo apt-get install -y python3-pip
Next, DO recommends a few more for setting up a dev enviroment:
sudo apt-get install build-essential libssl-dev libffi-dev python-dev
So let’s see what that means….
Build-essential is evidently a collection of compilers and other tools for development.
libssl-dev: for doing stuff with with SSL (Secure Sockets Layer)
libffi-dev: “foreign function interface runtime”….dunno
python-dev: well….Python.
Next, DO says to set up virtual environments, and to do that you need “venv”
sudo apt-get install -y python3-venv
Now, while in the file directory I want to create an environment, I tell venv to set one up named “pyproject”
python3 -m venv pyproject
This created a subfolder named “pyproject” with a few things:
bin include lib lib64 pyvenv.cfg share
Interesting. It’s like it set up an itty bitty linux computer. I hadn’t ever though about it, but this makes perfect sense; you would totally want a miniature, pared-down computing environment to limit noise and side effects. Rockin’.
Now we fire that thing up with
source my_env/bin/activate
Dopesauce.
Seems like from here, I’ll just need to fiddle with my .vimrc file.
I’ll be shooting for three “panes” to start: file tree, main editor, and a python prompt for testing and outputs.
Many thanks to Digital Ocean for that spot-on tutorial.





Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: