{"id":23444073,"url":"https://github.com/sevagh/pq","last_synced_at":"2025-04-04T10:09:51.580Z","repository":{"id":18179076,"uuid":"83675214","full_name":"sevagh/pq","owner":"sevagh","description":"a command-line Protobuf parser with Kafka support and JSON output","archived":false,"fork":false,"pushed_at":"2024-07-22T17:55:43.000Z","size":430,"stargazers_count":167,"open_issues_count":4,"forks_count":16,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-28T09:09:18.472Z","etag":null,"topics":["kafka","parser","protobuf"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sevagh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-03-02T12:27:14.000Z","updated_at":"2025-02-07T10:27:45.000Z","dependencies_parsed_at":"2025-01-27T23:10:36.005Z","dependency_job_id":"65e46d4f-c7bd-4478-8e34-5375ac9b1b5b","html_url":"https://github.com/sevagh/pq","commit_stats":null,"previous_names":[],"tags_count":54,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sevagh%2Fpq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sevagh%2Fpq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sevagh%2Fpq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sevagh%2Fpq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sevagh","download_url":"https://codeload.github.com/sevagh/pq/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247157283,"owners_count":20893220,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["kafka","parser","protobuf"],"created_at":"2024-12-23T18:26:22.454Z","updated_at":"2025-04-04T10:09:51.558Z","avatar_url":"https://github.com/sevagh.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# pq [![license](https://img.shields.io/github/license/sevagh/pq.svg)](https://github.com/sevagh/pq/blob/master/LICENSE) [![Crates.io](https://img.shields.io/crates/v/pq.svg)](https://crates.io/crates/pq)\n\n### protobuf to json deserializer, written in Rust\n\n`pq` is a tool which deserializes protobuf messages given a set of pre-compiled `.fdset` files. It can understand varint/leb128-delimited/i32be streams, and it can connect to Kafka.\n\n`pq` will pretty-print when outputting to a tty, but you should pipe it to `jq` for more fully-featured json handling.\n\n### Download\n\npq is on [crates.io](https://crates.io/crates/pq): `cargo install pq`. You can also download a static binary from the [releases page](https://github.com/sevagh/pq/releases).\n\n### Usage\n\n**new** You can now pass in a proto file and have pq compile it on the fly using `protoc`:\n\n```\n$ pq --protofile ./tests/protos/dog.proto  --msgtype com.example.dog.Dog \u003c./tests/samples/dog\n{\n  \"breed\": \"gsd\",\n  \"age\": 3,\n  \"temperament\": \"excited\"\n}\n```\n\nUse PROTOC and PROTOC_INCLUDE to control the executed protoc binary and configure the `-I=/proto/path` argument (design copied from [prost](https://github.com/danburkert/prost/blob/master/prost-build/src/lib.rs)).\n\nTo set up, put your `*.fdset` files in `~/.pq`, `/etc/pq`, or a different directory specified with the `FDSET_PATH` env var:\n\n```\n$ protoc -o dog.fdset dog.proto\n$ protoc -o person.fdset person.proto\n$ cp *.fdset ~/.pq/\n```\n\nYou can specify additional fdset directories or files via options:\n\n```\n$ pq --msgtype com.example.dog.Dog --fdsetdir ./tests/fdsets \u003c./tests/samples/dog\n$ pq --msgtype com.example.dog.Dog --fdsetfile ./tests/fdsets/dog.fdset \u003c./tests/samples/dog\n```\n\nPipe a single compiled protobuf message:\n\n```\n$ pq --msgtype com.example.dog.Dog \u003c./tests/samples/dog\n{\n  \"age\": 4,\n  \"breed\": \"poodle\",\n  \"temperament\": \"excited\"\n}\n```\n\nPipe a `varint` or `leb128` delimited stream:\n\n```\n$ pq --msgtype com.example.dog.Dog --stream varint \u003c./tests/samples/dog_stream\n{\n  \"age\": 10,\n  \"breed\": \"gsd\",\n  \"temperament\": \"aggressive\"\n}\n```\n\nConsume from a Kafka stream:\n\n```\n$ pq kafka my_topic --brokers 192.168.0.1:9092 --beginning --count 1 --msgtype com.example.dog.Dog\n{\n  \"age\": 10,\n  \"breed\": \"gsd\",\n  \"temperament\": \"aggressive\"\n}\n```\n\nConvert a Kafka stream to varint-delimited:\n\n```\n$ pq kafka my_topic --brokers=192.168.0.1:9092 --count 1 --convert varint |\\\n\u003e pq --msgtype com.example.dog.Dog --stream varint\n{\n  \"age\": 10,\n  \"breed\": \"gsd\",\n  \"temperament\": \"aggressive\"\n}\n```\n\nPipe `kafkacat` output to it:\n```\n$ kafkacat -b 192.168.0.1:9092 -C -u -q -f \"%R%s\" -t my_topic |\\\n\u003e pq --msgtype=com.example.dog.Dog --stream i32be\n{\n  \"age\": 10,\n  \"breed\": \"gsd\",\n  \"temperament\": \"aggressive\"\n}\n```\n\n### Compile without kafka\n\nTo compile `pq` without kafka support, run:\n\n```\n$ cargo build --no-default-features\n```\n\n### Compile for Windows\n\n1. Install [Visual Studio Installer](https://visualstudio.microsoft.com/downloads/) Community edition\n2. Run the installer and install `Visual Studio Build Tools 2019`. You need the `C++ Build Tools` workload. Note that you can't just install the minimal package, you also need `MSVC C++ x64/86 Build Tools` and `Windows 10 SDK`.\n3. Open `x64 Native Tools Command Prompt` from the start menu.\n4. Download and run [`rustup-init.exe`](https://win.rustup.rs/x86_64)\n5. Close and reopen your terminal (so `cargo` will be in your path)\n6. Run `cargo install --no-default-features pq`\n\nNote that this will disable the Kafka feature, which is not currently supported on Windows.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsevagh%2Fpq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsevagh%2Fpq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsevagh%2Fpq/lists"}