Closed
Description
Description
one proto file gen go and python code. go run success, but python run get
ModuleNotFoundError: No module named 'buf'
Steps to Reproduce
- First step to reproduce the bug
proto
syntax = "proto3";
package my.package;
import "google/protobuf/timestamp.proto";
import "buf/validate/validate.proto";
message Transaction {
uint64 id = 1 [(buf.validate.field).uint64.gt = 999];
google.protobuf.Timestamp purchase_date = 2;
google.protobuf.Timestamp delivery_date = 3;
string price = 4 [(buf.validate.field).cel = {
id: "transaction.price",
message: "price must be positive and include a valid currency symbol ($ or £)",
expression: "(this.startswith('$') or this.startswith('£')) and float(this[1:]) > 0"
}];
option (buf.validate.message).cel = {
id: "transaction.delivery_date",
message: "delivery date must be after purchase date",
expression: "this.delivery_date > this.purchase_date"
};
}
- Second step to reproduce the bug
go use protoc to gen code and run sucess.
python use
python3 -m grpc_tools.protoc
to gen code and run falied
- Third step to reproduce the bug
... additional steps as needed
Expected Behavior
python run success.
Actual Behavior
ModuleNotFoundError: No module named 'buf'
Screenshots/Logs
Environment
- Operating System:
- Version:
- Compiler/Toolchain:
- Protobuf Compiler & Version:
- Protoc-gen-validate Version:
- Protovalidate Version: