Skip to main content

一个实现了批量将 protobuf 数据自动识别为类 json 格式,批量将 proto 定义文件转为 python 类的命令行工具。适用于需要转换大量的 protobuf 数据或 proto 定义文件。

Project description

protools GitHub Repo stars GitHub Downloads PyPI Downloads

一个实现了批量将protobuf数据自动识别为json格式,批量将proto定义文件转为python的命令行工具。

适用于需要转换大量的protobuf数据proto定义文件

暂时只在Windows 10 x64Ubuntu 20.04 x64的中文环境下做过测试,其他系统或语言环境如有问题欢迎提交issue。

install

pip install protools

update

GitHub release (latest by date) PyPI

pip install --upgrade protools

use

python -m protools -f ... -i ... -o ...
protools -f ... -i ... -o ...

其中-f可选参数有b2j[buf2json]、p2p[proto2python]。 其中-i是输入文件夹,-o是输出文件夹,其合法关系有一对一多对一多对多,当使用多对多关系时,应确保输入文件夹和输出文件夹一一对应(见demo2)。

demo

  1. datanet文件夹中所有文件当作protobuf数据批量自动识别为json格式并写入到json文件夹。
    protools -f b2j -i data -i net -o json
    
    screenshot
  2. datanet文件夹中所有文件当作protobuf数据批量自动识别为json格式并分别写入到data_jsonnet_json文件夹。
    protools -f b2j -i data -i net -o data_json -o net_json
    
    screenshot
  3. proto文件夹中的所有文件当作proto定义文件批量转为python并写入到python文件夹。
    protools -f p2p -i proto -o python
    
    screenshot

License

GitHub License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

protools-1.0.2.tar.gz (14.0 MB view hashes)

Uploaded Source

Built Distribution

protools-1.0.2-py3-none-any.whl (14.2 MB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page