-
Notifications
You must be signed in to change notification settings - Fork 102
Enable ctags support
klaus ships with built-in support for Exuberant Ctags. Once enabled, all symbols in your source code (variable names, function names, …) are hyperlinked to the place of their definition.
- Install Exuberant Ctags:
- Debian/Ubuntu/…:
apt-get install exuberant-ctags
- Mac OS X:
brew install ctags
- Debian/Ubuntu/…:
- Install the
python-ctags3
package from PyPI:pip install python-ctags3
In the CLI, ctags support may be activated using --ctags <policy>
, where <policy>
allows you to fine-tune for what revisions ctags support should be enabled. The choices are
-
none
: This is like not passing--ctags
at all (default). -
tags-and-branches
: Only enable ctags support for the HEADs of branches and tags (recommended). -
ALL
: Enable ctags support for ALL revisions (don't use in production!)
The ALL
option not recommended in production because it enables visitors to cause a lot of load on your servers. This is due to the fact that each time a source code file is viewed in klaus, an Exuberant Ctags file is generated by executing the ctags
process (unless the tagsfile is already in klaus' internal cache). Running the ctags
process scans all files in the repository for symbol names, which causes both a lot of I/O and CPU load on your system.
If you're running klaus behind a proper Web server, i.e. have rolled your own WSGI deployment script, you can enable Ctags support by passing the ctags_policy
argument to make_app
, like so:
from klaus import make_app
application = make_app(
["/path/to/repo1", "/path/to/repo2"],
"John Doe's Git Repositories",
...
ctags_policy='tags-and-branches',
)