A powerful and pretty interactive shell.
sudo apt-get install ipython
Get started at the official documentation.
sudo add-apt-repository ppa:webupd8team/sublime-text-3
sudo apt-get update
sudo apt-get install sublime-text-installer
Open sublime with
subl
Add the following to your User Preferences file (Preferences > Settings - User):
"update_check": false
Shortcuts by default are for english keyboard, for spanish keyboard you probably want Control+7/Control+shift+7 to work on comment blocks of code.
Add the following to your User Preferences file (Preferences > Key bindings - User):
{ "keys": ["ctrl+7"], "command": "toggle_comment", "args": { "block": false } },
{ "keys": ["ctrl+shift+7"], "command": "toggle_comment", "args": { "block": true } },
In order to change any key binding you can check what is the default (Preferences > Key bindings - Default) and just copy in the user prefences file with the modified keys.
To know which key combination you are pressing you can go to "View->Console" and type
sublime.log_input(True)
You can always change it from the bottom right menu for any file, but by default we would to always use spaces when using ROS files. Add the following to your User Preferences file (Preferences > Settings - User):
"translate_tabs_to_spaces": false,

To install it follow the installation instructions, resumed here as:
Go to View > Show Console and paste:
import urllib.request,os,hashlib; h = '2915d1851351e5ee549c20394736b442' + '8bc59f460fa1548d1514676163dafc88'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)
Go to Tools > Command Palette (or Control+Shift+P) and write install package then write anaconda in the input window popup window and press enter.
After restarting SublimeText it will be able to auto complete (on tab, on dot), show documentation (control+alt+d), go to the declaration of stuff (control+alt+g), autoformat (control+alt+r), find usages (control+alt+f). The shortcut keys can be changed by going to Preferences > Package Settings > Anaconda > Key bindings, use the default to know what you can change and write it in the user one like we did with the keybindings before.
If you want a behaviour similar to QtCreator or Eclipse on going to declaration by Control+Click, you can do:
echo '[
{
"button": "button1",
"count": 1,
"modifiers": ["ctrl", "alt"],
"press_command": "drag_select",
"command": "anaconda_goto"
}
]' > ~/.config/sublime-text-3/Packages/User/Default\ \(Linux\).sublime-mousemapWhich will enable Control+Alt+click to go to the declaration. (Control+Click gives you multiple cursors in SublimeText).
You'll get also linting for the code and other goodies, check all it can do at the documentation page.
Note that you must open it from the shell with a sourced environment (source myworkspace/devel/setup.bash) to get autocompletion and such.
If you ever want to ignore the PEP8 on a line just add at the end of it: ' # NOQA' note that there are two spaces before the # and one after.
Useful for comment lines with big URL's for example.
You can not only use Sublime Text for dealing with Python code, but also...
Just open a .launch file and click on the bottom right of the window corner (it says the current highlighting provided) and click on "Open all current extension as..." and choose XML.
Control+Shift+P write install and write markdown, choose MarkdownEditing.
Control+Shift+P write install and write markdown, choose MarkDown Preview.
Choose (bottom right corner) MarkdownEditing > Markdown / Markdown GFM from the file syntax to use it. To ease preview in browser add to Preferences > Key bindings - User:
{ "keys": ["alt+m"], "command": "markdown_preview", "args": {"target": "browser", "parser":"markdown"} },
To preview doing alt+m.

The downside is a slower starting time and a Eclipse-like feeling (if that is a downside for you).
PyCharm is like a heavily modified Eclipse, so it's based in Java.
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
I find it easier to install it from a repository:
wget -q -O - http://archive.getdeb.net/getdeb-archive.key | sudo apt-key add -
sudo sh -c 'echo "deb http://archive.getdeb.net/ubuntu trusty-getdeb apps" >> /etc/apt/sources.list.d/getdeb.list'
sudo apt-get update
sudo apt-get install pycharm
You can now just type pycharm to open it. Note that you must open it from the shell with a sourced environment (source myworkspace/devel/setup.bash) to get autocompletion and such.
I choose the Darcula IDE theme (it's darker) usually, up to the user.
Go to File > Settings > Editor > Colors & Fonts and choose your Scheme (Darcula for me). Hit Apply.
As you may know ROS packages can contain Python code. It is structured in the following manner:
In the scripts folder, as the name implies, you'll place the scripts you create. Either the final executable of some awesome library you created or just plain self contained scripts. You cannot import from somewhere else these files.
In order to install these scripts (so they are deployed) you need to add to CMakeLists.txt these executables like:
# Install scripts
install(PROGRAMS
scripts/my_awesome_script.py
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
Some ROS wiki page recommends to put nodes in a nodes folder, everything in scripts would apply to this folder too.
In order to let other packages import your python libraries in ROS you must follow a few steps that have to do with the src folder. They are annoying the first time, but they are always the same.
You have to create your_package/src/your_package folder. Inside of it you must create an empty __init__.py file. This is the way Python knows there are Python files for importing.
In order to install (and be able to import) this code you must create a setup.py file at the root of your package your_package/setup.py that contains where this python code is, like:
#!/usr/bin/env python
## ! DO NOT MANUALLY INVOKE THIS setup.py, USE CATKIN INSTEAD
from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup
setup_args = generate_distutils_setup(
packages=['your_package'],
package_dir={'': 'src'}
)
setup(**setup_args)And you must add to your CMakeLists.txt just after catkin_package():
catkin_python_setup()
DON'T CALL YOUR LIBRARY NAME EXACTLY LIKE YOUR PACKAGE OR IT WON'T BE ABLE TO BE IMPORTED
For some unknown (to me) reason you cannot have your_package/src/your_package/your_package.py. If any other package tries to do
from your_package.your_package import SOMETHING
It will fail with:
ImportError: No module named your_package.your_package


Very useful gist. Thanks for sharing!