Mark redis.asyncio as public in top-level __init__.py #3263
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request check-list
Please make sure to review and check all of these items:
NOTE: these things are not required to open a PR and can be done
afterwards / while the PR is open.
Description of change
The top-level __init__.py file for the package imports the asyncio sub-package (not confused with the standard library asyncio) but does not explicitly mark it as public in __all__.
redis-py/redis/__init__.py
Line 3 in 0d47d65
redis-py/redis/__init__.py
Lines 58 to 89 in 0d47d65
If you just
import redis
with the intent to useredis.asyncio
, Mypy doesn't seem to care but Pyright certainly does. Pyright will treat this as an unknown symbol, which turns off a lot of developer quality-of-life features in VSCode.I did notice that there's a bare # noqa directive for the
from redis import asyncio
line but since it's bare, I'm not sure exactly what the directive is silencing. I considered it might be the fact that it's not re-exported but I thought it might also be because that import will shadow the standard libraryasyncio
library and imports can get weird when you have module name collisions with the standard library.Anyways, those are a lot of words explaining a one-line change that will save 8 characters by only needing to import
redis
instead ofredis.asyncio
every time.If this wasn't the intent of including the
from redis import asyncio
line in the top-level __init__.py, feel free to close this without merging!Thanks!