From d84f9a24ef08dbf551b06cecdc764c9cf6280488 Mon Sep 17 00:00:00 2001 From: Niloth P <20315308+Niloth-p@users.noreply.github.com> Date: Tue, 3 Dec 2024 19:04:44 +0530 Subject: [PATCH 1/3] ci: Remove Python 3.8. --- .github/workflows/zulip-ci.yml | 6 ------ .github/workflows/zulip-tests.yml | 6 +++--- pyproject.toml | 2 +- zulip/README.md | 2 +- zulip/setup.py | 3 +-- zulip_bots/setup.py | 3 +-- zulip_botserver/setup.py | 3 +-- 7 files changed, 8 insertions(+), 17 deletions(-) diff --git a/.github/workflows/zulip-ci.yml b/.github/workflows/zulip-ci.yml index a80573c8a..3ff8281c9 100644 --- a/.github/workflows/zulip-ci.yml +++ b/.github/workflows/zulip-ci.yml @@ -17,12 +17,6 @@ jobs: fail-fast: false matrix: include: - # Focal ships with Python 3.8.10. - - docker_image: zulip/ci:focal - name: Ubuntu 20.04 (Python 3.8, backend) - os: focal - legacy_client_interface: "3" - server_version: refs/tags/3.2 # Bullseye ships with Python 3.9.2. - docker_image: zulip/ci:bullseye name: Debian 11 (Python 3.9, backend) diff --git a/.github/workflows/zulip-tests.yml b/.github/workflows/zulip-tests.yml index 3ac833fc2..db7fecb68 100644 --- a/.github/workflows/zulip-tests.yml +++ b/.github/workflows/zulip-tests.yml @@ -13,10 +13,10 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set up Python 3.8 + - name: Set up Python 3.9 uses: actions/setup-python@v5 with: - python-version: "3.8" + python-version: "3.9" - name: Install dependencies run: tools/provision --force @@ -32,7 +32,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest] - python-version: ["3.8", "3.9", "3.10", "3.11"] + python-version: ["3.9", "3.10", "3.11"] steps: - uses: actions/checkout@v4 diff --git a/pyproject.toml b/pyproject.toml index 13eecfd94..159c85e23 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.black] line-length = 100 -target-version = ["py38"] +target-version = ["py39"] [tool.isort] src_paths = [ diff --git a/zulip/README.md b/zulip/README.md index 024f78615..75845bfee 100644 --- a/zulip/README.md +++ b/zulip/README.md @@ -3,7 +3,7 @@ The [Zulip API](https://zulip.com/api) Python bindings require the following dependencies: -* **Python (version >= 3.8)** +* **Python (version >= 3.9)** * requests (version >= 0.12.1) **Note**: If you'd like to use the Zulip bindings with Python 2, we diff --git a/zulip/setup.py b/zulip/setup.py index 853908d29..8b8ae9536 100755 --- a/zulip/setup.py +++ b/zulip/setup.py @@ -42,12 +42,11 @@ def recur_expand(target_root: Any, dir: Any) -> Generator[Tuple[str, List[str]], "License :: OSI Approved :: Apache Software License", "Topic :: Communications :: Chat", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", ], - python_requires=">=3.8", + python_requires=">=3.9", url="https://www.zulip.org/", project_urls={ "Source": "https://github.com/zulip/python-zulip-api/", diff --git a/zulip_bots/setup.py b/zulip_bots/setup.py index d81a40a12..f23cd97d4 100644 --- a/zulip_bots/setup.py +++ b/zulip_bots/setup.py @@ -32,12 +32,11 @@ "License :: OSI Approved :: Apache Software License", "Topic :: Communications :: Chat", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", ], - python_requires=">=3.8", + python_requires=">=3.9", url="https://www.zulip.org/", project_urls={ "Source": "https://github.com/zulip/python-zulip-api/", diff --git a/zulip_botserver/setup.py b/zulip_botserver/setup.py index de3428c8d..d4919a3ed 100644 --- a/zulip_botserver/setup.py +++ b/zulip_botserver/setup.py @@ -20,12 +20,11 @@ "License :: OSI Approved :: Apache Software License", "Topic :: Communications :: Chat", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", ], - python_requires=">=3.8", + python_requires=">=3.9", url="https://www.zulip.org/", project_urls={ "Source": "https://github.com/zulip/python-zulip-api/", From 05bdd48a30fe49b08728971cb0f2364d5a6d840d Mon Sep 17 00:00:00 2001 From: Niloth P <20315308+Niloth-p@users.noreply.github.com> Date: Tue, 3 Dec 2024 19:05:19 +0530 Subject: [PATCH 2/3] ci: Add Python 3.11 Zulip 7.0 entry to matrix strategy. --- .github/workflows/zulip-ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/zulip-ci.yml b/.github/workflows/zulip-ci.yml index 3ff8281c9..c255c0a27 100644 --- a/.github/workflows/zulip-ci.yml +++ b/.github/workflows/zulip-ci.yml @@ -29,6 +29,12 @@ jobs: os: jammy legacy_client_interface: "6" server_version: refs/tags/6.0 + # Debian 12 ships with Python 3.11.2. + - docker_image: zulip/ci:bookworm + name: Debian 12 (Python 3.11, backend + documentation) + os: bookworm + legacy_client_interface: "7" + server_version: refs/tags/7.0 runs-on: ubuntu-latest name: ${{ matrix.name }} (Zulip ${{matrix.server_version}}) From db1c5550c9205dc73959d0720e48f11e4941754c 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 3/3] 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/",