Skip to content

Commit

Permalink
fix(ci): pin importlib_metadata<5.0.0 (backport #4257) (#4289)
Browse files Browse the repository at this point in the history
* fix(ci): pin importlib_metadata<5.0.0 (#4257)

CI jobs `profile-windows-*`, `kombu` and `celery` are failing due to the release of `importlib_metadata==5.0.0` which removed deprecated shims, resulting in the following exception:

```
AttributeError: 'EntryPoints' object has no attribute 'get'
```

We fix this by pinning the dependency for kombu and celery. In the case of the Windows tests, we address it by upgrading the Windows image to a version that includes Python 3.10 rather than Python 3.7 which removes the need to install the dependency when installing tox.

- [Example log of failing job](https://app.circleci.com/pipelines/github/DataDog/dd-trace-py/21679/workflows/2a7606b5-9ca8-4212-9b02-053665de0198/jobs/1477147)
- python/importlib_metadata#409

(cherry picked from commit c2b416e)

# Conflicts:
#	.circleci/config.yml

* fix conflicts

Co-authored-by: Tahir H. Butt <tahir.butt@datadoghq.com>
Co-authored-by: Munir Abdinur <munir_abdinur@hotmail.com>
  • Loading branch information
3 people committed Oct 24, 2022
1 parent ed81229 commit 2a8b12b
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ vertica_image: &vertica_image sumitchawla/vertica:latest
rabbitmq_image: &rabbitmq_image rabbitmq:3.7-alpine

orbs:
win: circleci/windows@2.2.0
win: circleci/windows@5.0

machine_executor: &machine_executor
machine:
Expand Down
38 changes: 36 additions & 2 deletions riotfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ def select_pys(min_version=MIN_PYTHON_VERSION, max_version=MAX_PYTHON_VERSION):
],
"redis": "~=2.10.6",
"kombu": "~=4.3.0",
"importlib_metadata": "<5.0", # kombu using deprecated shims removed in importlib-metadata>=5.0
},
),
Venv(
Expand All @@ -377,11 +378,27 @@ def select_pys(min_version=MIN_PYTHON_VERSION, max_version=MAX_PYTHON_VERSION):
"celery": "~=4.2.2",
"redis": "~=2.10.6",
"kombu": "~=4.3.0",
"importlib_metadata": "<5.0", # kombu using deprecated shims removed in importlib_metadata 5.0
},
),
# Celery 4.3 wants Kombu >= 4.4 and Redis >= 3.2
# Split into <3.8 and >=3.8 to pin importlib_metadata dependency for kombu
Venv(
pys=select_pys(max_version="3.9"),
pys=select_pys(max_version="3.7"),
pkgs={
"pytest": "~=3.10",
"celery": [
"~=4.3.1",
"~=4.4.7",
"~=4.4", # most recent 4.x
],
"redis": "~=3.5",
"kombu": "~=4.4",
"importlib_metadata": "<5.0", # kombu using deprecated shims removed in importlib_metadata 5.0
},
),
Venv(
pys=select_pys(min_version="3.8", max_version="3.9"),
pkgs={
"pytest": "~=3.10",
"celery": [
Expand All @@ -394,8 +411,25 @@ def select_pys(min_version=MIN_PYTHON_VERSION, max_version=MAX_PYTHON_VERSION):
},
),
# Celery 5.x wants Python 3.6+
# Split into <3.8 and >=3.8 to pin importlib_metadata dependency for kombu
Venv(
pys=select_pys(min_version="3.6"),
pys=select_pys(min_version="3.6", max_version="3.7"),
env={
# https://docs.celeryproject.org/en/v5.0.5/userguide/testing.html#enabling
"PYTEST_PLUGINS": "celery.contrib.pytest",
},
pkgs={
"celery": [
"~=5.0.5",
"~=5.0", # most recent 5.x
latest,
],
"redis": "~=3.5",
"importlib_metadata": "<5.0", # kombu using deprecated shims removed in importlib_metadata 5.0
},
),
Venv(
pys=select_pys(min_version="3.8"),
env={
# https://docs.celeryproject.org/en/v5.0.5/userguide/testing.html#enabling
"PYTEST_PLUGINS": "celery.contrib.pytest",
Expand Down
2 changes: 2 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ deps =
gevent2012: gevent>=20.12,<20.13
gevent211: gevent>=21.1,<21.2
gevent218: gevent>=21.8,<21.9
# kombu using deprecated shims removed in importlib-metadata 5.0
kombu{40,41,42,43,44,45,46,}: importlib_metadata<5.0; python_version<'3.8'
kombu: kombu
kombu40: kombu>=4.0,<4.1
kombu41: kombu>=4.1,<4.2
Expand Down

0 comments on commit 2a8b12b

Please sign in to comment.