Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions codegen/opentelemetry-codegen-pyproto/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
opentelemetry-codegen-pyproto
=============================

A ``protoc`` plugin that generates pure-Python, encode-only protobuf-wire
message classes for the OpenTelemetry proto definitions.

The generated classes reproduce the behaviour of the hand-written
``opentelemetry._proto.*_pb2`` modules: every message inherits the
``Message`` base from ``opentelemetry._proto._pyprotobuf.message`` and
implements ``SerializeToString`` using the field helpers in
``opentelemetry._proto._pyprotobuf.fields``.

Usage
-----

Install the plugin so ``protoc-gen-pyproto`` is on ``PATH``, then run::

python -m grpc_tools.protoc \
-I /path/to/opentelemetry-proto \
--pyproto_out=OUTPUT_DIR \
/path/to/opentelemetry-proto/opentelemetry/proto/common/v1/common.proto
49 changes: 49 additions & 0 deletions codegen/opentelemetry-codegen-pyproto/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "opentelemetry-codegen-pyproto"
version = "0.0.0" # Not published to PyPI
description = "Protobuf plugin to generate pure-Python encode-only wire serializers for OpenTelemetry protobuf messages"
readme = "README.rst"
license = "Apache-2.0"
requires-python = ">=3.10"
authors = [
{ name = "OpenTelemetry Authors", email = "cncf-opentelemetry-contributors@lists.cncf.io" },
]
classifiers = [
"Development Status :: 4 - Beta",
"Framework :: OpenTelemetry",
"Intended Audience :: Developers",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Private :: Do Not Upload",
]
dependencies = [
"protobuf>=4.25.3",
"types-protobuf>=4.24",
]

[project.scripts]
protoc-gen-pyproto = "opentelemetry.codegen.pyproto.plugin:main"

[project.urls]
Homepage = "https://github.com/open-telemetry/opentelemetry-python/tree/main/codegen/opentelemetry-codegen-pyproto"
Repository = "https://github.com/open-telemetry/opentelemetry-python"

[tool.hatch.version]
path = "src/opentelemetry/codegen/pyproto/version/__init__.py"

[tool.hatch.build.targets.sdist]
include = [
"/src",
]

[tool.hatch.build.targets.wheel]
packages = ["src/opentelemetry"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0
Loading
Loading