一个实现了批量将 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
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file protools-1.0.2.tar.gz.
File metadata
- Download URL: protools-1.0.2.tar.gz
- Upload date:
- Size: 14.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3580b726cf8d9eb360bb7d125829c91b95bdee8a69ec39a77eb42b5acb3626ad
|
|
| MD5 |
70b78049993b4079d309f0bad9c810dd
|
|
| BLAKE2b-256 |
6121a4e26fddec365e3f19f5bcee52f2e878feaba4e9dcf27616caa47f79e03e
|
File details
Details for the file protools-1.0.2-py3-none-any.whl.
File metadata
- Download URL: protools-1.0.2-py3-none-any.whl
- Upload date:
- Size: 14.2 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1cff9df93628a82bffae6cd01b262dba7a7c8f7203931c8e2fc2227c3949cb2d
|
|
| MD5 |
21c6b58a575325504e520f69e6c693c4
|
|
| BLAKE2b-256 |
f8d36f9d5d386c84e4e0060abfd18d7564d2b800e2b3c598907c50f485254c33
|