Skip to main content

Adapter layer for .rost — converts any data source to canonical JSON

Project description

rost-io — Adapter layer for .rost

rost-io converts messy real-world data sources into the canonical JSON contracts that the .rost compiler and solver consume.

Design principle

The .rost compiler only reads canonical JSON. It has no database drivers, no Excel parser, no API calls. rost-io is the adapter layer that handles all of that — exactly as described in DATA_IO.md (Hexagonal Architecture).

Excel / CSV / Parquet / PostgreSQL / MySQL / PDF
        │
        ▼
  rost-io adapter        ← this package
        │
        │   staff.json        (schema: rost/staff/v1)
        │   leave.json        (schema: rost/leave/v1)
        │   calendar.json     (schema: rost/calendar/v1)
        ▼
  rostc compiler  →  solver  →  solution.json

Installation

# Core only (CSV + JSON — no extra dependencies)
pip install rost-io

# With Parquet support (P1)
pip install "rost-io[parquet]"

# With database support — PostgreSQL + MySQL (P1)
pip install "rost-io[db]"

# With Excel support (P2)
pip install "rost-io[excel]"

# With pandas support (P2)
pip install "rost-io[pandas]"

# Everything
pip install "rost-io[all]"

Quick start

from rost_io import CsvAdapter, validate_staff

# Convert a CSV staff export to canonical staff.json
adapter = CsvAdapter("hr_export.csv", id_col="employee_id", tags_col="roles")
staff_json = adapter.to_staff_json()

# Validate against the canonical schema
validate_staff(staff_json)          # raises jsonschema.ValidationError if invalid

# Write for the compiler
import json
with open("staff.json", "w") as f:
    json.dump(staff_json, f, indent=2)

Canonical JSON schemas

File Schema ID Description
staff.json rost/staff/v1 People + tags
leave.json rost/leave/v1 Leave/absence entries
calendar.json rost/calendar/v1 Date range + public holidays
solution.json rost/solution/v1 Solver output (read-only for rost-io)

Adapters

Adapter Priority Extra dep
CsvAdapter P0 none (stdlib)
JsonAdapter P0 none
ParquetAdapter P1 pyarrow
DatabaseAdapter P1 sqlalchemy
ExcelAdapter P2 openpyxl
PandasAdapter P2 pandas

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

rost_io-0.1.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.

rost_io-0.1.0-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file rost_io-0.1.0.tar.gz.

File metadata

  • Download URL: rost_io-0.1.0.tar.gz
  • Upload date:
  • Size: 12.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rost_io-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bfe011662e02c02c62dd7ce549a6ef2baeedb07598dae801c3140b5e9ad470e2
MD5 a2a852d70fa8530ce01845a53a0f0751
BLAKE2b-256 ead943b24f8476f7d91816822ee8ef4c1ba2c7c246c02eb2f2f5304afed1189b

See more details on using hashes here.

Provenance

The following attestation bundles were made for rost_io-0.1.0.tar.gz:

Publisher: release.yml on Bpi031/rost

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rost_io-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: rost_io-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rost_io-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f57aea533762c07428091677ab5680a44fad2897364d784fd6a3fef1c7bff32d
MD5 bc9a579a57a2e2c72aa7d2099beaac49
BLAKE2b-256 657f4d5c379b612c8866a8da165f7018bdf5bddc5a31a11e1496f1f10500480d

See more details on using hashes here.

Provenance

The following attestation bundles were made for rost_io-0.1.0-py3-none-any.whl:

Publisher: release.yml on Bpi031/rost

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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