Ruby Kernel for Jupyter Notebook

Jupyter notebooks are nice way to keep your code, diagrams, documentation together, mostly in a single file, which is also executable i.e. can run/interpret your code in it, and also have the result saved as it is. Here’s blogpost for installing Jupyter Notebook – today I’ll share how to use Ruby kernel with Jupyter Notebook i.e. executing Ruby code inside the notebooks.
To create notebooks that can execute Ruby code we need to integrate Ruby kernel, the 3 simple steps are:
  • Install Jupyter
  • Install Ruby
  • Install iruby

Continue reading “Ruby Kernel for Jupyter Notebook”

conda VS pip

I decided to write this post, as I myself when for the first time tried to use conda (the package manager for Anaconda Python distribution, the first question was in what ways conda is better then pip, and so why one should think of preferring condo over the de-facto pip. Here I have put a comprehensive post about ‘getting started with conda’ i.e. what extra condo can offer.

A short comparison

pip
  • Can only be used for Python packages.
  • The supported package manger by the Python foundation, hence widely used.
conda
  • Handles library dependencies even outside Python i.e. packages for C libraries, or R packages, or really anything.
  • Supports virtual environment out of the box.
  • Developed to be used with Anaconda Python distribution, though can be used with the standard Python distribution – but highly not recommended.

Continue reading “conda VS pip”

Better management of Python virtual environments with virtualenvwrapper

After writing about ‘what is virtualenv‘  and pyenv  I have been feeling a compulsion to write about the one remaining tool in the family i.e. virtualenvwrapper.
As it is in the name, virtualenvwrapper is just a wrapper (an extension) around the virtualenv. The sole motive behind writing it, is covering the discrepancies or features virtualenv lacks, and biggest issue is managing these virtualenvs. As stated in the official docs, the main value-adding features of virtualenvwrapper are:
  • Organizes all of the virtual environments at a single location.
  • Provides better management of virtualenvs – intuitive commands for creating, deleting, copying virtualenvs.
  • A single command to switch between environments i.e. workon (demonstrated later in the post)
  • User-configurable hooks for all operations (see Per-User Customization).
  • Plugin system for more creating shareable extensions (see Extending Virtualenvwrapper).

Continue reading “Better management of Python virtual environments with virtualenvwrapper”

What is virtualenv, why we need it

For the starter (this is the opening post for the devopspy.com) let’s start with something basic, something confusing, something you see in almost every python code example i.e. virtual environment.
Python is an interpreted language, and for development all we need is a Python interpreter (included in Linux based OS – for Windows can be installed using the provided .msi). Like other programming languages Python has its own way of enhancements i.e. to use functionality not there by default, all we have to do is install the package, using any installation utility – pip (most common way), easy_install, or manual installation. These installed packages may termed as the requirements or the dependencies. These dependencies vary for every project – to get a project working all we need is the environment setup ( i.e. Python and the dependencies installed).

What is a virtual environment ?

is basically a separate Python interpreter with its own set of installed packages. As mentioned above the Python interpreter along with the installed packages make the environment – so we can have multiple Python environments on a single machine, the environments other the default are termed as virtual environment, which we need to create and activate before we can use (demonstrated later).

Continue reading “What is virtualenv, why we need it”