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.
New in this Release:
- SourcetrailDB: Open-source library to write custom indexers exporting a Sourcetrail project
- Custom Source Groups: For integrating indexers based on SourcetrailDB directly with Sourcetrail.
- Experimental Python Indexer: Open-source Python indexer based on SourcetrailDB and jedi
- UI improvements: in graph, code and errors
- Lots of bug fixes
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.
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.
If you are interested in writing an indexer, we can help you starting out. Just open an issue or write to firstname.lastname@example.org 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.
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.
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 is not feature complete yet, but already provides most language features. If you want to contribute, please take a look at our contribution guideline.
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.
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.
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.
Thanks for reading, we hope that you like our progress! Don’t forget to download the new release.