Compare commits

..

No commits in common. "91b40234cb632bc6a264c3884a59101c884185ca" and "0933f943a5a8a18d244b07b6394c6b779ed4a654" have entirely different histories.

5 changed files with 8 additions and 18 deletions

View File

@ -10,7 +10,4 @@ pub: build
install: install:
pip install -e .[dev,pub] pip install -e .[dev,pub]
test-api: .PHONY: build clean pub install
docker run --rm -ti -p 4999:4999 python:3.7-slim bash -c "pip install announce_server==0.0.2rc2; pip install 'python-socketsio[asyncio_client]==5.0'; announce_server start_registry"
.PHONY: build clean pub install test-api

View File

@ -73,8 +73,8 @@ To start the registry server with the default configuration, run:
announce_server start_registry announce_server start_registry
``` ```
The full syntax is equivalent to: To start the registry server with a custom IP address, port number, heartbeat interval, and timeout, run:
```bash ```bash
announce_server start_registry --address 0.0.0.0 --port 4999 --heartbeat_interval 5 --heartbeat_timeout 3 announce_server start_registry --address localhost --port 4998 --heartbeat_interval 10 --heartbeat_timeout 5
``` ```

View File

@ -12,6 +12,7 @@ classifiers =
Intended Audience :: Developers Intended Audience :: Developers
License :: OSI Approved :: MIT License License :: OSI Approved :: MIT License
Programming Language :: Python :: 3 Programming Language :: Python :: 3
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.9
@ -23,7 +24,7 @@ package_dir =
= src = src
packages = find: packages = find:
install_requires = install_requires =
python-socketio[asyncio_client]~=5.0.0 python-socketio[asyncio_client]
[options.packages.find] [options.packages.find]
where = src where = src

View File

@ -7,5 +7,5 @@ setup(
"setuptools_scm", "setuptools_scm",
], ],
use_scm_version=True, use_scm_version=True,
python_requires=">=3.7", # because of python-socketsio[asyncio_client] python_requires=">=3.6",
) )

View File

@ -137,18 +137,10 @@ def start_server(address, port, heartbeat_interval, heartbeat_timeout):
The timeout for waiting for a response in seconds. The timeout for waiting for a response in seconds.
""" """
loop = asyncio.get_event_loop() loop = asyncio.get_event_loop()
# Python 3.7+, coroutines only: heartbeat_task = loop.create_task(
# heartbeat_task = loop.create_task(
# heartbeat(sio, heartbeat_interval, heartbeat_timeout)
# )
# aiohttp_app = loop.create_task(web._run_app(app, host=address, port=port))
# Python 3.6+ compatible. Supports any awaitable:
heartbeat_task = asyncio.ensure_future(
heartbeat(sio, heartbeat_interval, heartbeat_timeout) heartbeat(sio, heartbeat_interval, heartbeat_timeout)
) )
aiohttp_app = loop.create_task(web._run_app(app, host=address, port=port))
aiohttp_app = asyncio.ensure_future(web._run_app(app, host=address, port=port))
exit_handler = create_exit_handler(loop, heartbeat_task) exit_handler = create_exit_handler(loop, heartbeat_task)
signal.signal(signal.SIGINT, exit_handler) signal.signal(signal.SIGINT, exit_handler)