Install & Compatibility
Where this runs
tested against v0.1.5 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.940 runs
installs and imports cleanly · install 0.0s · import 0.392s · 24.1MB
glibcpy 3.10–3.940 runs
installs and imports cleanly · install 2.9s · import 0.347s · 25MB
22MB installed
● package 22MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Message
✓ from aristaproto import Message
✗ import aristaproto
ABC
✓ from aristaproto import ABC
Enum
✓ from aristaproto import Enum
This quickstart demonstrates compiling a simple `.proto` file and then importing and using the generated Python message classes for creation, serialization to JSON, and deserialization from JSON. It requires `protoc` to be installed and accessible in your PATH, or `grpcio-tools` if using the Python `grpc_tools.protoc` module for compilation.
# 1. Create a .proto file (e.g., example.proto)
# syntax = "proto3";
# package hello;
# message Greeting {
# string message = 1;
# }
# 2. Compile the .proto file (assuming 'example.proto' is in current dir)
# mkdir -p lib
# protoc -I . --python_aristaproto_out=lib example.proto
# OR using grpcio-tools (after pip install grpcio-tools):
# python -m grpc_tools.protoc -I . --python_aristaproto_out=lib example.proto
# 3. Use the generated code (e.g., from lib/hello/__init__.py)
import os
import sys
# Add the 'lib' directory to Python path if not already added
# In a real project, 'lib' would likely be part of your package structure
# or installed.
if os.path.exists('lib') and 'lib' not in sys.path:
sys.path.insert(0, 'lib')
from hello import Greeting
g = Greeting(message="Hello, Arista!")
print(f"Created message: {g.message}")
# Example of serialization
json_output = g.to_json()
print(f"JSON representation: {json_output}")
# Example of deserialization
g_from_json = Greeting.from_json(json_output)
print(f"Message from JSON: {g_from_json.message}")
arista-protoc --version
Debug
Known issues
breakingPython versions older than 3.9 are no longer supported. Attempting to install or run on older versions will fail.fixUpgrade your Python environment to 3.9 or newer.
affects: All versions >= 0.1.0 (after the fork from betterproto)
gotcha`aristaproto` is a fork of `python-betterproto`. While many concepts are similar, direct migrations may require adjustments due to renaming, specific behavior changes (e.g., Timestamp handling), and updated dependencies.fixReview the `aristaproto` GitHub README for a list of changes compared to the base project, especially regarding `Timestamp` precision and `serialized_on_wire` behavior.
affects: All versions
gotchaThe `aristaproto.serialized_on_wire()` function only supports checking if Proto 3 *message* fields were sent on the wire. It cannot be used to determine if *scalar* fields (like strings, integers) were explicitly sent or are just default values.fixBe aware of this limitation when designing your protobuf messages and logic. For scalar fields, you might need to use wrapper types (e.g., `google.protobuf.StringValue`) if differentiating between unset and default values is critical.
affects: All versions
gotchaWhen using the `--python_aristaproto_opt=pydantic_dataclasses` option for Pydantic model generation, you must explicitly install `pydantic` in your project. It is not included by default with `aristaproto`.fixEnsure `pydantic` is listed as a dependency in your project (e.g., `pip install pydantic`).
affects: All versions supporting Pydantic dataclass generation
Upgrade
Version history
0.1.5latest on PyPI · released Jun 9, 2026
Audit
Dependencies
grpcio-toolsoptionalRequired for invoking protoc via `python -m grpc_tools.protoc` to compile .proto files.
pydanticoptionalRequired when generating Pydantic dataclasses using the `--python_aristaproto_opt=pydantic_dataclasses` option.