From a56304dc3e29efeab2ce28ef73d903b9d16a7108 Mon Sep 17 00:00:00 2001 From: Niloth P <20315308+Niloth-p@users.noreply.github.com> Date: Tue, 3 Dec 2024 19:08:37 +0530 Subject: [PATCH] ci: Add Python 3.12. Use `importlib-metadata` for newer Python versions as well. Fixes #829. --- .github/workflows/zulip-ci.yml | 6 ++++++ .github/workflows/zulip-tests.yml | 2 +- zulip/setup.py | 1 + zulip_bots/setup.py | 3 ++- zulip_bots/zulip_bots/finder.py | 5 ----- zulip_botserver/setup.py | 1 + 6 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/zulip-ci.yml b/.github/workflows/zulip-ci.yml index c255c0a27..36bdb7ca9 100644 --- a/.github/workflows/zulip-ci.yml +++ b/.github/workflows/zulip-ci.yml @@ -35,6 +35,12 @@ jobs: os: bookworm legacy_client_interface: "7" server_version: refs/tags/7.0 + # Ubuntu 24.04 ships with Python 3.12.3. + - docker_image: zulip/ci:noble + name: Ubuntu 24.04 (Python 3.12, backend) + os: noble + legacy_client_interface: "8" + server_version: refs/tags/8.5 runs-on: ubuntu-latest name: ${{ matrix.name }} (Zulip ${{matrix.server_version}}) diff --git a/.github/workflows/zulip-tests.yml b/.github/workflows/zulip-tests.yml index db7fecb68..5e2a79ace 100644 --- a/.github/workflows/zulip-tests.yml +++ b/.github/workflows/zulip-tests.yml @@ -32,7 +32,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest] - python-version: ["3.9", "3.10", "3.11"] + python-version: ["3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v4 diff --git a/zulip/setup.py b/zulip/setup.py index 8b8ae9536..137fc29ee 100755 --- a/zulip/setup.py +++ b/zulip/setup.py @@ -45,6 +45,7 @@ def recur_expand(target_root: Any, dir: Any) -> Generator[Tuple[str, List[str]], "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", ], python_requires=">=3.9", url="https://www.zulip.org/", diff --git a/zulip_bots/setup.py b/zulip_bots/setup.py index f23cd97d4..97308690f 100644 --- a/zulip_bots/setup.py +++ b/zulip_bots/setup.py @@ -35,6 +35,7 @@ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", ], python_requires=">=3.9", url="https://www.zulip.org/", @@ -55,7 +56,7 @@ "lxml", "BeautifulSoup4", "typing_extensions>=4.5.0", - 'importlib-metadata >= 3.6; python_version < "3.10"', + "importlib-metadata>=3.6", ], packages=find_packages(), package_data=package_data, diff --git a/zulip_bots/zulip_bots/finder.py b/zulip_bots/zulip_bots/finder.py index 8fbcc495c..3009299d2 100644 --- a/zulip_bots/zulip_bots/finder.py +++ b/zulip_bots/zulip_bots/finder.py @@ -35,11 +35,6 @@ class DuplicateRegisteredBotNameError(Exception): def import_module_from_zulip_bot_registry(name: str) -> Tuple[str, Optional[ModuleType]]: - # Prior to Python 3.10, calling importlib.metadata.entry_points returns a - # SelectableGroups object when no parameters is given. Currently we use - # the importlib_metadata library for compatibility, but we need to migrate - # to the built-in library when we start to adapt Python 3.10. - # https://importlib-metadata.readthedocs.io/en/latest/using.html#entry-points registered_bots = metadata.entry_points(group="zulip_bots.registry") matching_bots = [bot for bot in registered_bots if bot.name == name] diff --git a/zulip_botserver/setup.py b/zulip_botserver/setup.py index d4919a3ed..cd891dea2 100644 --- a/zulip_botserver/setup.py +++ b/zulip_botserver/setup.py @@ -23,6 +23,7 @@ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", ], python_requires=">=3.9", url="https://www.zulip.org/",