kb-dashboard-tools
Shared utilities for Kibana operations, authentication, and workflows. This package provides common functionality used across the kb-yaml-to-lens ecosystem, including CLI tools, Language Server Protocol (LSP) servers, and future MCP servers.
Features
- KibanaClient: HTTP client for interacting with Kibana's Saved Objects API and Elasticsearch APIs
- Authentication utilities: Credential normalization and URL redaction for safe logging
- Result pattern: Type-safe error handling without exceptions
- ES|QL support: Models for ES|QL query execution and results
Installation
pip install kb-dashboard-tools
Usage
Kibana Client
from kb_dashboard_tools import KibanaClient
# Note: ssl_verify=False is only for local development with self-signed certificates.
# Always use ssl_verify=True (the default) in production environments.
async with KibanaClient(
url='https://localhost:5601',
username='elastic',
password='changeme',
ssl_verify=False, # Only for local dev with self-signed certs
) as client:
# Upload a dashboard
result = await client.upload_ndjson('dashboard.ndjson')
# Execute ES|QL query
esql_result = await client.execute_esql('FROM logs | LIMIT 10')
print(f'Found {esql_result.row_count} rows')
Authentication Utilities
from kb_dashboard_tools import normalize_credentials, redact_url
# Normalize credentials (converts empty strings to None)
api_key = normalize_credentials(user_input)
# Redact credentials from URLs for safe logging
safe_url = redact_url('https://user:pass@example.com:9200/path')
# Returns: 'https://example.com:9200/path'
Result Pattern
from kb_dashboard_tools import Result
def divide(a: int, b: int) -> Result[float]:
if b == 0:
return Result.fail('Division by zero')
return Result.ok(a / b)
result = divide(10, 2)
if result.success:
print(f'Result: {result.unwrap()}')
else:
print(f'Error: {result.error}')
Development
See the main repository's DEVELOPING.md for development setup.
# Install dependencies
just install
# Run CI checks
just ci
# Run tests
just test
License
MIT
Release files for kb-dashboard-tools 0.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| kb_dashboard_tools-0.4.1.tar.gz | 36.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| kb_dashboard_tools-0.4.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 78.2 kB
Release files / kb_dashboard_tools-0.4.1.tar.gz
| Download URL | kb_dashboard_tools-0.4.1.tar.gz |
|---|---|
| Size | 36.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7ddf0911bbca8ca5af201a8576b4658ee9c112c0f3cb928c418a8bb5aa2bc587
|
|
BLAKE2b-256 checksum How to use checksums |
7bc0fdd998391067903cf83d3e3daff56fb05944637a9b49471bf12c72584316
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / kb_dashboard_tools-0.4.1-py3-none-any.whl
| Download URL | kb_dashboard_tools-0.4.1-py3-none-any.whl |
|---|---|
| Size | 41.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dd4e0448bf7926a6c234c717a69aba1586c531e8bba1695cf74de1641c98d207
|
|
BLAKE2b-256 checksum How to use checksums |
7c424587aba67ad7ef3292522b02794c55b632d732658026d576b2e9425480bb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|