Skip to main content

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, dict, nested objects, and standard primitives.
  • Multi-Format: CSV, JSON, YAML, TOML, and Markdown front-matter (Jekyll/Hugo/Obsidian style).
  • Glob Patterns: Read multiple files at once with read("data/*.md").
  • 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

CLI Usage

Aptoro provides a command-line interface for validating data files directly.

# Validate a CSV file against a schema
aptoro validate data.csv --schema schema.yaml

# Explicitly specify format
aptoro validate data.txt --schema schema.yaml --format json

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, list[str] = [], dict[str, int] = {}
  • Constrained: str[a|b|c]
  • Ranges: int[0..120], float[0.0..1.0]
  • Lists: list[str], list[int]
  • Dicts: dict, dict[str, int], dict[str]
  • Nested objects: type: object with fields block

See DOCS.md for full syntax, including inheritance, nested structures, and front-matter reading.

Supported Formats

  • CSV (auto-detects types)
  • JSON
  • YAML
  • TOML
  • Markdown front-matter (.md files with YAML front matter)

License

GNU General Public License v3 (GPLv3)

Metadata

Release files for aptoro 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aptoro 0.5.0
File Size Uploaded
aptoro-0.5.0.tar.gz 7.4 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for aptoro 0.5.0
File Interpreter ABI Platform
aptoro-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 7.5 MB

Release files / aptoro-0.5.0.tar.gz

Download URL aptoro-0.5.0.tar.gz
Size 7.4 MB
Tags Source
SHA-256 checksum
How to use checksums
3ab62934ce15601c853b8a58d0d723460fc1bb15d4d717c8963a714a63ea3629
BLAKE2b-256 checksum
How to use checksums
3d4b63ff253a3a5bc11a2dd21672f9f5b0b6c9c17820f5814483b5066ef4c966
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release files / aptoro-0.5.0-py3-none-any.whl

Download URL aptoro-0.5.0-py3-none-any.whl
Size 40.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f5db818684b9ecc25161c42303817bc80c84cc8a54413240160b3e9e48a56a18
BLAKE2b-256 checksum
How to use checksums
ccbdd71f1cb19411f11a2accdcbe26246235d18706c7934e2447346ebbcf07a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page