Python Development with Geany

Configuring and Using Geany for Python Development

Seann Hicks

Seann Hicks

Friday, May 28, 2021

What is Geany?

Geany is a lean little text editor that runs on Windows, Mac and Linux.  On Ubuntu it take about ~1second to load and runs in about 60Mb of memory.  Geany works well for Python development and in this article I go through installing, configuring and using Geany for Python development.

The screen shot below gives you an idea of what Geany looks like.  In this setup I have folder view enabled along with the editor screen split vertically to display multiple code windows.

Geany Python Code in split windows with folder view enabled

How to configure Geany for Python

Linux Ubuntu Install and Setup

To put these instructions together I am using a Raspberry Pi 4 with 4 MB of RAM.  I am using Ubuntu Mate, but these instructions also work on Raspbian.  To install Geany on Linux Ubuntu you can use the Aptitude packages installer (same goes for Raspbian).  The following command invokes the aptitude installer:

sudo apt-get install geany

You're going to want to make sure you have Python installed first off.  This is all you need to start coding in Python.

sudo apt-get install Python

I also recommend installing the Python code checker and linter commands.  These commands will check your code style to ensure you are formatting your code properly.

sudo apt install pycodestyle

pycodestyle checks your code formatting

sudo apt install pyflakes

pyflakes checks your dependencies and import statements

sudo apt install pylint

These commands can be used from a terminal to check your python files.  For example


But you can also integrate them into Geany.  Below you can see 3 commands configured for Python.  The Compile and Lint commands are setup by default, but I have added the Check command as follows.  To open these settings go to Build->Set Build Commands.

Geany Python Checker Setup 

You can see the Check command is referencing a bash script file in my home directory called The contents of that file are as follows:

echo "======  pycodestyle  ======"
pycodestyle $1
echo "======  pyflakes  ======"
pyflakes $1
echo "======  pylint  ======"
pylint --msg-template="{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}" --reports=n $1
pylint -f parseable -r n $1

Code courtesy of Geany Wiki

You are limited to 3 Python commands in Geany, but you can create bash scripts with multiple commands to get around this restriction.  This new Check command now appears in the Geany menu under Build, and if you run it, pycodestyle, pyflakes and pylint are all run against your code.  Any code issues found are displayed in the Compiler tab and lines with problems are underlined in red in the editor.

Geany Python Code Check Output 

How to run Python in Geany

Geany needs to know your currently file type to select the compile and execute settings. There are 2 ways to set the file type. In the case of python you can save the file with the .py extension or set the file type under document->Set Filetype->Scripting Languages->Python. When you go to save a file set as a Python file the py extension is added automatically.

Once your filetype is recognized, Geany uses default execution settings:

Python “%f”

This will open a terminal window (UXTerm) and run the default python executable with the current file.

Press the F5 key or choose Build->Execute

Geany Python Execution Terminal UXTerm


On my raspberry Pi I have 2 versions of python installed. Python 2.7 and Python 3.8.5. To Use Python 2 I use the python command, and to use Python 3 I use the python3 command.  To use  Python3 with Geany just update the Execute command from python "%f" to python3 "%f".


Geany is a lean and stable editor for Windows, Mac and Linux and runs very well on Raspberry Pi where you may have memory and CPU Limitations. Geany has support for Python coding and allows you to configure command line tools directly into the editor.

There are a few free editors and Integrated Development Environments for Python, with the best one being Pycharm in my opinion.  VSCode is also very good for Python and both Pycharm and VSCode run on Raspberry Pi.  See my article Pycharm vs VSCode for a deeper look into how these editors compare, or my article Geany Raspberry Pi for details on installing Geany on Raspberry Pi.

Photo by Louis Hansel on Unsplash

Sign-up to receive the weekly post in your inbox. I don't share email addresses, unsubscribe at any time.

Email Address