From 5269d4386cc88eb63f223a979771e298fd171cf7 Mon Sep 17 00:00:00 2001 From: grossmj Date: Mon, 30 Dec 2024 15:36:40 +0700 Subject: [PATCH 1/2] Drop Python 3.8 --- .github/workflows/testing.yml | 2 +- gns3server/server.py | 6 +++--- gns3server/utils/asyncio/__init__.py | 16 ++++------------ gns3server/utils/asyncio/pool.py | 5 +---- pyproject.toml | 4 ++-- 5 files changed, 11 insertions(+), 22 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index c0c31acb..23acd437 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -18,7 +18,7 @@ jobs: strategy: matrix: os: ["ubuntu-latest"] - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] #include: # only test with Python 3.10 on Windows # - os: windows-latest diff --git a/gns3server/server.py b/gns3server/server.py index a2bff6d4..29f1a870 100644 --- a/gns3server/server.py +++ b/gns3server/server.py @@ -267,9 +267,9 @@ class Server: else: log.info(f"Compute authentication is enabled with username '{config.Server.compute_username}'") - # we only support Python 3 version >= 3.8 - if sys.version_info < (3, 8, 0): - raise SystemExit("Python 3.8 or higher is required") + # we only support Python 3 version >= 3.9 + if sys.version_info < (3, 9, 0): + raise SystemExit("Python 3.9 or higher is required") log.info( "Running with Python {major}.{minor}.{micro} and has PID {pid}".format( diff --git a/gns3server/utils/asyncio/__init__.py b/gns3server/utils/asyncio/__init__.py index 562a3df6..9b14e17e 100644 --- a/gns3server/utils/asyncio/__init__.py +++ b/gns3server/utils/asyncio/__init__.py @@ -97,18 +97,10 @@ async def wait_for_process_termination(process, timeout=10): :param timeout: Timeout in seconds """ - if sys.version_info >= (3, 5): - try: - await asyncio.wait_for(process.wait(), timeout=timeout) - except ProcessLookupError: - return - else: - while timeout > 0: - if process.returncode is not None: - return - await asyncio.sleep(0.1) - timeout -= 0.1 - raise asyncio.TimeoutError() + try: + await asyncio.wait_for(process.wait(), timeout=timeout) + except ProcessLookupError: + return async def _check_process(process, termination_callback): diff --git a/gns3server/utils/asyncio/pool.py b/gns3server/utils/asyncio/pool.py index eba0ce73..0b0b43c9 100644 --- a/gns3server/utils/asyncio/pool.py +++ b/gns3server/utils/asyncio/pool.py @@ -40,10 +40,7 @@ class Pool: while len(self._tasks) > 0 or len(pending) > 0: while len(self._tasks) > 0 and len(pending) < self._concurrency: task, args, kwargs = self._tasks.pop(0) - if sys.version_info >= (3, 7): - t = asyncio.create_task(task(*args, **kwargs)) - else: - t = asyncio.get_event_loop().create_task(task(*args, **kwargs)) + t = asyncio.create_task(task(*args, **kwargs)) pending.add(t) (done, pending) = await asyncio.wait(pending, return_when=asyncio.FIRST_COMPLETED) for task in done: diff --git a/pyproject.toml b/pyproject.toml index 66b54667..cddf3df9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,7 @@ authors = [ { name = "Jeremy Grossmann", email = "developers@gns3.com" } ] readme = "README.md" -requires-python = ">=3.8" +requires-python = ">=3.9" classifiers = [ "Development Status :: 5 - Production/Stable", "Environment :: Console", @@ -21,11 +21,11 @@ classifiers = [ "Natural Language :: English", "Operating System :: POSIX :: Linux", "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Programming Language :: Python :: Implementation :: CPython" ] From 5f75fc75734bec7891fb2468b5949a03adc086db Mon Sep 17 00:00:00 2001 From: grossmj Date: Mon, 30 Dec 2024 15:45:17 +0700 Subject: [PATCH 2/2] Add greenlet dependency --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index 3882f22f..d86f6789 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,6 +11,7 @@ sentry-sdk>=2.19.2,<2.20 # optional dependency psutil>=6.1.1 distro>=1.9.0 py-cpuinfo>=9.0.0,<10.0 +greenlet==3.1.1 # necessary to run sqlalchemy on Python 3.13 sqlalchemy==2.0.36 aiosqlite==0.20.0 alembic==1.14.0