Skip to content

Commit 2a0e927

Browse files
authored
Enabling Python 3.10 in build matrix (Azure#21063)
* adding py310 on ubuntu 2004 to the test matrix * pin cffi to prerelease version on py 3.10 * in test_tools.txt and ci_tools.txt, update dependencies where py3.10 necessitates * add ability to skip a package for a specific python version. Doing this because opentelemetry-api is a hard dependency and there is no timeline on a fix.
1 parent 31e6898 commit 2a0e927

File tree

9 files changed

+57
-14
lines changed

9 files changed

+57
-14
lines changed

eng/ci_tools.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ cryptography==3.1
33
setuptools==44.1.0; python_version == '2.7'
44
setuptools==46.4.0; python_version >= '3.5'
55
virtualenv==20.0.23
6-
wheel==0.34.2
6+
wheel==0.37.0
77
Jinja2==2.11.2
88
packaging==20.4
99
tox==3.15.0
1010
tox-monorepo==0.1.2
1111
twine==1.15.0; python_version == '2.7' or python_version == '3.5'
1212
twine==3.1.1; python_version >= '3.6'
1313
pathlib2==2.3.5
14-
readme-renderer[md]==25.0
14+
readme-renderer[md]==25.0; python_version < '3.10'
1515
doc-warden==0.7.1
1616
# we pin coverage to 4.5.4 because there is an bug with `pytest-cov`. the generated coverage files cannot be `coverage combine`ed
1717
coverage==4.5.4
@@ -22,6 +22,9 @@ pip==20.3
2222
black==21.6b0; python_version >= '3.6'
2323
wrapt<=1.12.1; python_version == '2.7'
2424

25+
# python 3.10 pinned packages
26+
cffi==1.15.0rc2; python_version >= '3.10'
27+
2528
# locking packages defined as deps from azure-sdk-tools or azure-devtools
2629
pytoml==0.1.21
2730
pyOpenSSL==19.1.0

eng/pipelines/templates/stages/platform-matrix-cryptography-dependency.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,17 @@
2323
},
2424
"PythonVersion": "3.6",
2525
"CoverageArg": "--disablecov"
26+
},
27+
{
28+
"Config": {
29+
"Ubuntu2004_310": {
30+
"OSVmImage": "MMSUbuntu20.04",
31+
"Pool": "azsdk-pool-mms-ubuntu-2004-general",
32+
"PythonVersion": "3.10.0",
33+
"CoverageArg": "--disablecov",
34+
"TestSamples": "false"
35+
}
36+
}
2637
}
2738
]
2839
}

eng/pipelines/templates/stages/platform-matrix.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,17 @@
2525
"TestSamples": "false"
2626
}
2727
}
28+
},
29+
{
30+
"Config": {
31+
"Ubuntu2004_310": {
32+
"OSVmImage": "MMSUbuntu20.04",
33+
"Pool": "azsdk-pool-mms-ubuntu-2004-general",
34+
"PythonVersion": "3.10.0",
35+
"CoverageArg": "--disablecov",
36+
"TestSamples": "false"
37+
}
38+
}
2839
}
2940
]
3041
}

eng/test_tools.txt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
pip==20.3
22

3-
# manually published packages
4-
https://docsupport.blob.core.windows.net/repackaged/cffi-1.14.6-cp310-cp310-win_amd64.whl; sys_platform=='win32' and python_version >= '3.10'
5-
https://docsupport.blob.core.windows.net/repackaged/multidict-5.1.0-cp310-cp310-win_amd64.whl; sys_platform=='win32' and python_version >= '3.10'
6-
https://docsupport.blob.core.windows.net/repackaged/pywin32-301.1-cp310-cp310-win_amd64.whl; sys_platform=='win32' and python_version >= '3.10'
7-
https://docsupport.blob.core.windows.net/repackaged/yarl-1.6.3-cp310-cp310-win_amd64.whl; sys_platform=='win32' and python_version >= '3.10'
3+
# python 3.10 pinned packages
4+
cffi==1.15.0rc2; python_version >= '3.10'
85

96
# requirements leveraged by ci for testing
107
pytest==4.6.9; python_version == '2.7'
@@ -29,7 +26,7 @@ ConfigArgParse==1.2.3
2926
six==1.14.0
3027
pyyaml==5.3.1
3128
packaging==20.4
32-
wheel==0.34.2
29+
wheel==0.37.0
3330
Jinja2==2.11.2
3431

3532
# Locking pylint and required packages

scripts/devops_tasks/common_tasks.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
from packaging.version import Version
3131
from packaging.version import parse
3232

33-
3433
DEV_REQ_FILE = "dev_requirements.txt"
3534
NEW_DEV_REQ_FILE = "new_dev_requirements.txt"
3635
NEW_REQ_PACKAGES = ["azure-core", "azure-mgmt-core"]
@@ -65,6 +64,10 @@
6564
"azure-mgmt-core",
6665
]
6766

67+
TEST_COMPATIBILITY_MAP = {
68+
"azure-core-tracing-opentelemetry": "<3.10"
69+
}
70+
6871
omit_regression = (
6972
lambda x: "nspkg" not in x
7073
and "mgmt" not in x
@@ -220,6 +223,17 @@ def compare_python_version(version_spec):
220223
return current_sys_version in spec_set
221224

222225

226+
def filter_packages_by_compatibility_override(package_set, resolve_basename=True):
227+
return [
228+
p
229+
for p in package_set
230+
if compare_python_version(
231+
TEST_COMPATIBILITY_MAP.get(
232+
os.path.basename(p) if resolve_basename else p, ">=2.7"
233+
)
234+
)
235+
]
236+
223237
# this function is where a glob string gets translated to a list of packages
224238
# It is called by both BUILD (package) and TEST. In the future, this function will be the central location
225239
# for handling targeting of release packages

scripts/devops_tasks/install_python_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
MANIFEST_LOCATION = "https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json"
2020

2121
MAX_INSTALLER_RETRY = 3
22-
CURRENT_UBUNTU_VERSION = "18.04" # full title is ubuntu-18.04
22+
CURRENT_UBUNTU_VERSION = "20.04" # full title is ubuntu-20.04
2323
MAX_PRECACHED_VERSION = "3.9.0"
2424

2525
UNIX_INSTALL_ARRAY = ["sh", "setup.sh"]

scripts/devops_tasks/setup_execute_tests.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
clean_coverage,
2626
is_error_code_5_allowed,
2727
create_code_coverage_params,
28+
filter_packages_by_compatibility_override
2829
)
2930
from tox_harness import prep_and_run_tox
3031

@@ -295,15 +296,20 @@ def execute_global_install_and_test(
295296
target_dir = root_dir
296297

297298
targeted_packages = process_glob_string(args.glob_string, target_dir, "", args.filter_type)
299+
compatible_targeted_packages = filter_packages_by_compatibility_override(targeted_packages)
300+
301+
if targeted_packages != compatible_targeted_packages:
302+
logging.info("At least one package incompatible with current platform was detected. Skipping: {}".format(set(targeted_packages) - set(compatible_targeted_packages)))
303+
298304
extended_pytest_args = []
299305

300-
if len(targeted_packages) == 0:
306+
if len(compatible_targeted_packages) == 0:
301307
exit(0)
302308

303309
if args.xdist:
304310
extended_pytest_args.extend(["-n", "8", "--dist=loadscope"])
305311

306312
if args.runtype != "none":
307-
execute_global_install_and_test(args, targeted_packages, extended_pytest_args)
313+
execute_global_install_and_test(args, compatible_targeted_packages, extended_pytest_args)
308314
else:
309-
prep_and_run_tox(targeted_packages, args, extended_pytest_args)
315+
prep_and_run_tox(compatible_targeted_packages, args, extended_pytest_args)

sdk/core/azure-core-tracing-opentelemetry/tests/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# ------------------------------------
55
from opentelemetry import trace
66
from opentelemetry.sdk.trace import TracerProvider
7+
import sys
78

89
import pytest
910

sdk/core/azure-core/tests/test_basic_transport.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1200,6 +1200,6 @@ def test_conflict_timeout(caplog, port, http_request):
12001200
def test_aiohttp_loop():
12011201
import asyncio
12021202
from azure.core.pipeline.transport import AioHttpTransport
1203-
loop = asyncio._get_running_loop()
1203+
loop = asyncio.get_event_loop()
12041204
with pytest.raises(ValueError):
12051205
transport = AioHttpTransport(loop=loop)

0 commit comments

Comments
 (0)