Skip to content

trulens.dashboard.cli

trulens.dashboard.cli

Command-line interface for launching the TruLens dashboard.

The entry point is installed as trulens-dashboard. With no arguments it looks for a TruLens database in the current directory and serves it:

trulens-dashboard

Classes

DatabaseNotFoundError

Bases: Exception

No TruLens database could be located.

Functions

detect_database_prefix

detect_database_prefix(url: str) -> Optional[str]

Infer the table prefix used by a TruLens database.

PARAMETER DESCRIPTION
url

SQLAlchemy url of the database to inspect.

TYPE: str

RETURNS DESCRIPTION
Optional[str]

The detected prefix, or None if the database does not look like a TruLens database.

find_database

find_database(directory: Path) -> Tuple[str, str]

Find a TruLens database in directory.

The default database filename is preferred; remaining SQLite files are checked in alphabetical order. Files that do not contain TruLens tables are skipped.

PARAMETER DESCRIPTION
directory

Directory to scan.

TYPE: Path

RETURNS DESCRIPTION
Tuple[str, str]

A tuple of the database url and its table prefix.

RAISES DESCRIPTION
DatabaseNotFoundError

No TruLens database was found in directory.

resolve_database

resolve_database(
    directory: Path,
    database_url: Optional[str] = None,
    database_prefix: Optional[str] = None,
) -> Tuple[str, str]

Resolve the database to serve.

Precedence is explicit database_url, then the TRULENS_DATABASE_URL environment variable, then discovery within directory.

PARAMETER DESCRIPTION
directory

Directory to scan when no url is supplied.

TYPE: Path

database_url

Explicit database url.

TYPE: Optional[str] DEFAULT: None

database_prefix

Explicit table prefix. Detected when not given.

TYPE: Optional[str] DEFAULT: None

RETURNS DESCRIPTION
Tuple[str, str]

A tuple of the database url and its table prefix.

main

main(argv: Optional[Sequence[str]] = None) -> int

Entry point for the trulens-dashboard command.