Sourcetrail 2019.1

Author: Malte Langkabel

Sourcetrail finally lets you explore Python source code! Version 2019.1 makes it possible to run self-written source code indexers from within Sourcetrail. To make writing those indexer easy, we implemented and open-sourced the SourcetrailDB library that allows for exporting data to Sourcetrail project files. Custom indexers can directly be used from within Sourcetrail via the new Custom Source Group, available in the project setup. The SourcetrailPythonIndexer uses this new approach. It is still experimental but already available on GitHub.

Sourcetrail shows where a member variable is accessed using the SourcetrailPythonIndexer.

New in this Release:

You can download Sourcetrail 2019.1 here. The full changelog is available here. Going into some more detail, I will now outline the most important updates new in this release.

SourcetrailDB

We originally launched Sourcetrail with support for the programming languages C++ and C. Later we extended to Java. But throughout the years and releases we received lots of requests for supporting other languages. So far we couldn’t keep up with these demands, since we just don’t have the resources to work on all of these languages. So we discussed this issue and found that if we would tackle new language support in the future, we want our users to be able to help. Or even start their own projects for extending Sourcetrail’s language support.

We have been thinking for quite some time about how to approach this problem. What would be the best/easiest API for users to write their own indexers? We came to the conclusion that the most flexible way of doing this, is by giving users access to our project format and a simple way of recording information. That way indexers can be written in any programming language and we don’t need to deal with maintaining a separate API in our Sourcetrail binary.

SourcetrailDB's C++ API sample shows how to create an index and record information using C++.

In this context we released SourcetrailDB on GitHub, which is an open-source library to create and export Sourcetrail compatible projects. The library is written in C++, but can also be used with other languages via SWIG bindings. A Python binding is already available.

We made the API for recording the index simple and straight-forward. The library also contains some examples to get an idea of how it works in practice.

SourcetrailDB's poetry indexer sample project, illustrating how to write custom indexers.

If you are interested in writing an indexer, we can help you starting out. Just open an issue or write to support@sourcetrail.com and we will do what we can to help. If a custom indexer reaches a state of maturity, it will be linked in SourcetrailDB’s README.

Custom Source Groups

SourcetrailDB allows you to write custom indexers. These indexers can be integrated into Sourcetrail projects with our new Custom Source Group. It allows you to specify which files should be indexed and to supply the commandline call to invoke the custom indexer.

The new Custom Source Group in the Source Group selection.

After selecting the Custom Source Group you can specify a commandline call that will be executed for every file in the Source Group. Additionally you can also pass certain variables, like file path, database path and database version.

Define commandline call and source files for the Custom Source Group.

Experimental Python Indexer

Based on SourcetrailDB and the SWIG Python binding, we already started working on a Python Indexer for Sourcetrail. Like many other Python tools it is using the jedi project to gather all the relevant source information. The indexer is already usable, so if you want to index your own Python code, please follow these setup instructions.

The Python indexer adds experimental Python support to Sourcetrail.

The Python indexer is not feature complete yet, but already provides most language features. If you want to contribute, please take a look at our contribution guideline.

UI improvements

Cleaner Code View Snippet Style

Over the years the UI of the Code View snippet mode has become quite overloaded. With this release the frames around each file are gone to reduce visual clutter. Also the buttons for switching between minimized and snippet state were removed, since this can also be done by clicking into the file bar.

Code view snippets before and after.

Fixed Edges in Call/Inheritance/Include Graph After Movement

Moving graph nodes in the depth graph sometimes resulted in strange edge routing. This is due to the underlying algorithm that places virtual graph nodes at certain points to reduce edge crossings. We now remove these virtual nodes as soon as either side of the edge is moved.

Edge routing in call/inheritance/include graph after movement before and after.

Wrap Lines in Errors Table

So far contents in the errors table where simply cut off when too long. This was pretty annoying to work with, especially on small screens. With the new release we finally wrap the lines to provide all information right away.

Error table contents before and after.

Closing comments

Thanks for reading, we hope that you like our progress! Don’t forget to download the new release.

If you plan on going to ACCU 2019, our Eberhard will be giving a short talk on the benefits of Software Visualization and his work on Sourcetrail. Check it out!

Follow us: mail - Twitter - Slack

Sourcetrail now supports Python

Python support (beta) now available based on SourcetrailPythonIndexer Continue reading

Sourcetrail 2018.4

Published on November 13, 2018

Sourcetrail 2018.3

Published on August 06, 2018