Skip to content

Commit c2b416e

Browse files
authored
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
1 parent 91c4278 commit c2b416e

File tree

3 files changed

+44
-8
lines changed

3 files changed

+44
-8
lines changed

.circleci/config.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ vertica_image: &vertica_image sumitchawla/vertica:latest
1717
rabbitmq_image: &rabbitmq_image rabbitmq:3.7-alpine
1818

1919
orbs:
20-
win: circleci/windows@4.1
20+
win: circleci/windows@5.0
2121

2222
machine_executor: &machine_executor
2323
machine:
@@ -438,7 +438,7 @@ jobs:
438438
name: win/default
439439
shell: bash.exe
440440
steps:
441-
- run: choco install python --version=3.5.4
441+
- run: choco install -y python --version=3.5.4 --side-by-side
442442
- run_tox_scenario:
443443
store_coverage: false
444444
pattern: '^py35-profile'
@@ -448,7 +448,7 @@ jobs:
448448
name: win/default
449449
shell: bash.exe
450450
steps:
451-
- run: choco install python --version=3.6.8
451+
- run: choco install -y python --version=3.6.8 --side-by-side
452452
- run_tox_scenario:
453453
store_coverage: false
454454
pattern: '^py36-profile'
@@ -469,7 +469,7 @@ jobs:
469469
name: win/default
470470
shell: bash.exe
471471
steps:
472-
- run: choco install python --version=3.8.10
472+
- run: choco install -y python --version=3.8.10 --side-by-side
473473
- run_tox_scenario:
474474
store_coverage: false
475475
pattern: '^py38-profile'
@@ -479,7 +479,7 @@ jobs:
479479
name: win/default
480480
shell: bash.exe
481481
steps:
482-
- run: choco install python --version=3.9.12
482+
- run: choco install -y python --version=3.9.12 --side-by-side
483483
- run_tox_scenario:
484484
store_coverage: false
485485
pattern: '^py39-profile'
@@ -489,7 +489,7 @@ jobs:
489489
name: win/default
490490
shell: bash.exe
491491
steps:
492-
- run: choco install python --version=3.10.4
492+
# circleci/[email protected] orb includes python 3.10.6
493493
- run_tox_scenario:
494494
store_coverage: false
495495
pattern: '^py310-profile'

riotfile.py

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,7 @@ def select_pys(min_version=MIN_PYTHON_VERSION, max_version=MAX_PYTHON_VERSION):
415415
],
416416
"redis": "~=2.10.6",
417417
"kombu": "~=4.3.0",
418+
"importlib_metadata": "<5.0", # kombu using deprecated shims removed in importlib-metadata>=5.0
418419
},
419420
),
420421
# Celery 4.2 is now limited to Kombu 4.3
@@ -426,11 +427,27 @@ def select_pys(min_version=MIN_PYTHON_VERSION, max_version=MAX_PYTHON_VERSION):
426427
"celery": "~=4.2.2",
427428
"redis": "~=2.10.6",
428429
"kombu": "~=4.3.0",
430+
"importlib_metadata": "<5.0", # kombu using deprecated shims removed in importlib_metadata 5.0
429431
},
430432
),
431433
# Celery 4.3 wants Kombu >= 4.4 and Redis >= 3.2
434+
# Split into <3.8 and >=3.8 to pin importlib_metadata dependency for kombu
432435
Venv(
433-
pys=select_pys(max_version="3.9"),
436+
pys=select_pys(max_version="3.7"),
437+
pkgs={
438+
"pytest": "~=3.10",
439+
"celery": [
440+
"~=4.3.1",
441+
"~=4.4.7",
442+
"~=4.4", # most recent 4.x
443+
],
444+
"redis": "~=3.5",
445+
"kombu": "~=4.4",
446+
"importlib_metadata": "<5.0", # kombu using deprecated shims removed in importlib_metadata 5.0
447+
},
448+
),
449+
Venv(
450+
pys=select_pys(min_version="3.8", max_version="3.9"),
434451
pkgs={
435452
"pytest": "~=3.10",
436453
"celery": [
@@ -443,8 +460,25 @@ def select_pys(min_version=MIN_PYTHON_VERSION, max_version=MAX_PYTHON_VERSION):
443460
},
444461
),
445462
# Celery 5.x wants Python 3.6+
463+
# Split into <3.8 and >=3.8 to pin importlib_metadata dependency for kombu
446464
Venv(
447-
pys=select_pys(min_version="3.6"),
465+
pys=select_pys(min_version="3.6", max_version="3.7"),
466+
env={
467+
# https://docs.celeryproject.org/en/v5.0.5/userguide/testing.html#enabling
468+
"PYTEST_PLUGINS": "celery.contrib.pytest",
469+
},
470+
pkgs={
471+
"celery": [
472+
"~=5.0.5",
473+
"~=5.0", # most recent 5.x
474+
latest,
475+
],
476+
"redis": "~=3.5",
477+
"importlib_metadata": "<5.0", # kombu using deprecated shims removed in importlib_metadata 5.0
478+
},
479+
),
480+
Venv(
481+
pys=select_pys(min_version="3.8"),
448482
env={
449483
# https://docs.celeryproject.org/en/v5.0.5/userguide/testing.html#enabling
450484
"PYTEST_PLUGINS": "celery.contrib.pytest",

tox.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,8 @@ deps =
160160
gevent2012: gevent>=20.12,<20.13
161161
gevent211: gevent>=21.1,<21.2
162162
gevent218: gevent>=21.8,<21.9
163+
# kombu using deprecated shims removed in importlib-metadata 5.0
164+
kombu{40,41,42,43,44,45,46,}: importlib_metadata<5.0; python_version<'3.8'
163165
kombu: kombu
164166
kombu40: kombu>=4.0,<4.1
165167
kombu41: kombu>=4.1,<4.2

0 commit comments

Comments
 (0)