Metadata-Version: 2.4
Name: jsonatapy
Version: 2.1.0
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Rust
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Text Processing :: Filters
Classifier: Typing :: Typed
Requires-Dist: jsonata>=0.2.0 ; extra == 'bench'
Requires-Dist: rich>=13.0 ; extra == 'bench'
Requires-Dist: matplotlib>=3.5 ; extra == 'bench'
Requires-Dist: pytest>=7.0 ; extra == 'dev'
Requires-Dist: pytest-cov>=4.0 ; extra == 'dev'
Requires-Dist: pytest-xdist>=3.0 ; extra == 'dev'
Requires-Dist: ruff>=0.3.0 ; extra == 'dev'
Requires-Dist: mypy>=1.0 ; extra == 'dev'
Requires-Dist: maturin>=1.0 ; extra == 'dev'
Requires-Dist: mkdocs>=1.5 ; extra == 'docs'
Requires-Dist: mkdocs-material>=9.0 ; extra == 'docs'
Requires-Dist: mkdocstrings[python]>=0.24 ; extra == 'docs'
Requires-Dist: pymdown-extensions>=10.0 ; extra == 'docs'
Provides-Extra: bench
Provides-Extra: dev
Provides-Extra: docs
License-File: LICENSE
Summary: High-performance Python implementation of JSONata query and transformation language
Keywords: jsonata,json,query,transform
Home-Page: https://github.com/yourusername/jsonatapy
Author-email: txjmb <txjmb@users.noreply.github.com>
License: MIT
Requires-Python: >=3.10
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Bug Tracker, https://github.com/txjmb/jsonatapy/issues
Project-URL: Documentation, https://github.com/txjmb/jsonatapy
Project-URL: Homepage, https://github.com/txjmb/jsonatapy
Project-URL: Repository, https://github.com/txjmb/jsonatapy

# jsonatapy

High-performance Python implementation of [JSONata](https://jsonata.org/) - the JSON query and transformation language.

[![PyPI version](https://badge.fury.io/py/jsonatapy.svg)](https://pypi.org/project/jsonatapy/)
[![Python versions](https://img.shields.io/pypi/pyversions/jsonatapy.svg)](https://pypi.org/project/jsonatapy/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

## Overview

jsonatapy is a Rust-based Python extension implementing JSONata directly in Rust for native performance.

- **Full JSONata 2.1.0 Support** - 1258/1258 reference tests passing
- **Native Python API** - Type hints, zero JavaScript dependencies
- **Cross-Platform** - Linux, macOS (Intel & ARM), Windows
- **Production Ready** - Comprehensive test suite and error handling

## Installation

```bash
pip install jsonatapy
```

Supports Python 3.10, 3.11, 3.12, 3.13 on all major platforms.

## Quick Start

```python
import jsonatapy

# Simple query
data = {"name": "World"}
result = jsonatapy.evaluate('"Hello, " & name', data)
print(result)  # "Hello, World"

# Compile once, reuse many times
expr = jsonatapy.compile("orders[price > 100].product")
result = expr.evaluate(data)

# Complex transformation
data = {
    "orders": [
        {"product": "Laptop", "quantity": 2, "price": 1200},
        {"product": "Mouse", "quantity": 5, "price": 25},
        {"product": "Keyboard", "quantity": 3, "price": 75}
    ]
}

result = jsonatapy.evaluate("$sum(orders.(quantity * price))", data)
print(result)  # 2750
```

## What is JSONata?

JSONata is a query and transformation language for JSON:

- **Query** - Extract data: `person.name`
- **Filter** - Select items: `products[price > 50]`
- **Transform** - Reshape data: `items.{"name": title, "cost": price}`
- **Aggregate** - Calculate: `$sum(orders.total)`
- **Conditionals** - Logic: `price > 100 ? "expensive" : "affordable"`

See [official JSONata docs](https://docs.jsonata.org/) for language reference.

## Features

### JSONata 2.1.0 Specification

- Path expressions and queries
- Array filtering and mapping
- Lambda functions and higher-order functions
- Object construction and transformation
- Built-in functions (string, numeric, array, object)
- Conditional expressions

### Python API

```python
# One-off evaluation
result = jsonatapy.evaluate(expression, data)

# Compiled expressions (faster for repeated use)
expr = jsonatapy.compile(expression)
result = expr.evaluate(data)

# Check version
print(jsonatapy.__version__)  # 2.1.0
```

## Documentation

- [Installation](docs/installation.md) - Setup and requirements
- [API Reference](docs/api.md) - Complete Python API
- [Usage Guide](docs/usage.md) - Examples and patterns
- [Performance](docs/performance.md) - Benchmarks
- [Building](docs/development/building.md) - Development setup

## Use Cases

- API response transformation
- ETL pipelines and data processing
- Configuration file processing
- Data filtering and aggregation

## Building from Source

```bash
# Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# Install maturin
pip install maturin

# Build and install
git clone https://github.com/txjmb/jsonatapy.git
cd jsonatapy
maturin develop --release
```

See [Building Guide](docs/development/building.md) for details.

## Testing

```bash
# Install dependencies
uv pip install --system pytest pytest-xdist

# Run tests
pytest tests/python/ -v
```

## Contributing

Contributions welcome! See [CLAUDE.MD](CLAUDE.MD) for architecture guidelines.

## License

MIT License - See [LICENSE](LICENSE) for details.

This project implements the JSONata specification. JSONata and the reference implementation [jsonata-js](https://github.com/jsonata-js/jsonata) are also MIT licensed.

## Acknowledgments

- JSONata team for the specification and reference implementation
- Rust and PyO3 communities

