semvec/pypi-packages huggingface dataset:
safe-view 0.4.0
A terminal application to view safetensors files
License: MIT
Requires Python: >=3.9

# SafeView

A terminal application to view safetensors files. SafeView provides a clean, interactive terminal interface for exploring safetensors files and Hugging Face models.
![safe-view](./assets/screenshot_1.svg)
![safe-view search](./assets/screenshot_2.svg)

## Features

- Interactive terminal UI for browsing tensors
- Detailed tensor information including shape, data type, and size
- Statistical information about tensor values including min, max, mean, standard deviation, quantile analysis (1st, 10th, 25th, 50th/median, 75th, 90th, 99th percentiles), and sparsity percentage - loaded on demand when a tensor is selected
- Value distribution histogram visualization with toggle between linear and logarithmic scales
- Support for local safetensors files and Hugging Face model repositories with automatic downloading
- Real-time search and filtering by tensor name
- Clean and intuitive Textual-based interface with tabbed view (Details and Histogram)
- Optimized loading - only metadata is loaded initially, tensor statistics shown when a tensor is selected
- Progress indicators when loading tensor statistics
- Data preview snippets for quick inspection
- File-level information including total size, tensor count, and total parameter count

## Installation

### From PyPI:
```shell
pip install safe-view
```

### Using pip (from local directory):
```shell
pip install .
```

### Using uv:
```shell
uv pip install .
```

### Development mode:
If you want to run in development mode, you can install in editable mode:

```shell
pip install -e .
```

or with uv:

```shell
uv pip install -e .
```

## Usage

After installation, you can run the application directly from the command line:

```shell
safe-view /path/to/your/file.safetensors
```

Or for a Hugging Face model:

```shell
safe-view Qwen/Qwen3-0.6B
```

For help:

```shell
safe-view --help
```

## Controls

- `q`: Quit the application
- `h`, `j`, `k`, `l` or arrow keys: Navigate between tensors
- `g`: Go to top of the tensor list
- `G`: Go to bottom of the tensor list
- `Ctrl+f` / `Ctrl+b`: Page up/down
- `/`: Enter search mode to filter tensors by name
- `Escape`: Exit search mode
- `x` or `Enter`: Load and display detailed statistics for the selected tensor
- `Ctrl+l`: Toggle histogram between linear and logarithmic scale
- Click on a tensor in the left panel to view its details and statistics on the right

## Requirements

- Python 3.9+
- Dependencies listed in pyproject.toml
django-toon-rest 0.1.3
Django REST Framework renderer for TOON format
License: MIT
Requires Python: >=3.8

# django-toon-rest

Django REST Framework library for rendering responses in TOON format (Token-Oriented Object Notation).

## Description

`django-toon-rest` provides a custom renderer for Django REST Framework that allows returning API responses in TOON format, a lightweight and LLM-friendly format.

## Installation

```bash
pip install django-toon-rest
```

This will automatically install required dependencies like `json-toon` and `djangorestframework`.

## Usage

### Basic Configuration

```python
from rest_framework import viewsets
from rest_framework.renderers import JSONRenderer
from django_toon_rest.renderers import TOONRenderer

class ItemViewSet(viewsets.ReadOnlyModelViewSet):
    renderer_classes = [JSONRenderer, TOONRenderer]
    
    def list(self, request, *args, **kwargs):
        serializer = self.get_serializer(self.get_queryset(), many=True)
        return Response(serializer.data)
```

### Content Negotiation

The client must send the `Accept: application/toon` header to receive the response in TOON format:

```bash
curl -H "Accept: application/toon" http://api.example.com/items/
```

## Features

- ✅ Custom renderer compatible with DRF
- ✅ Automatic content negotiation
- ✅ Automatic conversion of Python data to TOON
- ✅ Compatible with all DRF data structures
- ✅ Automatic handling of Django Decimal fields

## Data Type Handling

The `TOONRenderer` automatically handles common Django/DRF data types:

- **Decimal fields**: Automatically converted to `float` for JSON serialization
- **Nested objects**: Preserved as JSON within table cells (TOON format behavior)
- **Lists and dictionaries**: Fully supported with proper formatting

This means you don't need to modify your serializers - the renderer handles type conversions automatically.

## Example Project

For a complete working example with models, serializers, and sample data, see the example project:

- **Repository**: [django-toon-rest-example](https://github.com/martinartaza/django-toon-rest-example) (coming soon)

The example project demonstrates:
- Models with relationships (ForeignKey, ManyToMany)
- Nested serializers
- Multiple endpoints with TOON rendering
- Sample data fixtures

## Dependencies

- Python >= 3.8
- Django REST Framework >= 3.0.0 (installed automatically)
- json-toon >= 1.0.0 (installed automatically)

## Development

```bash
# Clone the repository
git clone https://github.com/martinartaza/django-toon-rest.git
cd django-toon-rest

# Install in development mode
pip install -e .
```

## Testing

```bash
# Optional: dev dependencies
pip install -r requirements-dev.txt

# Run tests
pytest -q
```

Expected output (example):

```
4 passed in 0.XXs
```

## License

MIT License

## Author

Martin Artaza

## Repository

https://github.com/martinartaza/django-toon-rest