Skip to content

Commit ee72f5e

Browse files
authored
Allow psycopg2 2.9.10 (#34893)
* Allow psycopg2 2.9.10 * try dependency specifieres * split out logic to own function + formatting * swap to more general psycopg2 bounds
1 parent f258f0c commit ee72f5e

File tree

1 file changed

+18
-25
lines changed

1 file changed

+18
-25
lines changed

sdks/python/setup.py

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -222,18 +222,18 @@ def generate_external_transform_wrappers():
222222
script_exists = os.path.exists(
223223
os.path.join(sdk_dir, 'gen_xlang_wrappers.py'))
224224
config_exists = os.path.exists(
225-
os.path.join(os.path.dirname(sdk_dir),
226-
'standard_external_transforms.yaml'))
225+
os.path.join(
226+
os.path.dirname(sdk_dir), 'standard_external_transforms.yaml'))
227227
# we need both the script and the standard transforms config file.
228228
# at build time, we don't have access to apache_beam to discover and
229229
# retrieve external transforms, so the config file has to already exist
230230
if not script_exists or not config_exists:
231231
generated_transforms_dir = os.path.join(
232-
sdk_dir, 'apache_beam', 'transforms', 'xlang')
232+
sdk_dir, 'apache_beam', 'transforms', 'xlang')
233233

234234
# if exists, this directory will have at least its __init__.py file
235235
if (not os.path.exists(generated_transforms_dir) or
236-
len(os.listdir(generated_transforms_dir)) <= 1):
236+
len(os.listdir(generated_transforms_dir)) <= 1):
237237
message = 'External transform wrappers have not been generated '
238238
if not script_exists:
239239
message += 'and the generation script `gen_xlang_wrappers.py`'
@@ -251,13 +251,16 @@ def generate_external_transform_wrappers():
251251
os.path.join(sdk_dir, 'gen_xlang_wrappers.py'),
252252
'--cleanup',
253253
'--transforms-config-source',
254-
os.path.join(os.path.dirname(sdk_dir),
255-
'standard_external_transforms.yaml')
256-
], capture_output=True, check=True)
254+
os.path.join(
255+
os.path.dirname(sdk_dir), 'standard_external_transforms.yaml')
256+
],
257+
capture_output=True,
258+
check=True)
257259
except subprocess.CalledProcessError as err:
258260
raise RuntimeError(
259261
'Could not generate external transform wrappers due to '
260-
'error: %s', err.stderr)
262+
'error: %s',
263+
err.stderr)
261264

262265

263266
def get_portability_package_data():
@@ -417,7 +420,8 @@ def get_portability_package_data():
417420
'scikit-learn>=0.20.0',
418421
'setuptools',
419422
'sqlalchemy>=1.3,<3.0',
420-
'psycopg2-binary>=2.8.5,<3.0.0,!=2.9.10',
423+
'psycopg2-binary>=2.8.5,<2.9.10; python_version <= "3.9"',
424+
'psycopg2-binary>=2.8.5,<3.0; python_version >= "3.10"',
421425
'testcontainers[mysql]>=3.0.3,<4.0.0',
422426
'cryptography>=41.0.2',
423427
'hypothesis>5.0.0,<7.0.0',
@@ -546,20 +550,14 @@ def get_portability_package_data():
546550
# in https://github.com/apache/beam/blob/master/sdks/python/tox.ini
547551
# For more info, see
548552
# https://docs.google.com/document/d/1c84Gc-cZRCfrU8f7kWGsNR2o8oSRjCM-dGHO9KvPWPw/edit?usp=sharing
549-
'torch': [
550-
'torch<=1.13.0,<2.1.0'
551-
],
552-
'tensorflow': [
553-
'tensorflow>=2.12rc1,<2.13'
554-
],
553+
'torch': ['torch<=1.13.0,<2.1.0'],
554+
'tensorflow': ['tensorflow>=2.12rc1,<2.13'],
555555
'transformers': [
556556
'transformers>=4.28.0,<4.49.0',
557557
'tensorflow==2.12.0',
558558
'torch>=1.9.0,<2.1.0'
559559
],
560-
'tft': [
561-
'tensorflow_transform>=1.14.0,<1.15.0'
562-
],
560+
'tft': ['tensorflow_transform>=1.14.0,<1.15.0'],
563561
'onnx': [
564562
'onnxruntime==1.13.1',
565563
'torch==1.13.1',
@@ -568,13 +566,8 @@ def get_portability_package_data():
568566
'skl2onnx==1.13',
569567
'transformers==4.25.1'
570568
],
571-
'xgboost': [
572-
'xgboost>=1.6.0,<2.1.3',
573-
'datatable==1.0.0'
574-
],
575-
'tensorflow-hub': [
576-
'tensorflow-hub>=0.14.0,<0.16.0'
577-
]
569+
'xgboost': ['xgboost>=1.6.0,<2.1.3', 'datatable==1.0.0'],
570+
'tensorflow-hub': ['tensorflow-hub>=0.14.0,<0.16.0']
578571
},
579572
zip_safe=False,
580573
# PyPI package information.

0 commit comments

Comments
 (0)