Skip to main content

Library to manipulate and create Sourcetrail databases

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

numbat-0.2.6.tar.gz (766.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

numbat-0.2.6-py3-none-any.whl (30.4 kB view details)

Uploaded Python 3

File details

Details for the file numbat-0.2.6.tar.gz.

File metadata

  • Download URL: numbat-0.2.6.tar.gz
  • Upload date:
  • Size: 766.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for numbat-0.2.6.tar.gz
Algorithm Hash digest
SHA256 2790166335b22eabb5fa365ad1fa41831ca0c7a3de17cff70eb36e192a0c5acb
MD5 9878c1ae97ac0912181cf7417b1794df
BLAKE2b-256 18224eabd7a1dee01bf056a870e0b6e8e3d7aede7cb783394c3c057649859b4b

See more details on using hashes here.

File details

Details for the file numbat-0.2.6-py3-none-any.whl.

File metadata

  • Download URL: numbat-0.2.6-py3-none-any.whl
  • Upload date:
  • Size: 30.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for numbat-0.2.6-py3-none-any.whl
Algorithm Hash digest
SHA256 62b314b61206cf93af7a36f93925475d203b4f5cf017bde7d815193cc5347175
MD5 64265f80d1943e86c54bac0185e23f96
BLAKE2b-256 cd3defa085120aacd65eb844168780a3f656806912474395c6f2b1553de4d73d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page