Skip to content

Commit 09318f7

Browse files
committed
Hotfix python3-modules build: pin mypy<2
pytokens pulls in mypy 2.0.0 (released 2026-05-06) as a build time dependency, which requires rustc>=1.91. The build image ships rustc 1.90, so pytokens fails to build because mypy is pulled in unconstrained by its mypyc self-compilation step. Wire constraints.txt into the python3-modules genrule via PIP_CONSTRAINT so that build envs honor it. CMK-34707 Change-Id: Ibcb1b1cf8dc711aa679c879d852165e6ed5c0dbf
1 parent 4456dd9 commit 09318f7

5 files changed

Lines changed: 10 additions & 0 deletions

File tree

community-requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2887,6 +2887,7 @@ mypy==1.19.1 \
28872887
--hash=sha256:f859fb09d9583a985be9a493d5cfc5515b56b08f7447759a0c5deaf68d80506e \
28882888
--hash=sha256:ffcebe56eb09ff0c0885e750036a095e23793ba6c2e894e7e63f6d89ad51f22e
28892889
# via
2890+
# -c constraints.txt
28902891
# -c requirements.txt
28912892
# -r tests/dev-requirements.in
28922893
# pylsp-mypy

constraints.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ mypy-protobuf==3.7.0 # CMK-28939
55
types-lxml==2025.11.25 # CMK-28940
66
google-cloud-asset==4.1.0 # CMK-29107
77
redis~=7.2.1 # CMK-31558
8+
mypy<2 # CMK-34707 pytokens pulls in mypy 2.0.0 and ast-serialize, which requires rustc>=1.91 (build image has 1.90); pulled in by pytokens via mypyc

omd/packages/python3-modules/BUILD

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ config_setting(
2222
srcs = [
2323
"%s_requirements.txt" % module,
2424
":git_wrapper",
25+
"//:constraints.txt",
2526
"@freetds",
2627
"@openssl",
2728
"@python",
@@ -42,6 +43,7 @@ build_python_module(
4243
name = "netapp-ontap",
4344
srcs = [
4445
":git_wrapper",
46+
"//:constraints.txt",
4547
"@freetds",
4648
"@openssl",
4749
"@python",

omd/packages/python3-modules/build-python3-modules.bzl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ def build_python_module(name, srcs, outs, requirements = "", **kwargs):
2727
"""This macro is creating an empty file.
2828
"""
2929
requirements = requirements if requirements else "-r $$HOME/$(execpath %s_requirements.txt)" % name
30+
constraints = "$$HOME/$(execpath //:constraints.txt)"
3031
openssl_dir = Label("@openssl").repo_name
3132
freetds_dir = Label("@freetds").repo_name
3233
python_dir = Label("@python").repo_name
@@ -43,6 +44,7 @@ def build_python_module(name, srcs, outs, requirements = "", **kwargs):
4344
git_ssl_no_verify = "GIT_SSL_NO_VERIFY=true",
4445
pyMajMin = PYTHON_MAJOR_DOT_MINOR,
4546
requirements = requirements,
47+
constraints = constraints,
4648
openssl_dir = openssl_dir,
4749
freetds_dir = freetds_dir,
4850
python_dir = python_dir,
@@ -51,6 +53,7 @@ def build_python_module(name, srcs, outs, requirements = "", **kwargs):
5153
git_ssl_no_verify = "",
5254
pyMajMin = PYTHON_MAJOR_DOT_MINOR,
5355
requirements = requirements,
56+
constraints = constraints,
5457
openssl_dir = openssl_dir,
5558
freetds_dir = freetds_dir,
5659
python_dir = python_dir,
@@ -136,6 +139,8 @@ build_cmd = """
136139
--no-warn-script-location \\
137140
--root-user-action=ignore \\
138141
--disable-pip-version-check \\
142+
--use-feature=build-constraint \\
143+
--build-constraint="{constraints}" \\
139144
--prefix="$$HOME/$$MODULE_NAME" \\
140145
{requirements} 2>&1 | tee "$$HOME/""$$MODULE_NAME""_pip_install.stdout"
141146

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2803,6 +2803,7 @@ mypy==1.19.1 \
28032803
--hash=sha256:f859fb09d9583a985be9a493d5cfc5515b56b08f7447759a0c5deaf68d80506e \
28042804
--hash=sha256:ffcebe56eb09ff0c0885e750036a095e23793ba6c2e894e7e63f6d89ad51f22e
28052805
# via
2806+
# -c constraints.txt
28062807
# -r tests/dev-requirements.in
28072808
# pylsp-mypy
28082809
mypy-boto3-logs==1.42.10 \

0 commit comments

Comments
 (0)