fastgrpc proto
Print the generated .proto schema to stdout.
Arguments
| Argument | Default | Description |
|---|---|---|
<file> |
required | Path to the Python file containing your @service classes |
--package |
fastgrpc |
Protobuf package declaration in the output |
Example
$ fastgrpc proto main.py
syntax = "proto3";
package fastgrpc;
message GetUserRequest {
int64 user_id = 1;
}
message User {
int64 id = 1;
string name = 2;
}
service UserService {
rpc GetUser (GetUserRequest) returns (User);
}
Common patterns
Pipe to a file:
Pipe to a clipboard (macOS):
Custom package name for a clients repo:
Behavior
fastgrpc proto runs the same codegen pipeline as dev and run — including the lock pass — so:
- Field numbers are stable across runs (consults
.fastgrpc.lock) - New fields get tombstoned-aware numbers (never reuses removed slots)
- The schema you print is byte-identical to what a running server would expose
The command does not start a server, does not compile stubs, and does not write any files other than .fastgrpc.lock (which it updates if you've added or removed fields).
When to use this vs compile
| Use case | Command |
|---|---|
| Quick inspection from the terminal | fastgrpc proto |
| Pipe into another tool | fastgrpc proto |
| Hand the schema to a client team that doesn't use Python | fastgrpc proto > file.proto |
| Hand a client team a Python-importable bundle | fastgrpc compile --out ./bundle/ |