A short description of your package
Project description
aipproto
TL;DR - Helper for generating AIP proto files.
The AIPs are a wonderful style guide for building APIs. However, AIP compliant proto files are a bit cumbersome to create and maintain. This python package makes it easy to define hierarchies of AIP resources and then generate the corresponding proto files that define the AIP APIs for those resources.
Installation
pip install aipproto
Usage
import aipproto
# Define the resource hierarchy for your API.
namespace = aipproto.Namespace("api.domain.com")
foo = namespace.resource("Foo")
bar = foo.nest("Bar")
# Generate the proto content.
content = aipproto.generate_file_content(
package="domain.api.v1",
service_name="TestService",
resource_types=[foo, bar],
)
# Save it to a file.
with open("domain/api/v1/service.autogen.proto", "w") as f:
f.write(content)
If this documentation is out of date, check out tests/test_generate.py or other tests in the tests/ directory.
Conformance testing
To ensure that this package generates protos that conform to the AIP definitions, we run the api-linter on the generated proto files.
The following command is used to run the tests:
pytest && \
bazel build tests/testdata/v1:golden_proto_descriptor_set && \
api-linter --descriptor-set-in bazel-bin/tests/testdata/v1/golden_proto_descriptor_set.pb tests/testdata/v1/golden.proto --output-format github
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
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 aipproto-0.0.2.tar.gz.
File metadata
- Download URL: aipproto-0.0.2.tar.gz
- Upload date:
- Size: 25.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
892d4b78b3d70081c7247f415511cc99900c18d72f45449f606d296df566ebcf
|
|
| MD5 |
47c150843b241ef6300fedad9a96d037
|
|
| BLAKE2b-256 |
710031d075d62538ef2b90942efbeb2b1a2596dc8d1712e08302400dde0bd808
|
File details
Details for the file aipproto-0.0.2-py3-none-any.whl.
File metadata
- Download URL: aipproto-0.0.2-py3-none-any.whl
- Upload date:
- Size: 17.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3d979555be16c45fcb2f08e363e1e16e416a07cc39a5ed644c581a50d32558a1
|
|
| MD5 |
1525061f2a76c739931a21f7fbe61a60
|
|
| BLAKE2b-256 |
90b2bf21cf79206d6d58148221481e3a812cff5e36f025bd3084bce649bdde4f
|