Perspective Unspoken

My perspective on Git, Docker, Python, Django, PHP and other stuff

Setting up MacBook for Python Development

It takes quite a bit to get my machine from zero to the point it needs to be to be ready for development. I typically have quite a few bits and pieces I like to have to make dev a cozy and inviting environment. This is the list so far:

  • Terminal – to get a good terminal experience I use iTerm, then change my shell to ZSH and I also use Oh-My-Zsh to configure ZSH. Homebrew is used to install most of the packages.
  • Editors – I use Sublime Text 3.
  • Virtualization – I use a combination of different software under this umbrella. I use Docker, Vagrant and Virtual Box.
  • Python – I inevitably end up using different python versions for local development, python notebooks and otherwise. I use pyenv to manage different Python installations.


Let’s talk about setting up terminal and getting that experience going.


HomeBrew is an open source package management system that’s used to install third party packages. Installing HomeBrew is done with a script. You need to enter your password once.

ZSH + Oh-my-zsh
ZSH is a wicked shell that allows lots of customizations. It’s highly acclaimed because it has like 200+ plugins and lots more themes. It’s not the easiest to configure manually, so typically you would use a framework (Oh-my-zsh or Presto) to configure it. I like Oh-my-zsh better and the community seems to as well.
There are plugins to show the current time on Shell, show your current Git branch, and autocompletions for different command line apps. And it’s the useful kind of autocomplete… the Docker plugin for example can show container IDs. You can even open JIRA issues from the command line.
Ok, so how do we install it?

Then you want to activate ZSH by changing your shell to ZSH.

The .zshrc file in your home directory will hold the configuration for ZSH. There are loads of themes for ZSH as I mentioned before. Oh-my-zsh allows you to configure the list of plugins and ZSH theme simply by making changes to .zshrc. See below.

Any changes made to your .zshrc file, be sure to source it by doing source .zshrc .

iTerm2 is a much better terminal than the default that Mac provides. It’s also highly configurable.
The installer can be downloaded here.
I don’t do much changes here except to fix an issue where Left Option doesn’t allow me to use certain shortcuts like Option + F (move forward one word) or Option + Backspace (delete a word). I’m an Emacs wannabe so… that matters to me.
Under Profiles > Default > Keys >  Left option key acts as  I choose +Esc to fix that.


Sublime Text
I’m a big fan. Sublime is a solid editor and it’s a pleasure to use. It’s fast, responsive and has a healthy set of plugins available for it.
Grab the dmg here.
Then, it’s on to configurations and plugins to make it mine. I install the following plugins via Package Control.
  • A file icon – it has a beautiful set of icons for most file types. Simple and easy.
  • AdvancedNewFile – a nice plugin that allows easier creation of files and folders. Without touching the mouse you can invoke the shortcut to create a new file and it will create any missing folders in the path.
  • All Autocomplete – Sublime’s autocomplete out of the box only autocompletes for symbols in the current file. This allows Sublime to atleast consider all the open files.
  • Anaconda – most people will recognize this as the closest thing to being a Python IDE for Sublime. It uses the PyV8 engine to provide real autocompletions for Python based on where the cursor is. It also has support for Vagrant and Docker environments.
  • Djaniero – I use Django alot and this package provides loads of autocompletions for Django. From template variables to models and fields. Lots of shortcuts to get you moving quickly here.
  • DocBlockr – a nice utility package for Javascript code blocks. It probably works for Java too? It will look at the parameters in your function and generate those once you start writing your code block. Helps to reduce the time documenting stuff, especially since we love documentation.
  • DocBlockr_Python – same idea for Python. This is a new one I’m trying out.
  • Emacs Pro Essentials – the most essential package for a Emacs wanna-be or Emacs pro’s. It implements keybindings for Emacs. I can’t live without it actually. Totally lost without it.
  • Emmet – the de-facto package for HTML and CSS completion. It’s really good at helping to get HTML structure out quickly. Too much can be said about this one.
  • GitGutter – this plugin shows removals and additions of lines in your code in the Sublime Gutter. You can hover over icons to see what changes you’ve made. You can even revert your changes right there.
  • Materialize – absolutely love these themes from Materialize.
  • requirementstxt – this provides syntax highlighting for requirements.txt files. It also allows you to pin package package versions and does normalization of the names.
  • Sublime Linter – I install this linter package, this is apparently more feature packed than the linting Ananconda provides. I also install the following specific linters for Python (Pep8, Flake8, JSHint). Note that for this to work, we need to install pep8 and flake8 independently.

Apart from installing packages, I make a few changes to my package and settings. I maintain a repo with my changes. This post discusses how to save your changes.

Just showing the major changes I made to settings and keybindings.

Here are my settings:

And I made a few changes to my keybindings because some of the packages override some keys in Emacs Pro.


I also use the Source Code Pro font for development.



Virtual Box

Vagrant uses VirtualBox to run their VM’s. I still have some projects that use Vagrant, and I use it to install whatever Windows boxes I need.

VirtualBox can be downloaded here.


Before there was Docker, there was Vagrant. You can use Vagrant to introduce consistency into your development environment. Make sure when a new guy joins the team they can run one command to have the entire infrastructure setup just like the other developers. I still use it for an older project. This can be downloaded here.


Docker is widely used for consistency in development environments and it’s used widely in production. Very much annoyed that now you have to login to download Docker. Either way, this can be downloaded here.



Mac.. for now comes with Python 2.7.1. I mostly use Docker or Vagrant for every project I do that involves Python, there are few exceptions. Occasionally I do a Python project where I use a virtualenv, sometimes I need space to test a few things out, and otherwise still… I use Python notebooks alot. I needed a way therefore to maintain different versions of Python, not just different virtual environments.

pyenv does exactly that.  It modifies the $PATH variable with the current version of Python. You can setup a global version and do different versions that are local to a directory (via a file .python-version file), or using a PYENV_VERSION  environmental variable. So lots of ways to control your current Python. You can also have multiple versions available for using something like Tox.

Do the basic installation…

Then enable auto completions and shimming by adding the following to the end of your .zshrc file.

Extra Python Versions

Now we can install any additional versions of Python we want to using pyenv. See below…

System Python

One of the great things about pyenv is that it doesn’t trouble the system version of Python. It also allows you to switch to that version. Which is great. The base install is missing pip though, so that we need to fix. And also, standard, I install flake8 and pycodestyle (previously pep8) whenever I install a Python version.

We need to use sudo for these.



There’s no way I could have done this post without some valuable resources online:

brewIDEPythonsublime textzsh

jaywhy13 • June 24, 2018

Previous Post

Next Post