Skip to main content

A minimal, functional Python ETL library for reading, validating, and transforming data using YAML schemas

Project description

Aptoro

PyPI version Python versions License: GPL v3 Code style: ruff

Aptoro is a Xavante word for "preparing the arrows for hunting".

It is a minimal, functional Python ETL library for reading, validating, and transforming data using YAML schemas. Designed for simplicity and correctness, it bridges the gap between raw data files (CSV, JSON) and typed, validated Python objects.

Features

  • Schema-First: Define your data model in simple, readable YAML.
  • Strict Validation: Ensures data quality with type checks, constraints, and range validation.
  • Rich Types: Built-in support for datetime (ISO 8601), url, file, and standard primitives.
  • Functional API: Pure functions and immutable dataclasses make pipelines predictable.
  • Zero Boilerplate: No complex class definitions—just load your schema and go.

Installation

pip install aptoro

Quick Start

from aptoro import load, load_schema, read, validate, to_json

# All-in-one: read + validate
entries = load(source="data.csv", schema="schema.yaml")

# Or step by step pipeline:
schema = load_schema("schema.yaml")
data = read("data.csv")
entries = validate(data, schema)

# Export to JSON
json_str = to_json(entries)

# Export with embedded metadata (self-describing files)
json_meta = to_json(entries, schema=schema, include_meta=True)

Documentation

For full details on the schema language, advanced validation, and API reference, see the Documentation.

Schema Language

Define your data schema in YAML:

name: lexicon_entry
description: Dictionary entries

fields:
  id: str
  lemma: str
  pos: str[noun|verb|adj|adv]     # Constrained values (Enum)
  definition: str
  translation: str?               # Optional field
  examples: list[str]?            # Optional list
  frequency: int = 0              # Default value
  created_at: datetime?           # Optional ISO 8601 datetime
  source_url: url?                # Optional URL

Type Syntax

  • Basic types: str, int, float, bool
  • Specialized types: url, file, datetime
  • Optional: str?, int?, url?, datetime?
  • Default value: str = "default", int = 0, datetime = "2024-01-01"
  • Constrained: str[a|b|c]
  • Lists: list[str], list[int]

See DOCS.md for full syntax, including inheritance and nested structures.

Supported Formats

  • CSV (auto-detects types)
  • JSON
  • YAML
  • TOML

License

GNU General Public License v3 (GPLv3)

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

aptoro-0.3.0.tar.gz (44.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aptoro-0.3.0-py3-none-any.whl (36.2 kB view details)

Uploaded Python 3

File details

Details for the file aptoro-0.3.0.tar.gz.

File metadata

  • Download URL: aptoro-0.3.0.tar.gz
  • Upload date:
  • Size: 44.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for aptoro-0.3.0.tar.gz
Algorithm Hash digest
SHA256 3763342b5d7171ecdfccc3ad000e7179dfbb3cb5010e21a14ba982f12ea7b814
MD5 828b9a3f5406ace93a8dafe566ef861b
BLAKE2b-256 77bbf1bd20c51d88ef998786bcfd4ae0da6aa777d68d321161fcded210a12342

See more details on using hashes here.

File details

Details for the file aptoro-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: aptoro-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 36.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for aptoro-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4acfc17afcd4aa456b2ef7f7282225bbf648ff9b164a6e9bb716739923f04dc6
MD5 84687cfcb1a4a38909669281fc417117
BLAKE2b-256 0ee7d3bfa7e66966df42bae4d9a30150cd0a679ff92c439e21ac58d80a9246c6

See more details on using hashes here.

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