litestar-org / litestar-org/polyfactory
Enhancement: ProtobufFactory
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.5k
- Forks
- 120
- PR merge metrics
- No merged PRs in 30d
Description
### Summary
We use protobuf extensively in our python applications, and it would be super handy to be able to generate randomised test messages that conform to our protobufs.
### Basic Example
The usecase for this seems kind of obvious and I'm not sure if I can provide a better example than this. Happy to add more if you can direct me what would be more useful.
```python
from schemas.my_protobuf_message_pb2 import MyProtobufMessage
class MyProtobufMessageFactory(ProtobufFactory[MyProtobufMessage]): ...
```
### Drawbacks and Impact
Drawback is probably maintenance overhead and version support. Protobuf's internal API isn't the most stable in the world and new versions consistently break things. On top of that , major version changes are generally quite disruptive, which means lots of users will be slow to update. Would probably need to maintain support for multiple protobuf versions. eg, right now the latest major release of protobuf is version 6, but the confluent schema registry python libraries still only support version 5.
### Unresolved questions
_No response_
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the existing factory entry points and the proposed ProtobufFactory[MyProtobufMessage] usage. Define how randomized messages should conform to generated protobuf types, then assess the required protobuf version support and compatibility expectations before implementation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100