Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sdata/deprecated/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import hashlib
import base64
import re
from tabulate import tabulate
from sdata.contrib.sqlitedict import SqliteDict

if sys.version_info < (3, 0):
Expand Down Expand Up @@ -1340,6 +1339,7 @@ def to_html(self, filepath, xlsx=True, style=None):
else:
xlsx_tag = ""

from tabulate import tabulate # optional; nur für HTML-Repr benötigt
param = {"title":"{0} [{1}]".format(self.osname,
self.uuid),
"description":self.description,
Expand Down
13 changes: 9 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,24 @@
with open('README.md', 'rb') as f:
readme = f.read().decode('utf-8')

REQUIRES = ['numpy', 'pandas', 'tabulate', 'xlrd', 'openpyxl', 'xlsxwriter', 'pytz', 'Pillow', 'suuid>=0.2.0']
# Schlanker Kern: nur numpy/pandas (Datenmodell), pytz (Zeitzonen) und suuid.
REQUIRES = ['numpy', 'pandas', 'pytz', 'suuid>=0.2.0']

# Optionale Abhängigkeiten:
# pip install "sdata[did]" DID-/VC-Subpackage (sdata.did)
# pip install "sdata[hdf]" HDF5-I/O (PyTables-Backend)
# pip install "sdata[sql]" to_sqlite / pandas.to_sql (SQLAlchemy)
# pip install "sdata[did]" DID-/VC-Subpackage (sdata.did, pure Python)
# pip install "sdata[http]" requests als HTTP-Backend (sonst urllib-Fallback)
# pip install "sdata[excel]" Excel-I/O (openpyxl/xlsxwriter via pandas)
# pip install "sdata[hdf]" HDF5-I/O (PyTables-Backend)
# pip install "sdata[sql]" to_sqlite / pandas.to_sql (SQLAlchemy)
EXTRAS = {
# sdata.did ist abhängigkeitsfrei (Ed25519 + base58btc als pure Python).
# Extra bleibt als no-op erhalten, damit 'pip install sdata[did]' weiter funktioniert.
'did': [],
# Optionales HTTP-Backend: ohne 'requests' nutzt sdata einen urllib-Fallback
# (Standardbibliothek). 'requests' bietet certifi-CA-Bundle/Connection-Pooling.
'http': ['requests'],
# Excel-I/O (z. B. deprecated Data.to_xlsx); 'tabulate' für das HTML-Repr.
'excel': ['openpyxl', 'xlsxwriter', 'tabulate'],
'hdf': ['tables'],
'sql': ['sqlalchemy'],
'parquet': ['pyarrow'], # sdata.sclass.DataFrame (Parquet-Serialisierung)
Expand Down
4 changes: 4 additions & 0 deletions tests/test_image.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import sys
import os
import pandas as pd
import pytest

pytest.importorskip("PIL") # Bild-Funktionen optional (Pillow)

from sdata.sclass.image import Image
modulepath = os.path.dirname(__file__)

Expand Down
1 change: 1 addition & 0 deletions tests/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import uuid

def test_data_to_html():
pytest.importorskip("xlsxwriter") # to_html bettet xlsx ein (sdata[excel])
df = pd.DataFrame({'a': ['x', 'y', '', 'z'], 'b': [1, 2, 2, 3.2]})
data = sdata.Data(name="data", uuid="38b26864e7794f5182d38459bab8584d", table=df, description="abc")
data.to_html("/tmp/data.html")
Expand Down
2 changes: 2 additions & 0 deletions tests/test_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import sdata
import pandas as pd
import numpy as np
import pytest


def test_table():
Expand All @@ -30,6 +31,7 @@ def test_table():

ts.to_folder("/tmp/sdata_table")

pytest.importorskip("xlsxwriter") # Excel-Export optional (sdata[excel])
table.to_xlsx("/tmp/sdata_table.xlsx")
print(table.metadata.to_dataframe())

Expand Down