danielgtaylor / danielgtaylor/python-betterproto
ContextManager for stream-unary endpoints
- Langage dominant
- Python
- Étoiles
- 1.8k
- Forks
- 234
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
It would be nice if we could interact with a stream-unary endpoint by using a context-manager.
currently the only way to send messages to a stream-unary endpoint is by using an async-generator:
```python
async def request_iterator():
yield create_some_request()
yield create_some_request()
channel = Channel(host="localhost", port=1234)
stub = MyStub(channel)
response = await stub.my_endpoint(request_iterator())
```
what i imagine is something like this:
```python
channel = Channel(host="localhost", port=1234)
stub = MyStub(channel)
async with stub.my_endpoint as stream:
stream.write(create_some_request())
stream.write(create_some_request())
```
Open questions:
- how should the interface for receiving the response look?
- could this be used for stream-stream endpoints as well?
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Commencez par retracer le point d’entrée stream-unary actuel du stub généré et son chemin de requête via async-generator. Déterminez l’interface de réception de la réponse et si les endpoints stream-stream sont inclus ; le travail est terminé lorsqu’une API context-manager documentée et approuvée pour écrire les requêtes et consommer la réponse est définie.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- grpc, python
- Domaine
- api, backend-api-design
- Type d'issue
- Fonctionnalité
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Activité
- À l'abandon
- Clarté
- À clarifier
- Accessibilité débutants
- 30/100