It’s a new year and 2015 was a blast for me. I successfully ticked every item on my list for 2015 and I had even more that I hadn’t expected from the start of the year. In July, I got an email from PacktPub about reviewing a book on building GUIs with Python. The opportunity was influenced by the article I’d written on the subject and I’m glad I did. The book was completed and published in December and I got really excited to see that I’m a part of something that’ll impact the lives of people around the world. It is available on Amazon and PacktPub and I urge you to grab a copy as there’s so much to learn from it.
I had to let that out to share my excitement, and happy new years by the way. One of the things that impacted my productivity last year was using version managers which made working with various tools a lot easier.
python binary and 3.5 with
python3. This seemed fine to me for so long till I started installing wrong packages with pip. I’d use pip for python2 when I really need python3. Remembering to type pip3 all the time was so not fun. I don’t use python on the web and I think it would have been a bigger nightmare for me if I kept on using it that way with the web.
The solution for the python2, python3 issue as well as package management in python was to use virtualenv which simply just needs to be activated for each version we want. Having it this way there’s no limit to the python versions that we can have including 2.5, 2.6, 2.7, 3.3, 3.5.
Ruby has more minor releases and when building rails applications or other ruby applications, we rely on the version for the operations and gems that we use. Usually gems are stored in
~/.gem directory but we could manage them easily per version with rvm, rbenv, or chruby. I use and prefer rbenv.
Why you should use them
In a recent post I discussed the 5s on productive maintenance and while explaining seiton which means tidiness I quoted
A place for everything and everything in its place
- Benjamin Franklin
The primary goal of virtual environments are to be able to create any environment for different projects with ease and the ultimate goal is tidiness. This is the same with version managers
Setting up NVM, Rbenv, and VirtualEnv
To set up nvm you need to have a version of node and npm running on the system to install it globally after which all npm packages will be installed on nvm versions. For a global install of nvm
npm install -g npm
To view versions of node or iojs available for install:
versions you have installed
and more info can be found with
nvm help. For each version activated, the $PATH is updated to use binaries from within that version. I’ve heard nvm isn’t available for Windows users but I don’t know how true that is.
For Virtualenv with python you can follow this guide to install, enter your virtual environment folder and use:
and to deactivate when you are in the environment the
deactivate command is always available.
If you aren’t already using them then you should give them a try to improve your productivity in 2016.