Skip to main content

tai-storage

PyPI Python Manual

Los mismos ficheros, estén donde estén. Una sola API para el disco local, SharePoint Online, Azure Blob Storage y Google Drive, con la misma semántica en los cuatro, y la lectura de CSV, Excel, JSON y Parquet como DataFrames, sin perder ni una fila ni una columna sin avisar.

StorageFactory.create_*()  ──▶  Origin  ──get_folder()──▶  Folder  ──get_file()──▶  File
 local · sharepoint ·            la raíz                    list_files()             read() · write()
 azure · googledrive                                        upload_file()            move_to() · delete()
                                                                                     get_data() → DataFrame

📖 El manual completo está en triplealpha-innovation.github.io/tai-storage


Quickstart

pip install "tai-storage[sharepoint,data]"
export SHAREPOINT_TENANT_ID=… SHAREPOINT_CLIENT_ID=… SHAREPOINT_CLIENT_SECRET=…
export SHAREPOINT_HOSTNAME=contoso.sharepoint.com SHAREPOINT_SITE_NAME=Ventas
from tai_storage import StorageFactory

origin = StorageFactory.create_sharepoint()                 # comprueba ya las credenciales

for file in origin.get_folder("Clientes/Entrada").list_files(pattern=r"\.xlsx$"):
    df = file.get_data().to_dataframe(sheet_name="Pedidos")  # formato español, sin perder ceros ni decimales
    ...
    file.move_to(origin.get_file(f"Clientes/Procesados/{file.filename}"))

Con create_local("datos"), create_azure(container="ventas") o create_googledrive() el resto del código no cambia. Con dev_mode=True, lo que se lee se guarda en una caché local mientras desarrollas.

Y desde la terminal, antes de escribir el ETL:

tai-storage ping                                                   # ¿funcionan las credenciales?
tai-storage ls sharepoint:Clientes/Entrada                         # ¿qué hay?
tai-storage read sharepoint:Clientes/Entrada/pedidos.xlsx --sheet Pedidos   # ¿cómo se va a leer?
tai-storage analyze sharepoint:Clientes/Entrada/pedidos.xlsx       # ¿qué tiene de raro?

Los principios que explican el resto

  1. Nada falla en silencio. Toda operación devuelve lo que promete o lanza un error con qué ha pasado y qué hacer. exists() no devuelve False porque haya caducado un token, y leer un CSV no convierte en vacío lo que no entiende.
  2. Un contrato, cuatro backends. El mismo código hace lo mismo en los cuatro, con caché o sin ella. Lo prueba una misma batería de tests contra cada uno.
  3. Seguro por defecto. Una ruta nunca sale del origen, y nada se sobrescribe ni se borra sin pedirlo.
  4. Importar no tiene efectos. import tai_storage no carga pandas ni los SDK, no conecta y no lee el entorno.
  5. El coste se sabe. Cada operación remota documenta cuántas peticiones hace, y los ficheros grandes van por trozos (1 GB, unos 20 MB de memoria).

Qué trae

Cuatro orígenes Local, SharePoint (Microsoft Graph), Azure Blob Storage y Google Drive, con la misma API y la misma semántica
Errores con solución Cada error dice qué hacer; los de fichero son también los de Python (except FileNotFoundError)
Robustez Token que se renueva, reintentos de 429 y 5xx con Retry-After, paginación, subidas por trozos sin límite de tamaño
dev_mode Una caché local de lo que se lee, con la semántica exacta del servicio
DataFrames CSV, Excel, JSON y Parquet; formato español por defecto; la inferencia nunca introduce un nulo; los tipos declarados fallan diciendo la línea o la celda
Informe de datos analyze(df).save(…): un HTML autocontenido con los avisos y una ficha por columna
Logs Con tai-alphi: lo que cambia algo en INFO, lo anómalo en WARNING, nunca secretos
El CLI tai-storage ping (¿funcionan mis credenciales?), ls, read (cómo leerá get_data() este fichero) y analyze (su informe), con cualquier origen
Reglas para asistentes de IA tai-storage rules install deja en tu proyecto lo que un asistente necesita saber de la librería

Instalación

pip install tai-storage                    # núcleo y disco local
pip install "tai-storage[sharepoint]"      # SharePoint (httpx, msal)
pip install "tai-storage[azure]"           # Azure Blob (azure-storage-blob); [azure-identity] sin clave
pip install "tai-storage[googledrive]"     # Google Drive (httpx, google-auth)
pip install "tai-storage[data]"            # DataFrames (pandas, openpyxl, xlrd, pyarrow)
pip install "tai-storage[analysis]"        # el informe HTML (pandas, plotly, jinja2)
pip install "tai-storage[all]"             # todo

Python 3.10 o posterior. Detalle de cada extra, y qué hacer si falta, en Instalación. Si vienes de la 0.1: De la 0.1 a la 0.2.

Desarrollo

pip install -e ".[all,dev]"
pytest -m "not sharepoint and not azure and not googledrive and not azurite"

pip install -r docs/requirements.txt
mkdocs serve                              # el manual en http://127.0.0.1:8000

El manual (docs/) es para quien usa tai-storage. Cómo está montada y qué no romper, para quien trabaja en ella: CLAUDE.md, .claude/rules/ y specs/.

Autores

Metadata

Release files for tai-storage 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tai-storage 0.2.2
File Size Uploaded Provenance Actions
tai_storage-0.2.2.tar.gz 115.2 kB Without provenance Details for tai_storage-0.2.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tai-storage 0.2.2
File Interpreter ABI Platform Actions
tai_storage-0.2.2-py3-none-any.whl Python 3 none any Details for tai_storage-0.2.2-py3-none-any.whl

Total release size: 274.2 kB

Release files / tai_storage-0.2.2.tar.gz

Download URL tai_storage-0.2.2.tar.gz
Size 115.2 kB
Tags Source
SHA-256 checksum
How to use checksums
02753098a925e48db80cf4c3e03ab434edecbd53ec67d5e64074731bfc34bf9f
BLAKE2b-256 checksum
How to use checksums
b274a228642f6a0120b0910dbc519bf1e9b602f26ad8828849b5fa19e22a07e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.12.14 Linux/6.17.0-1022-azure

Release files / tai_storage-0.2.2-py3-none-any.whl

Download URL tai_storage-0.2.2-py3-none-any.whl
Size 159.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f8aa4534534de51ae6f95c0d3f3cb46f2694a26566e5a7a833657323a3b5bb33
BLAKE2b-256 checksum
How to use checksums
0b97d3974718e6ae5f75da3e2f79195a3f8f14ef44fd265d1465d6cf988bd3a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.12.14 Linux/6.17.0-1022-azure

Security for tai-storage 0.2.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page