Python SDK for Soi Gia
Project description
soigia
soigia is a Python SDK for dataframe workflows, internal UI screens, shared YAML configuration, and business pipelines.
Getting Started
pip install soigia
import soigia
df = soigia.DataTable({"name": ["alice"], "age": [19]})
print(df)
For local development:
pip install -e .
What It Includes
soigia.datatable.DataTablefor pandas-like data work with extra helpers.soigia.uifor Streamlit-based internal screens.soigia.pipeline.BasePipelinefor business workflows.soigia.configfor shared YAML configuration and multi-account storage.
Quick Examples
DataTable
from soigia.datatable import DataTable
df = DataTable({"name": ["alice", "bob"], "age": [19, 24]})
print(df.objects.filter(age__gte=20).values("name", "age"))
Reconciliation
from soigia.datatable import DataTable
left = DataTable(
{
"id": [1, 2],
"name": ["alice", "bob"],
"amount": [10, 20],
}
)
right = DataTable(
{
"id": [1, 2],
"name": ["alice", "bobby"],
"amount": [10, 25],
}
)
bundle = left.reconcile_bundle(
right,
key_columns=["id"],
title="Oracle vs Kudu Reconciliation",
html_path="tests/reconcile-report.html",
json_path="tests/reconcile-report.json",
open_report_in_browser=True,
)
print(bundle["html_path"])
print(bundle["json_path"])
print(bundle["payload"]["summary"])
If you only want the HTML string, use reconcile_html_report(). If you want the report opened immediately, use reconcile_open().
UI
from soigia.ui import ui
orders = [
{"id": 1, "customer": "Alice", "amount": 120.0, "status": "paid"},
{"id": 2, "customer": "Bob", "amount": 88.5, "status": "pending"},
]
@ui.page("Orders")
def orders_page(ctx):
ui.text("Order Dashboard")
keyword = ui.text_input("Search")
ui.metric("Total orders", len(orders))
ui.table(lambda: [row for row in orders if keyword.value.lower() in row["customer"].lower()])
ui.run()
Pipeline
from soigia.pipeline import BasePipeline
class SalesPipeline(BasePipeline):
stages = ["normalize", "summarize"]
def load_data(self):
return build_orders()
def normalize(self):
self.data_df = self.data_df.copy()
self.data_df["amount"] = self.data_df["amount"].astype(float)
def summarize(self):
self.model.total_rows = len(self.data_df)
pipeline = SalesPipeline(name="sales")
result = pipeline.run()
print(result.summary_path)
Documentation
Configuration
Use soigia.config to load and save a shared YAML file for the whole project.
Recommended workflow:
- keep
config.example.yamlin git - copy it to
config.yamlon your machine - keep the real
config.yamlout of version control - never commit secrets, tokens, keys, or chat IDs in the real file
Pipeline modules can also auto-load a config.yaml file placed next to the pipeline file. It is exposed as self.config with dot access:
if self.config.min_amount:
...
Examples
Run the bundled demos:
python -m examples.pipeline_final_template
python -m examples.pipeline_yaml_config_demo
make ui-config
make ui
make ui-users
make ui-csv
make ui-markdown
make ui-jinja
Release
Build distribution artifacts:
python -m pip install --upgrade build
python -m build
Upload to PyPI:
python -m pip install --upgrade twine
python -m twine upload dist/*
Run the test suite before release:
python -m pytest tests -q
Publish Checklist
- Bump the version in
pyproject.toml. - Update
CHANGELOG.md. - Run
python -m pytest tests -q. - Run
python -m build --no-isolation. - Upload with
python -m twine upload dist/*. - Tag the release in git.
Project Layout
soigia/examples/docs/tests/
Generated Files
data/<ClassName>/<step>.csvdata/<ClassName>/<ClassName>.csvdata/<ClassName>/<ClassName>.sqlite3data/<ClassName>/<ClassName>.parquetdata/<ClassName>/pipeline_summary.mdlogs/<ClassName>.log
Optional Features
- Google Sheets helpers usually need
gspreadand Google service-account support. - Shared account config screens need
pyyaml. - Jinja template examples need
jinja2. - Excel helpers need an Excel engine such as
openpyxl. - Parquet and Feather helpers need a parquet/arrow backend such as
pyarrow. - Fake data helpers work best with
faker, butsoigiaalso includes a small fallback generator.
Core Ideas
DataTable keeps the pandas mental model, but adds a few opinionated helpers:
objectsfor queryset-style chainingvalues()for record-style outputfilter()andexclude()for row filteringorder_by()anddistinct()for common table operationsjoin()for relational mergesvalidate_schema()for lightweight schema checksinit_versions(),snapshot(), andauto_version()for version tracking
Security Note
from_pickle() should only be used with trusted input. Pickle files can execute code during loading.
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 soigia-0.1.9.tar.gz.
File metadata
- Download URL: soigia-0.1.9.tar.gz
- Upload date:
- Size: 89.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
20a09d413bcd2551210abdb0a09f23149e323620f5e6c1077f17c4f2dc2f41c2
|
|
| MD5 |
915903c427f977687826aced1b5067f4
|
|
| BLAKE2b-256 |
c3807b494bacca7f2f7ae341bc04e146afff00296da5f3264b117f32010e7a17
|
File details
Details for the file soigia-0.1.9-py3-none-any.whl.
File metadata
- Download URL: soigia-0.1.9-py3-none-any.whl
- Upload date:
- Size: 62.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
78836db1ea6720e8410930bf55fa5b762933ab3e550082931c9f7ab6fd705878
|
|
| MD5 |
da23d7d881418a792778de574d6393c2
|
|
| BLAKE2b-256 |
e7a0828a16839c2881e0fff4fc60d1916c95caee5267f8bf224a7ff0510595bc
|