Skip to main content

Numbat

Numbat is an API to create and manipulate Sourcetrail databases. Sourcetrail is a code source explorer which allows users to navigate through the different components (functions, classes, types, etc.) easily.

Numbat main goal is to offer a full-python SDK given the fact that the current one, SourcetrailDB cannot be used anymore efficiently. It is not user-friendly at first sight, need to be compiled to provide Python bindings and, moreover, it is no longer maintained. Finally, we have added some little new features as finding an element in the database.

With Numbat, you will be able to visualize your data quickly with the nice graphical Sourcetrail interface. For example, Pyrrha uses Numbat to map firmware structure.

Installation

Numbat is available on pypi.

pip install numbat

From sources

You can also install it from the git repository. Either using the following oneliner:

pip install 'numbat @ git+https://github.com/quarkslab/numbat'

or doing it in few steps:

# Download the repo
git clone git@github.com:quarkslab/numbat.git
cd numbat
# Install numbat locally
pip install .

Build Documentation

If you want to build the documentation by first installing Numbat with the required [doc] dependencies and then serve the documentation on a local server.

# if you already have a local clone of the project
cd NUMBAT_DIR
pip install .[doc]

# otherwise
pip install 'numbat[doc]'

# serve doc locally
mkdocs serve

Basic Usage

A complete usage with examples is available in the documentation but here is a quick usage to begin with Numbat.

To use Numbat, you must first create a SourcetrailDB object and either create a new database or open an existing one:

from pathlib import Path
from numbat import SourcetrailDB

# Create DB
db = SourcetrailDB.open(Path('my_db'), clear=True)

# Create a first class containing the method 'main'
my_main = db.record_class(name="MyMainClass")
meth_id = db.record_method(name="main", parent_id=my_main)

# Create a second class with a public field 'first_name'
class_id = db.record_class(name="PersonalInfo")
field_id = db.record_field(name="first_name", parent_id=class_id)

# The method 'main' is using the 'first_name' field
db.record_ref_usage(meth_id, field_id)

# Save modifications and close the DB
db.commit()
db.close()

Authors & Maintainers

Current

  • Sami Babigeon (@sbabigeon), Quarkslab
  • Eloïse Brocas (@ebrocas), Quarkslab

Past

  • Pascal Wu (@pwu42), during his internship at Quarkslab

The logo is a creation of Benoît Forgette and Sami Babigeon.

Metadata

Release files for numbat 0.2.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for numbat 0.2.7
File Size Uploaded
numbat-0.2.7.tar.gz 766.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for numbat 0.2.7
File Interpreter ABI Platform
numbat-0.2.7-py3-none-any.whl Python 3 none any Details

Total release size: 796.7 kB

Release files / numbat-0.2.7.tar.gz

Download URL numbat-0.2.7.tar.gz
Size 766.2 kB
Tags Source
SHA-256 checksum
How to use checksums
5d38b920db530e384c9edf3a360c7a860b79c861e2f283dd8a2f8bb1141331b4
BLAKE2b-256 checksum
How to use checksums
50edc69cc25220e3fca0703b4226d0f1281bbfd7278f5368cc15afed597917f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / numbat-0.2.7-py3-none-any.whl

Download URL numbat-0.2.7-py3-none-any.whl
Size 30.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
af950d0cd8f3e9dcad186d6950656883caac67b0a4c811120edd778f5a6256f4
BLAKE2b-256 checksum
How to use checksums
fc11829bb44bd87f05552ba73b4c7dd7a558ff649ea57c1a44d202327ddd9907
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release history Release notifications | RSS feed

This release

0.2.7 This release

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page