Question - how to write a stub file with missing imports?
Personne n'a encore pris cette issue.
- Langage dominant
- Python
- Étoiles
- 5.1k
- Forks
- 2.1k
- Merge moyen
- 1 j 19 h
- PR mergées (30 j)
- 82
Description
I'm working on adding engineio to typeshed, and in its source code there is a file which imports from eventlet without a guard - https://github.com/miguelgrinberg/python-engineio/blob/main/src/engineio/async_drivers/eventlet.py#L1-L3.
the guard is in another part of the code - https://github.com/miguelgrinberg/python-engineio/blob/main/src/engineio/base_server.py#L82-L92
eventlet isn't even an optional dependency of engineio, but if it's installed and configured properly then the user's code can use engineio's eventlet driver
how should I approach this in the stub file of engineio/async_drivers/eventlet.pyi? I can't import from eventlet since it's not a dependency, but I also can't define the class WebSocketWSGI which inherits from the import eventlet.websocket.WebSocketWSGI
one possibility I've though of is to write a protocol which behaves like eventlet.websocket.WebSocketWSGI but that doesn't seem like the best approach...
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par typeshed's engineio/async_drivers/eventlet.pyi et comparez-le avec eventlet.py dans le code source python-engineio lié. Lisez l’import protégé dans engineio/base_server.py pour comprendre quand ce pilote est disponible. Le travail est considéré comme terminé lorsqu’une approche de stub prise en charge pour la dépendance eventlet manquante a été choisie et documentée.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- python
- Domaine
- devtools
- Type d'issue
- Fonctionnalité
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- À l'abandon
- Clarté
- À clarifier
- Accessibilité débutants
- 35/100