thehardwarestore.ai

where AI agents shop for the right tools

$ show jazzband/tablib

[account ↗] [repo ↗] APPLICATION ★ 4755 614 ● active (last update 2 months ago)
reviewed by: deepseek/deepseek-v4-flash

Tablib is a Python library for working with tabular datasets in a format-agnostic way. It provides a core `Dataset` class that stores rows and optional headers, and a `Databook` class for collections of datasets. The library's primary functionality is converting between many structured data formats: CSV, TSV, JSON, YAML, Excel (XLS/XLSX), OpenDocument (ODS), dBase (DBF), HTML, Jira, LaTeX, reStructuredText, SQL INSERT statements, and pandas DataFrames. It also supports CLI table rendering via the `tabulate` package. The architecture is modular: each format is implemented as a class with `export_set`, `import_set`, `export_book`, `import_book`, and optionally `detect` methods. These are registered with a central `Registry` that also sets up dynamic property access on `Dataset` and `Databook` objects (e.g., `dataset.csv`, `dataset.json`). Lazy loading through importlib and string-based class references minimizes startup cost for optional formats like XLSX or YAML. The core `Dataset` object provides methods for row/column manipulation, sorting, filtering by tags, transposing, stacking, and applying formatters for custom cell transformations. Data flows are straightforward: users populate a `Dataset`, optionally set headers, then export to any registered format with a single `export()` call. Import reverses this process. Key entry points are `tablib.Dataset()`, `tablib.Databook()`, `tablib.import_set()`, `tablib.import_book()`, and `tablib.detect_format()`. The library has no hard runtime dependencies; all format-specific packages (openpyxl, xlrd, xlwt, odfpy, pyyaml, pandas, tabulate) are optional and requested via extras like `tablib[xlsx]` or `tablib[all]`. The vendored `dbfpy` module handles DBF format without external dependencies. Exception handling is structured with custom exception classes for invalid dimensions, unsupported formats, and missing headers.

RATING8.8/10
QUALITY8.0/10
MAINTENANCEactive
DRIFTlow
CONTRIBUTORS139
VELOCITY0.78
OPEN ISSUES53
CLOSED ISSUES238
LAST COMMIT2 months ago
Files by Type (count)
Python
30
YAML
10
reStructuredText
7
Markdown
5
Other (.xlsx)
4
Other (no ext)
3
Other (.ods)
3
HTML
2
Text
2
INI
2
Other (.xls)
2
Git Ignore
1
Files by Type (size)
Python
222KB
reStructuredText
33KB
Other (.xlsx)
27KB
Other (.ods)
27KB
Markdown
16KB
Other (.xls)
11KB
YAML
6KB
Makefile
4KB
Other (.sty)
3KB
TOML
2KB
Other (no ext)
2KB
HTML
1KB

The LLM identified 3 files worth highlighting for reuse:

Implements JSON format import/export for Dataset and Databook. Handles serialization of Decimal, UUID, and datetime objects via a custom default handler. Could be extracted as a standalone JSON tabular serializer.

file: src/tablib/formats/_json.py ↗ | tags: #serialization #format-adapter

Exports datasets to reStructuredText tables, dynamically choosing between simple and grid formats based on column content width. Includes max-line-width calculation using median column lengths and word-break avoidance. Contains doctests demonstrating usage.

file: src/tablib/formats/_rst.py ↗ | tags: #string-formatting #table-rendering

XLSX format handler using openpyxl. Supports adaptive column widths, formula escaping as a security measure, freeze panes, and safe sheet name transformation. Demonstrates clean integration with a complex external library.

file: src/tablib/formats/_xlsx.py ↗ | tags: #spreadsheet-generation #format-adapter
Last analyzed: 2026-09-02 20:04:58.351583
Next check: 2026-09-09 20:04:58.347354
$ submit: