Validate and translate Logical Query Protocol (LQP) S-expressions into Protobuf
Actively maintained. Last release 4 weeks ago, commits in 10 of the last 26 weeks. A safe choice.
pip install lqpLQP Python SDK
Python SDK for the Logical Query Protocol (LQP). Provides ProtoBuf bindings, a parser and pretty-printer for the human-readable S-expression syntax, and a CLI for converting between S-expression and ProtoBuf formats.
Installation
The lqp package is available on PyPI. Install it with
uv add lqp
or, equivalently, pip install lqp.
CLI Usage
To run the CLI without installing it into your project, use uvx:
uvx lqp --help
usage: lqp [-h] [-v] [--no-validation] [--out] [--bin | --json | --lqp] input
Parse, validate, and translate LQP files.
positional arguments:
input .lqp or .bin file, or a directory
options:
-h, --help show this help message and exit
-v, --version show program's version number and exit
--no-validation skip validation
--out write output to stdout
--bin write protobuf binary output
--json write protobuf JSON output
--lqp pretty-print LQP output
Examples
lqp --no-validation --bin --json foo/bar.lqp
Will create two files in foo/ named bar.bin and bar.json containing the binary and JSON encodings of the parsed ProtoBuf.
In this case, the parser will not go through the client-side validations we do to check for well-formed LQP.
lqp --bin --json foo
This will look for .lqp files both at the top-level and inside an lqp subdirectory.
Then it will organize the generated binary and JSON into folders, as well as the original found files. So, for example, if foo has this structure:
foo/
| bar.lqp
| lqp/
| | baz.lqp
Then after executing the above command, it should have this structure:
foo/
| bin/
| | bar.bin
| | baz.bin
| json/
| | bar.json
| | baz.json
| lqp/
| | bar.lqp
| | baz.lqp
lqp --bin --out foo.lqp
Will write the ProtoBuf binary parsed from the foo.lqp to stdout. The result can be piped
into the desired output file, e.g., lqp --bin --out foo.lqp > foo.bin.