Quantcast
Channel: Planet Python
Viewing all articles
Browse latest Browse all 22796

Yasoob Khalid: 4 Command-line tools for more Python productivity

$
0
0

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.

 

2. 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:

# .envsource 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.

 

3. Cookie Cutter

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.

 

4. 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!



Viewing all articles
Browse latest Browse all 22796

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>