一个实现了批量将 protobuf 数据自动识别为类 json 格式,批量将 proto 定义文件转为 python 类的命令行工具。适用于需要转换大量的 protobuf 数据或 proto 定义文件。
Project description
protools
![PyPI Downloads](https://pypi-camo.freetls.fastly.net/cc220f25c9bc187fdf64931e634d71ba0e93d8f2/68747470733a2f2f696d672e736869656c64732e696f2f707970692f646d2f70726f746f6f6c733f6c6162656c3d50795049253230446f776e6c6f616473266c6f676f3d70797069267374796c653d736f6369616c)
一个实现了批量将protobuf
数据自动识别为类json
格式,批量将proto
定义文件转为python
类的命令行工具。
适用于需要转换大量的protobuf
数据或proto
定义文件。
暂时只在
Windows 10 x64
、Ubuntu 20.04 x64
的中文环境下做过测试,其他系统或语言环境如有问题欢迎提交issue。
install
pip install protools
update
pip install --upgrade 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.2.tar.gz
(14.0 MB
view hashes)
Built Distribution
protools-1.0.2-py3-none-any.whl
(14.2 MB
view hashes)