Metadata-Version: 2.4
Name: vaiz
Version: 0.1.0
Summary: A web-based visualization tool for logs, configuration files, and tabular data
License-Expression: MIT
Project-URL: Homepage, https://github.com/a-mitm/Vaiz
Project-URL: Documentation, https://github.com/a-mitm/Vaiz#readme
Project-URL: Repository, https://github.com/a-mitm/Vaiz.git
Project-URL: Issues, https://github.com/a-mitm/Vaiz/issues
Project-URL: Changelog, https://github.com/a-mitm/Vaiz/releases
Keywords: log-viewer,visualization,logs,configuration,table,flask
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Web Environment
Classifier: Framework :: Flask
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Debuggers
Classifier: Topic :: System :: Logging
Classifier: Topic :: Utilities
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: flask>=3.0.0
Requires-Dist: pandas>=2.0.0
Requires-Dist: werkzeug>=3.0.0
Requires-Dist: openpyxl>=3.0.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
Requires-Dist: ruff>=0.1.0; extra == "dev"
Requires-Dist: pyinstaller>=6.0.0; extra == "dev"
Requires-Dist: selenium>=4.15.0; extra == "dev"
Dynamic: license-file

# Vaiz

[![CI](https://github.com/a-mitm/Vaiz/actions/workflows/ci.yml/badge.svg)](https://github.com/a-mitm/Vaiz/actions/workflows/ci.yml)
[![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

A web-based visualization tool for logs, configuration files, and tabular data.

## Features

- **Log Viewer**: Load and analyze CSV log files with filtering, sorting, and virtual scrolling
- **Configuration Viewer**: Browse JSON configuration files in a tree/value pane layout
- **Table Viewer**: Display tabular data with sortable columns and row coloring
- **Multi-tab Interface**: Work with multiple files simultaneously
- **Filtering**: Filter logs by process ID, thread ID, log level, date range, and message text
- **OR Filtering**: Use `|` to filter by multiple terms (e.g., `error | warning | failed`)
- **Highlighting**: Highlight matching rows with customizable colors
- **Keyboard Navigation**: Navigate configuration trees with arrow keys
- **Native File Browser**: Browse files using the native OS file picker

## Installation

### From PyPI (when published)

```bash
pip install vaiz
```

### From Source

```bash
git clone https://github.com/a-mitm/Vaiz.git
cd Vaiz
pip install -e .
```

### Development Installation

```bash
pip install -e ".[dev]"
```

## Quick Start

```python
from vaiz import VaizServer

# Create server
server = VaizServer(host='127.0.0.1', port=5000)

# Add a file open action
def load_file(file_path):
    # Return a LogProvider, ConfigurationProvider, or TableProvider
    pass

server.add_toolbar_action(
    action_id='open-file',
    icon='fa-folder-open',
    label='Open',
    shortcut='Ctrl+O',
    callback=load_file
)

server.run()
```

## Providers

Vaiz uses a provider-based architecture. Implement these abstract classes for custom data sources:

### LogProvider

For log data with timestamp, level, message, etc.

```python
from vaiz import LogProvider, LogEntry

class MyLogProvider(LogProvider):
    @property
    def name(self) -> str:
        return "My Logs"

    @property
    def logs(self) -> list[LogEntry]:
        return [
            LogEntry(
                id="1",
                timestamp=datetime.now(),
                process_id="1234",
                thread_id="100",
                level="INFO",
                message="Application started"
            )
        ]
```

### ConfigurationProvider

For hierarchical key/value configuration.

```python
from vaiz import ConfigurationProvider, ConfigurationKey, ConfigurationValue

class MyConfigProvider(ConfigurationProvider):
    @property
    def name(self) -> str:
        return "My Config"

    def get_keys(self, path: str = '') -> list[ConfigurationKey]:
        # Return keys at the given path
        pass

    def get_values(self, path: str = '') -> list[ConfigurationValue]:
        # Return values at the given path
        pass
```

### TableProvider

For generic tabular data.

```python
from vaiz import TableProvider, TableColumn, TableRow

class MyTableProvider(TableProvider):
    @property
    def name(self) -> str:
        return "My Table"

    @property
    def columns(self) -> list[TableColumn]:
        return [
            TableColumn(key="id", label="ID", width="80px"),
            TableColumn(key="name", label="Name"),
            TableColumn(key="status", label="Status", formatter="badge")
        ]

    @property
    def rows(self) -> list[TableRow]:
        return [
            TableRow(id="1", data={"id": 1, "name": "Item 1", "status": "active"}),
            TableRow(id="2", data={"id": 2, "name": "Item 2", "status": "pending"}, color="yellow")
        ]
```

## Keyboard Shortcuts

| Shortcut | Action |
|----------|--------|
| Ctrl+O | Open file |
| Home | Scroll to top |
| End | Scroll to bottom |
| Arrow keys | Navigate configuration tree |

## Development

### Running Tests

```bash
pytest
```

### Running Tests with Coverage

```bash
pytest --cov=vaiz --cov-report=term-missing
```

### Linting

```bash
ruff check vaiz/ tests/
ruff format vaiz/ tests/
```

### Building Standalone Executable

You can package your Vaiz application as a standalone executable using PyInstaller.

#### Using the Built-in Script (for this repo)

```bash
pip install -e ".[dev]"
python scripts/build_exe.py
```

#### Creating Your Own Executable

To build an executable from your custom application:

1. **Install dependencies:**
   ```bash
   pip install vaiz pyinstaller
   ```

2. **Create your application** (e.g., `my_app.py`):
   ```python
   from vaiz import VaizServer, LogProvider, LogEntry

   class MyLogProvider(LogProvider):
       # Your implementation
       pass

   def main():
       server = VaizServer(title='My App')
       server.add_toolbar_action(...)
       server.run()

   if __name__ == '__main__':
       main()
   ```

3. **Find the vaiz package location:**
   ```bash
   python -c "import vaiz; print(vaiz.__path__[0])"
   ```

4. **Build with PyInstaller:**
   ```bash
   pyinstaller --onefile --name=myapp \
       --add-data "/path/to/vaiz/templates:vaiz/templates" \
       --add-data "/path/to/vaiz/static:vaiz/static" \
       --hidden-import flask \
       --hidden-import werkzeug \
       --hidden-import pandas \
       --hidden-import jinja2 \
       my_app.py
   ```

   On Windows, use `;` instead of `:` as the path separator:
   ```bash
   pyinstaller --onefile --name=myapp ^
       --add-data "C:\path\to\vaiz\templates;vaiz/templates" ^
       --add-data "C:\path\to\vaiz\static;vaiz/static" ^
       --hidden-import flask ^
       --hidden-import werkzeug ^
       --hidden-import pandas ^
       --hidden-import jinja2 ^
       my_app.py
   ```

5. **Find your executable** in the `dist/` directory

## Contributing

Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
