Skip to content

Commit bfca3b4

Browse files
authored
Rename zeroconf.asyncio to zeroconf.aio (#503)
- The asyncio name could shadow system asyncio in some cases. If zeroconf is in sys.path, this would result in loading zeroconf.asyncio when system asyncio was intended. - An `zeroconf.asyncio` shim module has been added that imports `zeroconf.aio` that was available in 0.31 to provide backwards compatibility in 0.32. This module will be removed in 0.33 to fix the underlying problem detailed in #502
1 parent 9b480bc commit bfca3b4

9 files changed

Lines changed: 890 additions & 838 deletions

File tree

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ flake8:
2929
flake8 --max-line-length=$(MAX_LINE_LENGTH) setup.py examples zeroconf
3030

3131
pylint:
32-
pylint zeroconf/__init__.py zeroconf/asyncio.py
32+
pylint zeroconf/__init__.py zeroconf/aio.py zeroconf/asyncio.py
3333

3434
.PHONY: black_check
3535
black_check:
@@ -39,10 +39,10 @@ mypy:
3939
mypy examples/*.py zeroconf/*.py
4040

4141
test:
42-
pytest -v zeroconf/test.py zeroconf/test_asyncio.py
42+
pytest -v zeroconf/test.py zeroconf/test_aio.py zeroconf/test_asyncio.py
4343

4444
test_coverage:
45-
pytest -v --cov=zeroconf --cov-branch --cov-report html --cov-report term-missing zeroconf/test.py zeroconf/test_asyncio.py
45+
pytest -v --cov=zeroconf --cov-branch --cov-report html --cov-report term-missing zeroconf/test.py zeroconf/test_aio.py zeroconf/test_asyncio.py
4646

4747
autopep8:
4848
autopep8 --max-line-length=$(MAX_LINE_LENGTH) -i setup.py examples zeroconf

docs/api.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ python-zeroconf API reference
66
:undoc-members:
77
:show-inheritance:
88

9-
.. automodule:: zeroconf.asyncio
9+
.. automodule:: zeroconf.aio
1010
:members:
1111
:undoc-members:
1212
:show-inheritance:

examples/async_browser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from typing import cast
1212

1313
from zeroconf import IPVersion, ServiceStateChange
14-
from zeroconf.asyncio import AsyncServiceBrowser, AsyncZeroconf
14+
from zeroconf.aio import AsyncServiceBrowser, AsyncZeroconf
1515

1616

1717
def async_on_service_state_change(

examples/async_registration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from typing import List
1010

1111
from zeroconf import IPVersion
12-
from zeroconf.asyncio import AsyncServiceInfo, AsyncZeroconf
12+
from zeroconf.aio import AsyncServiceInfo, AsyncZeroconf
1313

1414

1515
async def register_services(infos: List[AsyncServiceInfo]) -> None:

examples/async_service_info_request.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414

1515
from zeroconf import IPVersion, ServiceBrowser, ServiceStateChange, Zeroconf
16-
from zeroconf.asyncio import AsyncServiceInfo, AsyncZeroconf
16+
from zeroconf.aio import AsyncServiceInfo, AsyncZeroconf
1717

1818

1919
HAP_TYPE = "_hap._tcp.local."

0 commit comments

Comments
 (0)