File handling library for creating, saving, and loading various file types (CSV, JSON, JOBLIB, PDF)
Project description
dsr-files
File handling library for creating, saving, and loading various file types.
Version 1.0.0: This release is breaking and not backward-compatible with prior 0.x versions.
Features
- CSV: Read and write CSV files with pandas
- JSON: Save and load JSON data structures
- JOBLIB: Serialize Python objects with joblib
- Excel: Save and load Excel workbooks (single or multi-sheet)
- PDF: Generate PDF documents with text content
Installation
pip install dsr-files
Development Installation
pip install -e ".[dev]"
Usage
CSV Operations
from dsr_files import save_csv, load_csv, create_csv
import pandas as pd
from pathlib import Path
# Create from dictionary
data = {"name": ["Alice", "Bob"], "age": [30, 25]}
df = create_csv(data)
# Save to CSV
save_csv(df, Path("."), "data")
# Load from CSV
df = load_csv(Path("data.csv"))
JSON Operations
from dsr_files import save_json, load_json
from pathlib import Path
data = {"key": "value", "number": 42}
# Save to JSON
save_json(data, Path("."), "data")
# Load from JSON
data = load_json(Path("data.json"))
JOBLIB Operations
from dsr_files import save_joblib, load_joblib
from pathlib import Path
# Save any Python object
model = {"weights": [1, 2, 3], "config": {}}
save_joblib(model, Path("."), "model")
# Load from JOBLIB
model = load_joblib(Path("model.joblib"))
Excel Operations
from dsr_files import save_excel, load_excel, ExcelSheetConfig
from pathlib import Path
import pandas as pd
sales = pd.DataFrame({"region": ["NA", "EU"], "revenue": [120, 95]})
costs = pd.DataFrame({"region": ["NA", "EU"], "cost": [80, 70]})
# Save multi-sheet workbook
save_excel(
[
ExcelSheetConfig(data=sales, sheet_name="Sales"),
ExcelSheetConfig(data=costs, sheet_name="Costs"),
],
Path("."),
"report",
)
# Load first sheet
df = load_excel(Path("report.xlsx"))
PDF Operations
from dsr_files import save_pdf
from pathlib import Path
# Save text to PDF
content = "Hello, World!\nThis is a PDF document."
save_pdf(content, Path("."), "document", title="My Document")
Testing
pytest tests/
pytest tests/ --cov=src/dsr_files
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dsr_files-1.0.3.tar.gz.
File metadata
- Download URL: dsr_files-1.0.3.tar.gz
- Upload date:
- Size: 13.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
197c94f8339d6353ffedb845623843969257ad0f8f559e414f84c1393a8c693d
|
|
| MD5 |
4555365082cce4fee0633d36f95c9518
|
|
| BLAKE2b-256 |
eabdd3b91696f49295c25139682571a751af2b403daee101504ca167af7cba21
|
Provenance
The following attestation bundles were made for dsr_files-1.0.3.tar.gz:
Publisher:
python-publish.yml on scottroberts140/dsr-files
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dsr_files-1.0.3.tar.gz -
Subject digest:
197c94f8339d6353ffedb845623843969257ad0f8f559e414f84c1393a8c693d - Sigstore transparency entry: 930417546
- Sigstore integration time:
-
Permalink:
scottroberts140/dsr-files@3a810a2dd600221caf77530f4009a66c15a13ba9 -
Branch / Tag:
refs/tags/v.1.0.3 - Owner: https://github.com/scottroberts140
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@3a810a2dd600221caf77530f4009a66c15a13ba9 -
Trigger Event:
release
-
Statement type:
File details
Details for the file dsr_files-1.0.3-py3-none-any.whl.
File metadata
- Download URL: dsr_files-1.0.3-py3-none-any.whl
- Upload date:
- Size: 13.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d9d3f799e02286c4b0ea816ff87c3be16e2cc73d2e7d1cbdec23a8c2e1aecf1b
|
|
| MD5 |
79100e3f073cb4fdbcb62538ebab98ef
|
|
| BLAKE2b-256 |
ed67c6dff711d458ab8df0b39e00baad704ca1b8dcee3c580f3c3887932add67
|
Provenance
The following attestation bundles were made for dsr_files-1.0.3-py3-none-any.whl:
Publisher:
python-publish.yml on scottroberts140/dsr-files
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dsr_files-1.0.3-py3-none-any.whl -
Subject digest:
d9d3f799e02286c4b0ea816ff87c3be16e2cc73d2e7d1cbdec23a8c2e1aecf1b - Sigstore transparency entry: 930417550
- Sigstore integration time:
-
Permalink:
scottroberts140/dsr-files@3a810a2dd600221caf77530f4009a66c15a13ba9 -
Branch / Tag:
refs/tags/v.1.0.3 - Owner: https://github.com/scottroberts140
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@3a810a2dd600221caf77530f4009a66c15a13ba9 -
Trigger Event:
release
-
Statement type: