Skip to content
filipsnastinsPublic

About

Python bindings for jaq, a jq clone written in Rust

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

jaq-py

Python bindings for jaq, a jq clone written in Rust.

Note

This project was created as a learning exercise for building Python bindings with Rust and PyO3. It is not feature-complete and has not been tested in production.

Usage

import jaq_py

# Compile a filter and run it
prog = jaq_py.compile(".name")
result = prog.input_value({"name": "Alice"}).first()  # "Alice"

# Get all results
jaq_py.compile(".[] | . * 2").input_value([1, 2, 3]).all()  # [2, 4, 6]

# Use variables
prog = jaq_py.compile("$a + $b + .", args={"a": 100, "b": 20})
prog.input_value(3).first()  # 123

# Fast path with JSON string input
prog = jaq_py.compile(".name")
prog.input_text('{"name": "Bob"}').first()  # "Bob"

# Slurp multiple JSON values into an array
jaq_py.compile(".").input_text("1\n2\n3", slurp=True).first()  # [1, 2, 3]

# Get result as JSON string
jaq_py.compile(".").input_value({"a": 1}).text()  # '{"a":1}'

Performance

See performance/README.md for details.

Development

Requires Rust and Python 3.13+.

make install    # Install dependencies
make            # Format, build, lint, and test
make bench      # Run performance benchmarks

Acknowledgements

  • jaq - the underlying jq clone written in Rust
  • jq.py - inspiration for the Python API design

About

Python bindings for jaq, a jq clone written in Rust

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages