protobuf-init


Nameprotobuf-init JSON
Version 0.3.0 PyPI version JSON
download
home_pagehttps://github.com/crflynn/protobuf-init
Summarygenerate __init__.py files for protobuf projects
upload_time2022-12-07 20:37:30
maintainer
docs_urlNone
authorflynn
requires_python>=3.8
licenseMIT
keywords protobuf protocol buffers protoc plugin
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # protobuf-init

To install:

```bash
pip install protobuf-init
```

This package will create `__init__.py` files when compiling `*.proto` files. Optionally, it will create relative imports from generated `*_pb.py`, `*_pb_grpc.py`, and `*_grpc.py` files from `protobuf`, `grpcio`, and `grpclib` packages, respectively.

Using the `protos` folder of this project as an example, the following command will generate the contents of the `example` package, also in this project (assuming `grpcio-tools` is installed):

```bash
export PROTO_PATH=./protos
export GEN_PATH=.
python -m grpc_tools.protoc \
    --python_out=$GEN_PATH \
    --mypy_out=$GEN_PATH \
    --init_python_out=$GEN_PATH \
    --init_python_opt=imports=protobuf+grpcio+grpclib \
    --grpc_python_out=$GEN_PATH \
    --grpclib_python_out=$GEN_PATH \
    --proto_path=$PROTO_PATH 
    $(find $PROTO_PATH -name '*.proto')
```

The `--init_python_out=$GEN_PATH` flag indicates to call the plugin to create the init files.

The `--init_python_opt=imports=protobuf+grpcio+grpclib` indicates which relative imports to include in the init files. Allowed options are `protobuf`, `grpcio`, `grpclib`, separated by `+`. (Note that both grpcio and grpclib generate `<ServiceName>Stub` objects which would collide in the init file.)
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/crflynn/protobuf-init",
    "name": "protobuf-init",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "protobuf,protocol,buffers,protoc,plugin",
    "author": "flynn",
    "author_email": "crf204@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/fd/ab/970da5fd09b1002325db3c72acee25d22eefec47bec51f7434bac2b39758/protobuf-init-0.3.0.tar.gz",
    "platform": null,
    "description": "# protobuf-init\n\nTo install:\n\n```bash\npip install protobuf-init\n```\n\nThis package will create `__init__.py` files when compiling `*.proto` files. Optionally, it will create relative imports from generated `*_pb.py`, `*_pb_grpc.py`, and `*_grpc.py` files from `protobuf`, `grpcio`, and `grpclib` packages, respectively.\n\nUsing the `protos` folder of this project as an example, the following command will generate the contents of the `example` package, also in this project (assuming `grpcio-tools` is installed):\n\n```bash\nexport PROTO_PATH=./protos\nexport GEN_PATH=.\npython -m grpc_tools.protoc \\\n    --python_out=$GEN_PATH \\\n    --mypy_out=$GEN_PATH \\\n    --init_python_out=$GEN_PATH \\\n    --init_python_opt=imports=protobuf+grpcio+grpclib \\\n    --grpc_python_out=$GEN_PATH \\\n    --grpclib_python_out=$GEN_PATH \\\n    --proto_path=$PROTO_PATH \n    $(find $PROTO_PATH -name '*.proto')\n```\n\nThe `--init_python_out=$GEN_PATH` flag indicates to call the plugin to create the init files.\n\nThe `--init_python_opt=imports=protobuf+grpcio+grpclib` indicates which relative imports to include in the init files. Allowed options are `protobuf`, `grpcio`, `grpclib`, separated by `+`. (Note that both grpcio and grpclib generate `<ServiceName>Stub` objects which would collide in the init file.)",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "generate __init__.py files for protobuf projects",
    "version": "0.3.0",
    "split_keywords": [
        "protobuf",
        "protocol",
        "buffers",
        "protoc",
        "plugin"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "9e157e7e473456b769771243378f7f2f",
                "sha256": "6c8aab0a0d070f8c82a4458958297141894e4fe60071118fe5b3b21e79a0cb13"
            },
            "downloads": -1,
            "filename": "protobuf_init-0.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9e157e7e473456b769771243378f7f2f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 4355,
            "upload_time": "2022-12-07T20:37:31",
            "upload_time_iso_8601": "2022-12-07T20:37:31.996728Z",
            "url": "https://files.pythonhosted.org/packages/a9/71/7dca8a064388366a996c8aad32e0d670257a16c34deb1381857dd049a0e8/protobuf_init-0.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "25c25e882cd1826ab05d34dc6102e6e5",
                "sha256": "742c6e5fde383fb5029147261edd66c41ce6d7939d36403ab76160b8f6ef5a34"
            },
            "downloads": -1,
            "filename": "protobuf-init-0.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "25c25e882cd1826ab05d34dc6102e6e5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 4231,
            "upload_time": "2022-12-07T20:37:30",
            "upload_time_iso_8601": "2022-12-07T20:37:30.076038Z",
            "url": "https://files.pythonhosted.org/packages/fd/ab/970da5fd09b1002325db3c72acee25d22eefec47bec51f7434bac2b39758/protobuf-init-0.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-07 20:37:30",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "crflynn",
    "github_project": "protobuf-init",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "protobuf-init"
}
        
Elapsed time: 0.14779s