Question - how to write a stub file with missing imports?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 5.1k
- Forks
- 2.1k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 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...
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 with typeshed's engineio/async_drivers/eventlet.pyi and compare it with eventlet.py in the linked python-engineio source. Read the guarded import in engineio/base_server.py to understand when this driver is available. Done means choosing and documenting a supported stub approach for the missing eventlet dependency.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100