vfaronov / geany-pynav

Geany plugin to navigate a Python codebase quicker

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Geany Python Navigation plugin

This is a plugin for Geany to make it easier to navigate a Python codebase.

Currently, its only feature is "jump to Python module". It tries to open the source file corresponding to a given Python module (dotted path).

Installation

  1. Install Geany 1.27+.
  2. Install GeanyPy. On Debian/Ubuntu, install geany-plugin-py as well as python-gtk2.
  3. Put pynav.py on your Geany plugin path, e.g. in ~/.config/geany/plugins/.
  4. Open Geany's plugin manager (Tools → Plugin Manager) and enable GeanyPy and Python Navigation.
  5. Click Keybindings to set your preferred key for "Jump to Python module". (This is optional: you can also invoke it from the Tools menu.)

Usage

When you press the chosen keybinding (or invoke Tools → Jump to Python module), the plugin first tries to figure out which Python module name (dotted path) you wish to look up:

  1. if there is some selected text in the current document, then it is used;
  2. otherwise, if the cursor is on a line beginning with import X or from X, then X is used;
  3. otherwise, you are prompted to enter the dotted path manually.

Then the plugin tries to find the file corresponding to that module name. For example, if the dotted path is foo.bar, the plugin looks for foo/bar.py or foo/bar/__init__.py in a few places around the current document.

You can also configure the search path on a per-project basis. To do so, open your Geany project file (the one whose name ends in .geany) and add a section like this:

[pynav]
path=/home/user/project/src:/home/user/project/lib

then restart Geany (reopen the project). The format is similar to that for PYTHONPATH.

About

Geany plugin to navigate a Python codebase quicker

License:GNU General Public License v2.0


Languages

Language:Python 100.0%