From cc8d23d4d567d4133fc5d384b250a8d208905537 Mon Sep 17 00:00:00 2001 From: jrmccluskey Date: Tue, 28 Mar 2023 16:56:13 +0000 Subject: [PATCH 1/2] Add explicit language_level=3 arg to Cythonize --- sdks/python/setup.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sdks/python/setup.py b/sdks/python/setup.py index 38c5206d2227..28c4a23d6784 100644 --- a/sdks/python/setup.py +++ b/sdks/python/setup.py @@ -203,7 +203,6 @@ def get_portability_package_data(): ] }, ext_modules=cythonize([ - # Make sure to use language_level=3 cython directive in files below. 'apache_beam/**/*.pyx', 'apache_beam/coders/coder_impl.py', 'apache_beam/metrics/cells.py', @@ -216,7 +215,7 @@ def get_portability_package_data(): 'apache_beam/transforms/stats.py', 'apache_beam/utils/counters.py', 'apache_beam/utils/windowed_value.py', - ]), + ], language_level=3), install_requires = [ 'crcmod>=1.7,<2.0', 'orjson<4.0', From 1dc669f3d254dd46b85ae7720f2dfcdc15629984 Mon Sep 17 00:00:00 2001 From: jrmccluskey Date: Tue, 28 Mar 2023 16:57:46 +0000 Subject: [PATCH 2/2] Linting --- sdks/python/setup.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sdks/python/setup.py b/sdks/python/setup.py index 28c4a23d6784..cf2a3d09eb94 100644 --- a/sdks/python/setup.py +++ b/sdks/python/setup.py @@ -36,7 +36,7 @@ # It is recommended to import setuptools prior to importing distutils to avoid # using legacy behavior from distutils. # https://setuptools.readthedocs.io/en/latest/history.html#v48-0-0 -from distutils.errors import DistutilsError # isort:skip +from distutils.errors import DistutilsError # isort:skip class mypy(Command): @@ -127,6 +127,7 @@ def get_version(): try: # pylint: disable=wrong-import-position from Cython.Build import cythonize as cythonize0 + def cythonize(*args, **kwargs): import numpy extensions = cythonize0(*args, **kwargs) @@ -142,6 +143,7 @@ def cythonize(*args, **kwargs): else: pyarrow_dependency = 'pyarrow>=3.0.0,<10.0.0' + # We must generate protos after setup_requires are installed. def generate_protos_first(): try: