Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to generate GRPC interface for Python? #8325

Open
JaydenFish opened this issue May 30, 2024 · 8 comments
Open

Unable to generate GRPC interface for Python? #8325

JaydenFish opened this issue May 30, 2024 · 8 comments

Comments

@JaydenFish
Copy link

JaydenFish commented May 30, 2024

Do I have to use protobuf with grpc?
flatc version 24.3.25 with a simple fbs:

namespace models;

table HelloReply {
  message:string;
}

table HelloRequest {
  name:string;
}

table ManyHellosRequest {
  name:string;
  num_greetings:int;
}

rpc_service Greeter {
  SayHello(HelloRequest):HelloReply;
  SayManyHellos(ManyHellosRequest):HelloReply (streaming: "server");
}

and run flatc -c -p --grpc -o api/ include/fbs/greeter.fbs
output is

error:
  Unable to generate GRPC interface for Python
@fliiiix
Copy link
Contributor

fliiiix commented Jun 2, 2024

I tried to reproduce this and build tags/v24.3.25.
and your example works fine for me.

$ cat include/fbs/greeter.fbs
namespace models;

table HelloReply {
  message:string;
}

table HelloRequest {
  name:string;
}

table ManyHellosRequest {
  name:string;
  num_greetings:int;
}

rpc_service Greeter {
  SayHello(HelloRequest):HelloReply;
  SayManyHellos(ManyHellosRequest):HelloReply (streaming: "server");
}
$ ../flatc -c -p -o api/ include/fbs/greeter.fbs
$ ls
api  include

@JaydenFish
Copy link
Author

I tried to reproduce this and build tags/v24.3.25. and your example works fine for me.

$ cat include/fbs/greeter.fbs
namespace models;

table HelloReply {
  message:string;
}

table HelloRequest {
  name:string;
}

table ManyHellosRequest {
  name:string;
  num_greetings:int;
}

rpc_service Greeter {
  SayHello(HelloRequest):HelloReply;
  SayManyHellos(ManyHellosRequest):HelloReply (streaming: "server");
}
$ ../flatc -c -p -o api/ include/fbs/greeter.fbs
$ ls
api  include

This is not with grpc.

@JaydenFish
Copy link
Author

Looks like flatbuffer+grpc doesn't support python.
I fallback to probobuf.

@fliiiix
Copy link
Contributor

fliiiix commented Jun 3, 2024

Ahh you didn't add --grpc in your initial bug report
image

but yeah with this flag i can reproduce it 👍

Looks like flatbuffer+grpc doesn't support python.

I don't think that is true we use flatbuffer with grpc at work 😅

I think it's just broken in a recent version if it wouldn't be supported the error message is more along the lines of GRPC interface generator not implemented for

@mustiikhalil
Copy link
Collaborator

mustiikhalil commented Jun 3, 2024

@JaydenFish

Hey, thanks for opening this issue. I think there is a known issue with python with directories which can be found here: #8074

However following your own example:

Using the following flag flatc -c -p --grpc api/include/fbs/m.fbs. I removed the -o flag since its the cause of the issue to begin with, and the spacing between api/ include.

@JaydenFish
Copy link
Author

Thanks!

@JaydenFish
Copy link
Author

JaydenFish commented Jun 4, 2024

图片
Sometimes it go wrong. Sometime it works correctly. It's weird.
图片

I have a Makefile about fbs:

%.grpc.fb.h: %.fbs
    flatc -c --grpc -o $(dir $*) $^
    flatc -p --grpc -o api       $^
    prename 's/\.cc$//.cpp/' $(dir $*)*.cc

@JaydenFish
Copy link
Author

And this is weird. The command specify write output to pyapi and generated, but it generate helloworld_grpc_fb.py in current dir.
图片

@JaydenFish JaydenFish reopened this Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants