Skip to content

Commit e9ca4c4

Browse files
authored
fix(google-auth): add cryptography bound for Python 3.14 (googleapis#17649)
### Summary of Changes Added `"cryptography >= 41.0.5; python_version >= '3.14'"` in `setup.py` and `cryptography==41.0.5` in `testing/constraints-3.14.txt`. ### Rationale In Python 3.14, the legacy `setuptools` / `pkg_resources` module was removed from the standard build environment. Older `cryptography` versions (`< 41.0`, including `google-auth`'s default lower bound `38.0.3`) utilized `pkg_resources` in their build hooks. When building from source (sdist) or installing on custom runtimes (such as Alpine Linux, ARM64, or non-manylinux environments), `cryptography 38.0.3` fails with a `ModuleNotFoundError: No module named 'pkg_resources'` build error. PyCA (Python Cryptography Authority) removed `pkg_resources` and updated setuptools-rust build hooks in `cryptography 41.0.5+`. Setting `"cryptography >= 41.0.5; python_version >= '3.14'"` ensures: 1. **Python 3.10–3.13**: `google-auth` continues to support `cryptography >= 38.0.3` (zero breaking changes for existing users). 2. **Python 3.14+**: `pip` automatically selects `cryptography >= 41.0.5` so installations and builds succeed cleanly across all platforms and architectures. --- ### **How to Reproduce** To reproduce the build failure on Python 3.14 without this fix: 1. **In a Python 3.14 environment**: ```bash pyenv activate py314 pip install --no-binary :all: "cryptography==38.0.3"
1 parent e9c6265 commit e9ca4c4

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

packages/google-auth/setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
from setuptools import setup
2020

2121
cryptography_base_require = [
22-
"cryptography >= 38.0.3",
22+
"cryptography >= 38.0.3; python_version < '3.14'",
23+
"cryptography >= 41.0.5; python_version >= '3.14'",
2324
]
2425

2526
DEPENDENCIES = (
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Lower-bound constraints for Python 3.14 core dependencies.
2+
# Used during CI unit tests to verify minimum supported package versions.
3+
pyasn1-modules==0.2.1
4+
cryptography==41.0.5

0 commit comments

Comments
 (0)