一个实现了批量将 protobuf 数据自动识别为类 json 格式,批量将 proto 定义文件转为 python 类。适用于需要转换大量的 protobuf 数据或 proto 定义文件。
Project description
protools
一个实现了批量将**protobuf
数据自动识别为类json
格式**,批量将**proto
定义文件转为python
类**。
适用于需要转换大量的**protobuf
数据或proto
定义文件**。
暂时只在
Windows 10 x64
、Ubuntu 20.04 x64
的中文环境下做过测试,其他系统或语言环境如有问题欢迎提交issue。
install
pip install protools
use
python -m protools -f ... -i ... -o ...
protools -f ... -i ... -o ...
其中-f
可选参数有b2j
[buf2json
]、p2p
[proto2python
]。
其中-i
是输入文件夹,-o
是输出文件夹,其合法关系有一对一
、多对一
、多对多
,当使用多对多
关系时,应确保输入文件夹和输出文件夹一一对应(见demo2)。
demo
- 将
data
和net
文件夹中所有文件当作**protobuf
数据批量自动识别为类json
格式**并写入到json
文件夹。protools -f b2j -i data -i net -o json
- 将
data
和net
文件夹中所有文件当作**protobuf
数据批量自动识别为类json
格式**并分别写入到data_json
和net_json
文件夹。protools -f b2j -i data -i net -o data_json -o net_json
- 将
proto
文件夹中的所有文件当作**proto
定义文件批量转为python
类**并写入到python
文件夹。protools -f p2p -i proto -o python
License
Project details
Release history Release notifications | RSS feed
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.1.tar.gz
(14.0 MB
view hashes)
Built Distribution
protools-1.0.1-py3-none-any.whl
(14.2 MB
view hashes)