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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

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

Hashes for protools-1.0.2.tar.gz
Algorithm Hash digest
SHA256 3580b726cf8d9eb360bb7d125829c91b95bdee8a69ec39a77eb42b5acb3626ad
MD5 70b78049993b4079d309f0bad9c810dd
BLAKE2b-256 6121a4e26fddec365e3f19f5bcee52f2e878feaba4e9dcf27616caa47f79e03e

See more details on using hashes here.

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

Hashes for protools-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1cff9df93628a82bffae6cd01b262dba7a7c8f7203931c8e2fc2227c3949cb2d
MD5 21c6b58a575325504e520f69e6c693c4
BLAKE2b-256 f8d36f9d5d386c84e4e0060abfd18d7564d2b800e2b3c598907c50f485254c33

See more details on using hashes here.

Supported by

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