Source

4 Command-line tools for more Python productivity

Hi there folks. In this post I would be sharing a couple of command-line tools which can help to increase your python productivity. These tools have helped me a lot and might help you as well! This post is inspired by another post.

  1. IPython

IPython is the Python REPL on steroids. It has some really nice editions on top of the standard REPL. I am sure that if you use it once you will fall in love with it. The easiest way to install IPython is using pip:

$ pip install ipython

Now you can use it by typing this in your terminal:

$ ipython

You can read more about the nice features and tricks of IPython over here.

You can also automatically import modules when you enter the Python or IPython interpreter. Here is the Stackoverflow link which shows you how to do it.

more information.

  1. Autoenv

This is a simple tool built by Kenneth Reitz. It allows you to automatically activate your projects virtual environment.

You can install it using pip:

$ pip install autoenv

You can also use git:

$ git clone git://github.com/kennethreitz/autoenv.git ~/.autoenv
$ echo 'source ~/.autoenv/activate.sh' >> ~/.bashrc

And if you are on Mac OSX then Homebrew is also an option:

$ brew install autoenv
$ echo 'source /usr/local/opt/autoenv/activate.sh' >> ~/.bash_profile

What you have to do is make a file with the name of .env in your projects directory. The contents of that file will be somewhat like this:

# .env
source env/bin/activate

This is the command which you use to activate your virtual environment. It might be different for you. For instance if you use virtualenvwrapper then it would be something like this:

workon project

You can also use smartcd for more control and power. I have used it in the past.

more information.

You can use Cookie Cutter to make project boilerplates and then quickly start new projects based on those boilerplates. It is extremely useful and I have used it countless times. Currently there are a lot of Python project templates on GitHub which use Cookie Cutter.

You can install it using pip:

$ pip install cookiecutter

Now you can simply clone Cookie Cutter templates on GitHub using it:

$ cookiecutter https://github.com/JackStouffer/cookiecutter-Flask-Foundation.git

Now answer a couple of questions and your project is good to go!

more information.

  1. Bash Git Prompt

This is not strictly Python related. It is a bash prompt that displays information about the current git repository. In particular the branch name, difference with remote branch, number of files staged, changed, etc.

You can install it using git:

cd ~ 
git clone https://github.com/magicmonty/bash-git-prompt.git .bash-git-prompt

This tool can help you a lot if you are a regular git user. It saves you countless minutes if not hours.

more information.

I would also like to remind you that I have started a Python newsletter which lists curated articles and news regarding Python and it’s community. You can signup over here!

Which tools do you use for increasing your Python productivity? Share them with me in the comments section below!

Newsletter

×

If you liked what you read then I am sure you will enjoy a newsletter of the content I create. I send it out every other month. It contains new stuff that I make, links I find interesting on the web, and occasional discount coupons for my book. Join the 5000+ other people who receive my newsletter:

I send out the newsletter once every other month. No spam, I promise + you can unsubscribe at anytime

✍️ Comments

russomi

Reblogged this on russomi and commented: Nice list of tools…

mrasharp

Reblogged this on Software on the Shore and commented: Certainly some tools I may find useful sometime.

Jan Stoker

Thanks for the Bash Git Prompt tip. I’ve thought about hacking together something like this many times myself, but never got around to it. Great to see that it already exists. Definitely going to try it.

Yasoob
In reply to Jan Stoker

Don’t worry! I myself have thought about a number of things but never really got around implementing them. ;)

cllamach

Nice post. You can check zsh and oh-my-zsh plugin for even more information on the git repository.

Say something

Send me an email when someone comments on this post.

Thank you!

Your comment has been submitted and will be published once it has been approved. 😊

OK