diff --git a/packages/google-auth/noxfile.py b/packages/google-auth/noxfile.py index 5962f96bf094..3bbe04bbb1ad 100644 --- a/packages/google-auth/noxfile.py +++ b/packages/google-auth/noxfile.py @@ -174,12 +174,28 @@ def unit(session, install_deprecated_extras): constraints_path = str( CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" ) - extras_str = "testing" if install_deprecated_extras: + extras_str = "testing,pyopenssl,enterprise_cert,rsa" # rsa and oauth2client were both archived and support dropped, - # but we still test old code paths + # but we still test old code paths session.install("oauth2client") - extras_str += ",rsa" + + # Use the dedicated extras constraints file if it exists + extras_constraints = ( + CURRENT_DIRECTORY / "testing" / f"constraints-extras-{session.python}.txt" + ) + if extras_constraints.exists(): + constraints_path = str(extras_constraints) + else: + constraints_path = str( + CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" + ) + else: + extras_str = "testing" + constraints_path = str( + CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" + ) + session.install("-e", f".[{extras_str}]", "-c", constraints_path) session.run( "pytest", diff --git a/packages/google-auth/setup.py b/packages/google-auth/setup.py index cf3148130d6e..461cf003acc8 100644 --- a/packages/google-auth/setup.py +++ b/packages/google-auth/setup.py @@ -19,7 +19,8 @@ from setuptools import setup cryptography_base_require = [ - "cryptography >= 38.0.3", + "cryptography >= 38.0.3; python_version < '3.14'", + "cryptography >= 41.0.5; python_version >= '3.14'", ] DEPENDENCIES = ( @@ -27,23 +28,34 @@ cryptography_base_require, ) -requests_extra_require = ["requests >= 2.20.0, < 3.0.0"] +requests_extra_require = [ + "requests >= 2.20.0, < 3.0.0; python_version < '3.11'", + "requests >= 2.30.0, < 3.0.0; python_version >= '3.11'", +] -aiohttp_extra_require = ["aiohttp >= 3.8.0, < 4.0.0", *requests_extra_require] +aiohttp_extra_require = [ + "aiohttp >= 3.8.0, < 4.0.0; python_version < '3.11'", + "aiohttp >= 3.9.0, < 4.0.0; python_version >= '3.11'", + *requests_extra_require, +] pyjwt_extra_require = ["pyjwt>=2.0"] reauth_extra_require = ["pyu2f>=0.1.5"] # TODO(https://github.com/googleapis/google-auth-library-python/issues/1738): Add bounds for pyopenssl dependency. -enterprise_cert_extra_require = ["pyopenssl"] +enterprise_cert_extra_require = [ + "pyopenssl>=23.2.0", +] -pyopenssl_extra_require = ["pyopenssl>=20.0.0"] +pyopenssl_extra_require = [ + "pyopenssl>=23.2.0", +] # TODO(https://github.com/googleapis/google-auth-library-python/issues/1739): Add bounds for urllib3 and packaging dependencies. urllib3_extra_require = ["urllib3", "packaging"] -rsa_extra_require = ["rsa>=3.1.4,<5"] +rsa_extra_require = ["rsa>=4.0,<5"] # Unit test requirements. testing_extra_require = [ diff --git a/packages/google-auth/testing/constraints-3.10.txt b/packages/google-auth/testing/constraints-3.10.txt index 31094f0391cb..0c969a5c9d63 100644 --- a/packages/google-auth/testing/constraints-3.10.txt +++ b/packages/google-auth/testing/constraints-3.10.txt @@ -1,10 +1,5 @@ -# This constraints file is used to check that lower bounds -# are correct in setup.py -# List *all* library dependencies and extras in this file. -# Pin the version to the lower bound. -# -# e.g., if setup.py has "foo >= 1.14.0, < 2.0.0dev", -# Then this file should have foo==1.14.0 +# Lower-bound constraints for Python 3.10 core dependencies. +# Used during CI unit tests to verify minimum supported package versions. pyasn1-modules==0.2.1 setuptools==40.3.0 cryptography==38.0.3 diff --git a/packages/google-auth/testing/constraints-3.11.txt b/packages/google-auth/testing/constraints-3.11.txt index 09aeeca1c1bc..f8d7e033cc76 100644 --- a/packages/google-auth/testing/constraints-3.11.txt +++ b/packages/google-auth/testing/constraints-3.11.txt @@ -1 +1,9 @@ -urllib3>2.0.0 \ No newline at end of file +# Lower-bound constraints for Python 3.11 core dependencies. +# Pins requests==2.30.0 and aiohttp==3.9.0 to maintain compatibility with urllib3 v2. +pyasn1-modules==0.2.1 +setuptools==40.3.0 +cryptography==38.0.3 +aiohttp==3.9.0 +requests==2.30.0 +pyjwt==2.0 +urllib3==2.0.0 \ No newline at end of file diff --git a/packages/google-auth/testing/constraints-3.12.txt b/packages/google-auth/testing/constraints-3.12.txt index 09aeeca1c1bc..8423ff531b76 100644 --- a/packages/google-auth/testing/constraints-3.12.txt +++ b/packages/google-auth/testing/constraints-3.12.txt @@ -1 +1,9 @@ -urllib3>2.0.0 \ No newline at end of file +# Lower-bound constraints for Python 3.12 core dependencies. +# Pins requests==2.30.0 and aiohttp==3.9.0 to maintain compatibility with urllib3 v2. +pyasn1-modules==0.2.1 +setuptools==40.3.0 +cryptography==38.0.3 +aiohttp==3.9.0 +requests==2.30.0 +pyjwt==2.0 +urllib3==2.0.0 \ No newline at end of file diff --git a/packages/google-auth/testing/constraints-3.13.txt b/packages/google-auth/testing/constraints-3.13.txt index e69de29bb2d1..0976ef5d4485 100644 --- a/packages/google-auth/testing/constraints-3.13.txt +++ b/packages/google-auth/testing/constraints-3.13.txt @@ -0,0 +1,9 @@ +# Lower-bound constraints for Python 3.13 core dependencies. +# Pins requests==2.30.0 and aiohttp==3.9.0 to maintain compatibility with urllib3 v2. +pyasn1-modules==0.2.1 +setuptools==40.3.0 +cryptography==38.0.3 +aiohttp==3.9.0 +requests==2.30.0 +pyjwt==2.0 +urllib3==2.0.0 diff --git a/packages/google-auth/testing/constraints-3.14.txt b/packages/google-auth/testing/constraints-3.14.txt index e69de29bb2d1..c505b76997cf 100644 --- a/packages/google-auth/testing/constraints-3.14.txt +++ b/packages/google-auth/testing/constraints-3.14.txt @@ -0,0 +1,9 @@ +# Lower-bound constraints for Python 3.14 core dependencies. +# Pins cryptography==41.0.5 for CPython 3.14 C-extension compatibility, alongside requests==2.30.0 and aiohttp==3.9.0. +pyasn1-modules==0.2.1 +setuptools==40.3.0 +cryptography==41.0.5 +aiohttp==3.9.0 +requests==2.30.0 +pyjwt==2.0 +urllib3==2.0.0 diff --git a/packages/google-auth/testing/constraints-extras-3.10.txt b/packages/google-auth/testing/constraints-extras-3.10.txt new file mode 100644 index 000000000000..cbb5fb0e9634 --- /dev/null +++ b/packages/google-auth/testing/constraints-extras-3.10.txt @@ -0,0 +1,13 @@ +# Lower-bound constraints for Python 3.10 extended/optional extras (pyopenssl, rsa, enterprise_cert). +# Used during boundary Nox unit sessions (install_deprecated_extras=True) to test legacy/extra paths on 3.10. +# Note: cryptography==41.0.5 is required here because pyopenssl>=23.2.0 depends on cryptography>=41.0.5. +pyasn1-modules==0.2.1 +setuptools==40.3.0 +cryptography==41.0.5 +pyjwt==2.0 +pyopenssl==23.2.0 +pyu2f==0.1.5 +rsa==4.0 +aiohttp==3.8.0 +requests==2.30.0 +urllib3==1.26.15 diff --git a/packages/google-auth/testing/constraints-extras-3.14.txt b/packages/google-auth/testing/constraints-extras-3.14.txt new file mode 100644 index 000000000000..170a01286264 --- /dev/null +++ b/packages/google-auth/testing/constraints-extras-3.14.txt @@ -0,0 +1,12 @@ +# Lower-bound constraints for Python 3.14 extended/optional extras (pyopenssl, rsa, enterprise_cert). +# Used during boundary Nox unit sessions (install_deprecated_extras=True) to test legacy/extra paths on 3.14. +pyasn1-modules==0.2.1 +setuptools==40.3.0 +cryptography==41.0.5 +pyjwt==2.0 +pyopenssl==23.2.0 +pyu2f==0.1.5 +rsa==4.0 +aiohttp==3.9.0 +requests==2.30.0 +urllib3==2.0.0