• Stars
    star
    166
  • Rank 227,748 (Top 5 %)
  • Language
    Rust
  • License
    MIT License
  • Created over 7 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

a command-line Protobuf parser with Kafka support and JSON output

pq license Crates.io

protobuf to json deserializer, written in Rust

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.

pq will pretty-print when outputting to a tty, but you should pipe it to jq for more fully-featured json handling.

Download

pq is on crates.io: cargo install pq. You can also download a static binary from the releases page.

Usage

new You can now pass in a proto file and have pq compile it on the fly using protoc:

$ pq --protofile ./tests/protos/dog.proto  --msgtype com.example.dog.Dog <./tests/samples/dog
{
  "breed": "gsd",
  "age": 3,
  "temperament": "excited"
}

Use PROTOC and PROTOC_INCLUDE to control the executed protoc binary and configure the -I=/proto/path argument (design copied from prost).

To set up, put your *.fdset files in ~/.pq, /etc/pq, or a different directory specified with the FDSET_PATH env var:

$ protoc -o dog.fdset dog.proto
$ protoc -o person.fdset person.proto
$ cp *.fdset ~/.pq/

You can specify additional fdset directories or files via options:

$ pq --msgtype com.example.dog.Dog --fdsetdir ./tests/fdsets <./tests/samples/dog
$ pq --msgtype com.example.dog.Dog --fdsetfile ./tests/fdsets/dog.fdset <./tests/samples/dog

Pipe a single compiled protobuf message:

$ pq --msgtype com.example.dog.Dog <./tests/samples/dog
{
  "age": 4,
  "breed": "poodle",
  "temperament": "excited"
}

Pipe a varint or leb128 delimited stream:

$ pq --msgtype com.example.dog.Dog --stream varint <./tests/samples/dog_stream
{
  "age": 10,
  "breed": "gsd",
  "temperament": "aggressive"
}

Consume from a Kafka stream:

$ pq kafka my_topic --brokers 192.168.0.1:9092 --beginning --count 1 --msgtype com.example.dog.Dog
{
  "age": 10,
  "breed": "gsd",
  "temperament": "aggressive"
}

Convert a Kafka stream to varint-delimited:

$ pq kafka my_topic --brokers=192.168.0.1:9092 --count 1 --convert varint |\
> pq --msgtype com.example.dog.Dog --stream varint
{
  "age": 10,
  "breed": "gsd",
  "temperament": "aggressive"
}

Pipe kafkacat output to it:

$ kafkacat -b 192.168.0.1:9092 -C -u -q -f "%R%s" -t my_topic |\
> pq --msgtype=com.example.dog.Dog --stream i32be
{
  "age": 10,
  "breed": "gsd",
  "temperament": "aggressive"
}

Compile without kafka

To compile pq without kafka support, run:

$ cargo build --no-default-features

Compile for Windows

  1. Install Visual Studio Installer Community edition
  2. 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.
  3. Open x64 Native Tools Command Prompt from the start menu.
  4. Download and run rustup-init.exe
  5. Close and reopen your terminal (so cargo will be in your path)
  6. Run cargo install --no-default-features pq

Note that this will disable the Kafka feature, which is not currently supported on Windows.

More Repositories

1

pitch-detection

autocorrelation-based O(NlogN) pitch detection
C++
571
star
2

freemusicdemixer.com

free website for client-side music demixing with Demucs + WebAssembly
JavaScript
330
star
3

chord-detection

DSP algorithms for chord detection + key estimation
Python
109
star
4

demucs.cpp

C++17 port of Demucs v3 (hybrid) and v4 (hybrid transformer) models with ggml and Eigen3
C++
84
star
5

wireshark-dissector-rs

write wireshark dissectors in Rust via C FFI
Rust
47
star
6

audio-degradation-toolbox

easy-to-use implementation of the ISMIR 2013 Audio Degradation Toolbox
Python
46
star
7

umx.cpp

C++17 port of Open-Unmix-PyTorch with streaming LSTM inference, ggml, quantization, and Eigen
C++
33
star
8

OnAir-Music-Dataset

🎵 a new stem dataset for Music Demixing research, from the OnAir royalty-free music project
33
star
9

goat

AWS EBS-EC2 attach utility. UNMAINTAINED, SEE FORK ->
Go
28
star
10

xumx-sliCQ

music demixing with the sliCQ Transform and PyTorch
Python
26
star
11

Zen

optimized realtime harmonic/percussive source separation using the GPU (NVIDIA CUDA) and CPU (Intel IPP)
Cuda
20
star
12

Real-Time-HPSS

MATLAB + Python implementations of real-time median-filtering Harmonic-Percussive Source Separation
MATLAB
19
star
13

ape

XDP-based packet manipulation tool with Prometheus metrics
C
12
star
14

jitters

RTP jitter buffer implementation written in Rust with example sender and receiver programs
Rust
10
star
15

Music-Separation-TF

Music source separation testbench with various offline and realtime DSP and machine learning algorithms using the STFT, CQT, NSGT, sliCQT, WMDCT, and TFJigsaw
MATLAB
8
star
16

MiXiN

Music Xtraction with Nonstationary Gabor Transforms and Convolutional Denoising Autoencoders
Python
8
star
17

ElectroPARTYogram

⚡ 🎉 native C++ Android beat visualizer with BTrack, Oboe, Ne10, SFML
C++
8
star
18

transcribe

simplistic pitch-detection-based music transcriber
Python
7
star
19

xumx-sliCQ-V2

better music demixing with PyTorch and the sliCQT + interactive live GUI with ONNXRuntime
Python
7
star
20

surge

mpv + youtube-dl command line music player in Rust
Rust
7
star
21

libmetro

create custom metronomes - compound/simple/odd time signatures, polyrhythms, etc.
C++
6
star
22

headbang.py

consensus beat tracking and visualization in mixed metal songs, and headbanging motion analysis with 2D pose estimation
Python
5
star
23

warped-linear-prediction

perceptual audio codec/file format based on WLPC in a FLAC container
Python
4
star
24

music-demixing-challenge-ismir-2021

working repo for my xumx-sliCQ submissions to the ISMIR 2021 MDX
Python
4
star
25

multiband-transient-shaper

Bark frequency filterbank + SPL differential envelope follower transient shaper
MATLAB
4
star
26

Pitcha

the original pitch detection app for Android; see https://github.com/pitch-detection instead
Java
3
star
27

raft-badgerdb

Hashicorp Raft LogStore + StableStore backed by dgraph-io's BadgerDB
Go
3
star
28

quadtree-compression

lossy image compression with quadtrees and protobuf
Go
3
star
29

Scriptorium

OCR reading assistant with opencv, Tesseract, kraken, DAWGs and a splay tree
Python
2
star
30

pitchlite

realtime pitch tracking in WebAssembly with AudioWorklet
C++
2
star
31

go-sort

collection of tested Go integer sort algorithms
Go
2
star
32

sevagh

this is also houses the giscus discussions for sevag.xyz
2
star
33

beamer-presentation

my template for LaTeX/beamer presentations (for both academia and industry)
TeX
1
star
34

drum_machine

create click tracks from harmonixset annotations on the fly with libmetro, libsoundio, and stk
Go
1
star
35

MIR-presentations

grad school presentations on the topic of Music Information Retrieval
TeX
1
star
36

top-bar-clocks

top bar clocks extension in Gnome 3
JavaScript
1
star
37

xnetwork

simple graph library with slotmaps
Rust
1
star
38

xumx_slicq_extra

extra files for xumx-sliCQ
Python
1
star
39

mss-oracle-experiments

music source separation experiments with oracle performance and different spectrograms
Python
1
star