Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Remove Python 3.8; add Python 3.12. #842

Merged
merged 3 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions .github/workflows/zulip-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -35,6 +29,18 @@ 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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Earliest major Zulip version that has the same entry in its matrix.

# Ubuntu 24.04 ships with Python 3.12.3.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though, the Zulip workflow mentions 3.12.2, the actual version used now seems to be 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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Earliest minor Zulip version that supports the platform is 8.3.

But, 8.3 and 8.4 are unable to use pip inside the venv, due to version conflicts related to pkg_resources. Only versions 8.5 onwards seem to be working.

Traceback
Traceback (most recent call last):
  File "/srv/zulip-py3-venv/bin/pip", line 5, in <module>
    from pip._internal.cli.main import main
  File "/srv/zulip-venv-cache/e2c2c053635e882ff393067adf908813bcad92ef/zulip-py3-venv/lib/python3.12/site-packages/pip/_internal/cli/main.py", line 10, in <module>
    from pip._internal.cli.autocompletion import autocomplete
  File "/srv/zulip-venv-cache/e2c2c053635e882ff393067adf908813bcad92ef/zulip-py3-venv/lib/python3.12/site-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>
    from pip._internal.cli.main_parser import create_main_parser
  File "/srv/zulip-venv-cache/e2c2c053635e882ff393067adf908813bcad92ef/zulip-py3-venv/lib/python3.12/site-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
    from pip._internal.cli import cmdoptions
  File "/srv/zulip-venv-cache/e2c2c053635e882ff393067adf908813bcad92ef/zulip-py3-venv/lib/python3.12/site-packages/pip/_internal/cli/cmdoptions.py", line 25, in <module>
    from pip._internal.cli.progress_bars import BAR_TYPES
  File "/srv/zulip-venv-cache/e2c2c053635e882ff393067adf908813bcad92ef/zulip-py3-venv/lib/python3.12/site-packages/pip/_internal/cli/progress_bars.py", line 12, in <module>
    from pip._internal.utils.logging import get_indentation
  File "/srv/zulip-venv-cache/e2c2c053635e882ff393067adf908813bcad92ef/zulip-py3-venv/lib/python3.12/site-packages/pip/_internal/utils/logging.py", line 18, in <module>
    from pip._internal.utils.misc import ensure_dir
  File "/srv/zulip-venv-cache/e2c2c053635e882ff393067adf908813bcad92ef/zulip-py3-venv/lib/python3.12/site-packages/pip/_internal/utils/misc.py", line 21, in <module>
    from pip._vendor import pkg_resources
  File "/srv/zulip-venv-cache/e2c2c053635e882ff393067adf908813bcad92ef/zulip-py3-venv/lib/python3.12/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3254, in <module>
    @_call_aside
     ^^^^^^^^^^^
  File "/srv/zulip-venv-cache/e2c2c053635e882ff393067adf908813bcad92ef/zulip-py3-venv/lib/python3.12/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3238, in _call_aside
    f(*args, **kwargs)
  File "/srv/zulip-venv-cache/e2c2c053635e882ff393067adf908813bcad92ef/zulip-py3-venv/lib/python3.12/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3280, in _initialize_master_working_set
    tuple(
  File "/srv/zulip-venv-cache/e2c2c053635e882ff393067adf908813bcad92ef/zulip-py3-venv/lib/python3.12/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3281, in <genexpr>
    dist.activate(replace=False)
  File "/srv/zulip-venv-cache/e2c2c053635e882ff393067adf908813bcad92ef/zulip-py3-venv/lib/python3.12/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2788, in activate
    declare_namespace(pkg)
  File "/srv/zulip-venv-cache/e2c2c053635e882ff393067adf908813bcad92ef/zulip-py3-venv/lib/python3.12/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2285, in declare_namespace
    _handle_ns(packageName, path_item)
  File "/srv/zulip-venv-cache/e2c2c053635e882ff393067adf908813bcad92ef/zulip-py3-venv/lib/python3.12/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2202, in _handle_ns
    loader = importer.find_module(packageName)
             ^^^^^^^^^^^^^^^^^^^^
AttributeError: 'FileFinder' object has no attribute 'find_module'


runs-on: ubuntu-latest
name: ${{ matrix.name }} (Zulip ${{matrix.server_version}})
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/zulip-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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", "3.12"]

steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.black]
line-length = 100
target-version = ["py38"]
target-version = ["py39"]

[tool.isort]
src_paths = [
Expand Down
2 changes: 1 addition & 1 deletion zulip/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions zulip/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ 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",
"Programming Language :: Python :: 3.12",
],
python_requires=">=3.8",
python_requires=">=3.9",
url="https://www.zulip.org/",
project_urls={
"Source": "https://github.com/zulip/python-zulip-api/",
Expand Down
6 changes: 3 additions & 3 deletions zulip_bots/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@
"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",
"Programming Language :: Python :: 3.12",
],
python_requires=">=3.8",
python_requires=">=3.9",
url="https://www.zulip.org/",
project_urls={
"Source": "https://github.com/zulip/python-zulip-api/",
Expand All @@ -56,7 +56,7 @@
"lxml",
"BeautifulSoup4",
"typing_extensions>=4.5.0",
'importlib-metadata >= 3.6; python_version < "3.10"',
"importlib-metadata>=3.6",
Copy link
Contributor Author

@Niloth-p Niloth-p Dec 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix for #829, included in this commit as it is necessary for the Py 3.12 tests (but not for the 3.11 one).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, isn't the point of #829 that we can just drop this dependency and use the built-in module in 3.10? Or do we need to wait until we drop 3.9 support to drop it?

Copy link
Contributor Author

@Niloth-p Niloth-p Dec 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we can't drop it before dropping 3.9 support.
We could conditionally use the built-in module for >=3.10 without waiting until the dependency is dropped though.

],
packages=find_packages(),
package_data=package_data,
Expand Down
5 changes: 0 additions & 5 deletions zulip_bots/zulip_bots/finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down
4 changes: 2 additions & 2 deletions zulip_botserver/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
"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",
"Programming Language :: Python :: 3.12",
],
python_requires=">=3.8",
python_requires=">=3.9",
url="https://www.zulip.org/",
project_urls={
"Source": "https://github.com/zulip/python-zulip-api/",
Expand Down
Loading