Skip to content
Open
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
34 changes: 34 additions & 0 deletions .github/workflows/proto-verify.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Proto generation check

on:
pull_request:
paths:
- 'src/sap_cloud_sdk/core/auditlog_ng/proto/**'
- 'src/sap_cloud_sdk/core/auditlog_ng/buf.yaml'
- 'src/sap_cloud_sdk/core/auditlog_ng/buf.gen.yaml'
- 'src/sap_cloud_sdk/core/auditlog_ng/gen/**'
- 'src/buf/**'
- 'Makefile'
push:
branches: [main]
paths:
- 'src/sap_cloud_sdk/core/auditlog_ng/proto/**'
- 'Makefile'

jobs:
verify-proto:
name: Verify generated proto code is up-to-date
runs-on: ubuntu-latest

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Install buf
uses: bufbuild/buf-setup-action@v1

- name: Regenerate proto code
run: make proto

- name: Check for uncommitted changes
run: git diff --exit-code
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Proto code generation for SAP Cloud SDK for Python
# Requires: buf CLI (https://buf.build/docs/installation)

AUDITLOG_NG_DIR := src/sap_cloud_sdk/core/auditlog_ng
GEN_DIR := $(AUDITLOG_NG_DIR)/gen
BUF_DIR := src/buf

.PHONY: proto

proto:
cd $(AUDITLOG_NG_DIR) && buf dep update && buf generate --include-imports
find $(GEN_DIR) -type d -exec touch {}/__init__.py \;
rm -rf $(BUF_DIR)
mv $(GEN_DIR)/buf $(BUF_DIR)
rm -rf $(GEN_DIR)/buf
22 changes: 20 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,19 @@ dependencies = [
"opentelemetry-processor-baggage~=0.61b0",
"traceloop-sdk~=0.52.0",
"PyJWT~=2.10.1",
"protobuf>=4.25.0",
"protovalidate>=0.13.0",
"grpcio>=1.60.0",
"opentelemetry-api>=1.28.0",
"opentelemetry-sdk>=1.28.0",
]

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.build.targets.wheel]
packages = ["src/sap_cloud_sdk"]
packages = ["src/sap_cloud_sdk", "src/buf"]

[dependency-groups]
dev = [
Expand All @@ -50,6 +55,8 @@ source = ["src"]
omit = [
"*/tests/*",
"*/test_*",
"*/sap_cloud_sdk/core/auditlog_ng/gen/*",
"*/buf/*"
]
skip_empty = true

Expand All @@ -64,7 +71,9 @@ exclude = [
"build",
"dist",
"venv",
"tests/"
"tests/",
"src/sap_cloud_sdk/core/auditlog_ng/gen",
"src/buf"
]

# Same as Black.
Expand All @@ -86,5 +95,14 @@ indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "auto"

[tool.ty]

[tool.ty.environment]
python-version = "3.11"

[tool.ty.src]
include = ["src", "tests"]
exclude = [
"src/sap_cloud_sdk/core/auditlog_ng/gen",
"src/buf",
]
Empty file added src/buf/__init__.py
Empty file.
Empty file added src/buf/validate/__init__.py
Empty file.
465 changes: 465 additions & 0 deletions src/buf/validate/validate_pb2.py

Large diffs are not rendered by default.

Loading
Loading