Skip to main content

pytabify es una libreria ligera para cargar, validar y persistir datos tabulares desde CSV, JSON y Excel, con una API Python simple y un wrapper oficial para Robot Framework.

Project description

pytabify

Tabify your data, Python-style

Tabula tus datos con Python

pytabify es una librería ligera para cargar, validar y persistir datos tabulares desde CSV, JSON y XLSX. Está pensada para automatización de pruebas, fixtures, scripts y flujos simples de datos en Python y Robot Framework.

Documentation

Docs

Puedes consultar la documentación completa aquí:

https://angel-valdezzz.github.io/pytabify/

Características

  • Soporte para múltiples formatos: CSV, JSON y XLSX.
  • Contrato tabular estable con columnas ordenadas y consistentes.
  • Preserva tipos nativos en memoria.
  • Wrapper oficial para Robot Framework.
  • Exportación flexible a múltiples formatos.

Arquitectura

El paquete sigue una separación basada en clean architecture y arquitectura hexagonal:

  • domain: entidades y reglas del modelo tabular.
  • application: puertos y casos de uso.
  • adapters: adaptadores concretos para archivos y Robot Framework.
  • creator.py y saver.py: fachadas públicas enfocadas en la API de uso.

Instalación

pip install pytabify

Uso básico

Crear un DataTable desde archivo

from pytabify import DataTableCreator

datatable = DataTableCreator.from_file("data.json")
datatable = DataTableCreator.from_file("data.csv", encoding="utf-8")
datatable = DataTableCreator.from_file("data.xlsx", sheet_name="Hoja1")

Acceder y modificar datos

row = datatable[0]
print(row.name.value)

for row in datatable:
    print(row.to_dict())

row["age"] = 31
row.country = "MX"

Guardar datos

from pytabify import DataTableSaver

DataTableSaver.into_csv(datatable, "output.csv")
DataTableSaver.into_json(datatable, "output.json")
DataTableSaver.into_xlsx(datatable, "output.xlsx")

Integración con pruebas automatizadas

Python

from pytabify import DataTableCreator

datatable = DataTableCreator.from_records(
    [
        {"name": "Alice", "age": 30},
        {"name": "Bob", "age": 25},
    ]
)

assert datatable[0].name.value == "Alice"
assert datatable[1].age.value == 25

Robot Framework

*** Settings ***
Library    pytabify.robot.PyTabifyLibrary    WITH NAME    PyTabify

*** Test Cases ***
Leer datos desde CSV
    ${datatable}=    PyTabify.Create Data Table From File    path=data.csv
    Should Not Be Empty    ${datatable}

Validar un campo especifico
    ${row}=    PyTabify.Get Data Table Row    ${datatable}    0
    Should Be Equal As Strings    ${row.name}    Alice
    Should Be Equal As Integers    ${row}[age]    30

Pruebas

poetry install
poetry run pytest
poetry run pytest utests -q
poetry run pytest atests -q --no-cov
poetry run ruff check .
poetry run ruff format .
poetry run mypy src/pytabify
poetry run lint-imports

Licencia

Este proyecto está bajo la licencia MIT. Consulta el archivo LICENSE para más detalles.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytabify-2.0.0.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytabify-2.0.0-py3-none-any.whl (23.1 kB view details)

Uploaded Python 3

File details

Details for the file pytabify-2.0.0.tar.gz.

File metadata

  • Download URL: pytabify-2.0.0.tar.gz
  • Upload date:
  • Size: 12.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.14.2 Windows/10

File hashes

Hashes for pytabify-2.0.0.tar.gz
Algorithm Hash digest
SHA256 cc5c2ff4cb5a985ebb62d37d6ef6c614bdc5082ee1e4c0a1b9733abb89da9332
MD5 90f3525ed995e512970443abc15f0e0f
BLAKE2b-256 4120eb0431941cf234c980ab1d74218eadb900757cfbf247c07f8f6dfe3549e3

See more details on using hashes here.

File details

Details for the file pytabify-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: pytabify-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 23.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.14.2 Windows/10

File hashes

Hashes for pytabify-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4ba07e29dcb2b45c41748258b9be75214486646509ce307f8f2fcc693febc007
MD5 6c99d9e380976cf38ae2beaf227437f7
BLAKE2b-256 96cdb0fdb9219d4ad9d5af6ea06875e69d53ddc6eed510273b0cf96b08143fb8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page