-
Notifications
You must be signed in to change notification settings - Fork 953
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Python 3.12 and 3.13 #1541
base: master
Are you sure you want to change the base?
Support Python 3.12 and 3.13 #1541
Conversation
Because Python 3.8 has been end-of-life. See <https://devguide.python.org/versions/>
And fix some typo detected by codespell 2.4.1.
… 0.4.1 to 1.2.1. Because a dependency conflicts: google-auth 1.12.0 requires cachetools<5.0,>=2.0.0, but tox 4.24.1 requires cachetools>=5.5.
Note that vcrpy requires urllib3<2.0.0 with Python<3.10.
hey, thanks for this ! adding 3.12 and 3.13 support is a good idea. we could even add python 14 ! as for removing Python 3.8 support, I don't think we should do this without a good reason. Why remove support unless it starts causing problems !? (i.e., people have Python 3.7 specific bugs or we really want to use syntax that is Python 8 only). Removing Python 3.8 support also would warrant a major release. what do you think @lavigne958 ? |
Thanks for reviewing. Because Python 3.8 is end-of-life, many packages drop Python 3.8 support. # python --version
Python 3.8.20
# pip install -r test-requirements.txt
Ignoring urllib3: markers 'python_version == "3.9"' don't match your environment
Ignoring urllib3: markers 'python_version >= "3.10"' don't match your environment
Collecting google-auth==2.38.0
Downloading google_auth-2.38.0-py2.py3-none-any.whl (210 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 210.8/210.8 kB 7.6 MB/s eta 0:00:00
Collecting google-auth-oauthlib==1.2.1
Downloading google_auth_oauthlib-1.2.1-py2.py3-none-any.whl (24 kB)
ERROR: Ignored the following versions that require a different python version: 7.0.0 Requires-Python >=3.9
ERROR: Could not find a version that satisfies the requirement vcrpy==7.0.0 (from versions: 1.6.0.macosx-10.10-x86_64, 0.0.1, 0.0.2, 0.0.3, 0.0.4, 0.1.0, 0.2.0, 0.2.1, 0.3.0, 0.3.1, 0.3.2, 0.3.3, 0.3.4, 0.3.5, 0.4.0, 0.5.0, 0.6.0, 0.7.0, 1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.1.0, 1.1.1, 1.1.2, 1.1.3, 1.1.4, 1.2.0, 1.3.0, 1.4.0, 1.4.1, 1.4.2, 1.5.0, 1.5.1, 1.5.2, 1.6.0, 1.6.1, 1.7.0, 1.7.1, 1.7.2, 1.7.3, 1.7.4, 1.8.0, 1.9.0, 1.10.0, 1.10.1, 1.10.2, 1.10.3, 1.10.4, 1.10.5, 1.11.0, 1.11.1, 1.12.0, 1.13.0, 2.0.0, 2.0.1, 2.1.0, 2.1.1, 3.0.0, 4.0.0, 4.0.1, 4.0.2, 4.1.0, 4.1.1, 4.2.0, 4.2.1, 4.3.0, 4.3.1, 4.4.0, 5.0.0, 5.1.0, 6.0.0, 6.0.1, 6.0.2)
ERROR: No matching distribution found for vcrpy==7.0.0 And using end-of-life versions expose gspread to potential vulnerabilities. It would be a good idea to drop support for Python 3.8, both for continued development and to reduce security risks, wouldn't you? |
I'm also trying to support 3.14. The tests pass in docker python:3.14.0a4-bookworm. # python --version
Python 3.14.0a4
# tox -e lint
lint: install_deps> python -I -m pip install -r lint-requirements.txt
.pkg: install_requires> python -I -m pip install 'flit_core<4,>=3.2'
.pkg: _optional_hooks> python /root/gspread/.venv_py314a4/lib/python3.14/site-packages/pyproject_api/_backend.py True flit_core.buildapi
.pkg: get_requires_for_build_sdist> python /root/gspread/.venv_py314a4/lib/python3.14/site-packages/pyproject_api/_backend.py True flit_core.buildapi
.pkg: build_sdist> python /root/gspread/.venv_py314a4/lib/python3.14/site-packages/pyproject_api/_backend.py True flit_core.buildapi
lint: install_package_deps> python -I -m pip install 'google-auth-oauthlib>=1.2.1' 'google-auth>=2.38.0'
lint: install_package> python -I -m pip install --force-reinstall --no-deps /root/gspread/.tox/.tmp/package/1/gspread-6.1.2.tar.gz
lint: commands[0]> black --check --diff --color --extend-exclude ./env .
All done! ✨ 🍰 ✨
18 files would be left unchanged.
lint: commands[1]> codespell --skip=.tox,.git,./docs/build,.mypy_cache,./env .
lint: commands[2]> flake8 .
lint: commands[3]> isort --check-only .
Skipped 3 files
lint: commands[4]> mypy --install-types --non-interactive --ignore-missing-imports ./gspread ./tests
Installing missing stub packages:
/root/gspread/.tox/lint/bin/python -m pip install types-cachetools types-pyOpenSSL types-requests
Collecting types-cachetools
Downloading types_cachetools-5.5.0.20240820-py3-none-any.whl.metadata (1.7 kB)
Collecting types-pyOpenSSL
Downloading types_pyOpenSSL-24.1.0.20240722-py3-none-any.whl.metadata (2.1 kB)
Collecting types-requests
Downloading types_requests-2.32.0.20241016-py3-none-any.whl.metadata (1.9 kB)
Collecting types-cffi (from types-pyOpenSSL)
Downloading types_cffi-1.16.0.20241221-py3-none-any.whl.metadata (1.8 kB)
Collecting cryptography>=35.0.0 (from types-pyOpenSSL)
Downloading cryptography-44.0.0-cp39-abi3-manylinux_2_28_x86_64.whl.metadata (5.7 kB)
Requirement already satisfied: urllib3>=2 in ./.tox/lint/lib/python3.14/site-packages (from types-requests) (2.3.0)
Collecting cffi>=1.12 (from cryptography>=35.0.0->types-pyOpenSSL)
Downloading cffi-1.17.1.tar.gz (516 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Collecting types-setuptools (from types-cffi->types-pyOpenSSL)
Downloading types_setuptools-75.8.0.20250110-py3-none-any.whl.metadata (2.2 kB)
Collecting pycparser (from cffi>=1.12->cryptography>=35.0.0->types-pyOpenSSL)
Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes)
Downloading types_cachetools-5.5.0.20240820-py3-none-any.whl (4.1 kB)
Downloading types_pyOpenSSL-24.1.0.20240722-py3-none-any.whl (7.5 kB)
Downloading types_requests-2.32.0.20241016-py3-none-any.whl (15 kB)
Downloading cryptography-44.0.0-cp39-abi3-manylinux_2_28_x86_64.whl (4.2 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.2/4.2 MB 95.0 MB/s eta 0:00:00
Downloading types_cffi-1.16.0.20241221-py3-none-any.whl (19 kB)
Downloading types_setuptools-75.8.0.20250110-py3-none-any.whl (71 kB)
Downloading pycparser-2.22-py3-none-any.whl (117 kB)
Building wheels for collected packages: cffi
Building wheel for cffi (pyproject.toml) ... done
Created wheel for cffi: filename=cffi-1.17.1-cp314-cp314-linux_x86_64.whl size=472280 sha256=a34a5bd0391e8a061d137a90d7964b83afe83a7c1b61613245b1071dd000b1b4
Stored in directory: /root/.cache/pip/wheels/85/3e/2b/7c0859254cbe5f4713e7b11c150483d1ef85f20b084caea2ec
Successfully built cffi
Installing collected packages: types-setuptools, types-requests, types-cachetools, pycparser, types-cffi, cffi, cryptography, types-pyOpenSSL
Successfully installed cffi-1.17.1 cryptography-44.0.0 pycparser-2.22 types-cachetools-5.5.0.20240820 types-cffi-1.16.0.20241221 types-pyOpenSSL-24.1.0.20240722 types-requests-2.32.0.20241016 types-setuptools-75.8.0.20250110
Success: no issues found in 17 source files
.pkg: _exit> python /root/gspread/.venv_py314a4/lib/python3.14/site-packages/pyproject_api/_backend.py True flit_core.buildapi
lint: OK (20.42=setup[5.27]+cmd[0.61,0.56,0.37,0.08,13.53] seconds)
congratulations :) (20.46 seconds)
# tox -e py
py: install_deps> python -I -m pip install -r test-requirements.txt
.pkg: _optional_hooks> python /root/gspread/.venv_py314a4/lib/python3.14/site-packages/pyproject_api/_backend.py True flit_core.buildapi
.pkg: get_requires_for_build_sdist> python /root/gspread/.venv_py314a4/lib/python3.14/site-packages/pyproject_api/_backend.py True flit_core.buildapi
.pkg: build_sdist> python /root/gspread/.venv_py314a4/lib/python3.14/site-packages/pyproject_api/_backend.py True flit_core.buildapi
py: install_package_deps> python -I -m pip install 'google-auth-oauthlib>=1.2.1' 'google-auth>=2.38.0'
py: install_package> python -I -m pip install --force-reinstall --no-deps /root/gspread/.tox/.tmp/package/2/gspread-6.1.2.tar.gz
py: commands[0]> pytest tests/
============================================== test session starts ===============================================
platform linux -- Python 3.14.0a4, pytest-8.3.4, pluggy-1.5.0
cachedir: .tox/py/.pytest_cache
rootdir: /root/gspread
configfile: pyproject.toml
plugins: vcr-1.0.2
collected 149 items
tests/cell_test.py ....... [ 4%]
tests/client_test.py ............. [ 13%]
tests/spreadsheet_test.py ................. [ 24%]
tests/utils_test.py .............................. [ 44%]
tests/worksheet_test.py .................................................................................. [100%]
================================================ warnings summary ================================================
tests/worksheet_test.py:39
/root/gspread/tests/worksheet_test.py:39: PytestRemovedIn9Warning: Marks applied to fixtures have no effect
See docs: https://docs.pytest.org/en/stable/deprecations.html#applying-a-mark-to-a-fixture-function
@pytest.fixture(autouse=True)
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
========================================= 149 passed, 1 warning in 1.50s =========================================
.pkg: _exit> python /root/gspread/.venv_py314a4/lib/python3.14/site-packages/pyproject_api/_backend.py True flit_core.buildapi
py: OK (4.90=setup[3.09]+cmd[1.81] seconds)
congratulations :) (4.93 seconds) But failed on CI. Why is pydantic required on only CI environment? |
ah okay, I understand the desire to drop Python 3.8 As for Python 3.14, we can leave support for now and figure out problems later... |
This reverts commit def7490. Because `pydantic`, one of dependencies, does not appear to support Python 3.14-alpha.4. A part of errors is following: ``` × Building wheel for pydantic-core (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [64 lines of output] Running `maturin pep517 build-wheel -i /opt/hostedtoolcache/Python/3.14.0-alpha.4/x64/bin/python --compatibility off` 📦 Including license file "/tmp/pip-install-pq_aihtj/pydantic-core_31e4be53493445af80a37195491c61b2/LICENSE" 🍹 Building a mixed python/rust project 🔗 Found pyo3 bindings 🐍 Found CPython 3.14 at /opt/hostedtoolcache/Python/3.14.0-alpha.4/x64/bin/python 📡 Using build options features, bindings from pyproject.toml Compiling proc-macro2 v1.0.86 Compiling unicode-ident v1.0.12 Compiling target-lexicon v0.12.14 Compiling python3-dll-a v0.2.10 Compiling once_cell v1.19.0 Compiling stable_deref_trait v1.2.0 Compiling autocfg v1.3.0 Compiling libc v0.2.155 Compiling heck v0.5.0 Compiling num-traits v0.2.19 Compiling pyo3-build-config v0.22.2 Compiling litemap v0.7.3 Compiling version_check v0.9.5 Compiling quote v1.0.36 Compiling writeable v0.5.5 Compiling syn v2.0.68 Compiling rustversion v1.0.17 Compiling memoffset v0.9.1 Compiling memchr v2.7.4 Compiling pyo3-ffi v0.22.2 Compiling pyo3-macros-backend v0.22.2 error: failed to run custom build command for `pyo3-ffi v0.22.2` Caused by: process didn't exit successfully: `/tmp/pip-install-pq_aihtj/pydantic-core_31e4be53493445af80a37195491c61b2/target/release/build/pyo3-ffi-cbe9fbe36179524e/build-script-build` (exit status: 1) --- stdout cargo:rustc-check-cfg=cfg(Py_LIMITED_API) cargo:rustc-check-cfg=cfg(PyPy) cargo:rustc-check-cfg=cfg(GraalPy) cargo:rustc-check-cfg=cfg(py_sys_config, values("Py_DEBUG", "Py_REF_DEBUG", "Py_TRACE_REFS", "COUNT_ALLOCS")) cargo:rustc-check-cfg=cfg(invalid_from_utf8_lint) cargo:rustc-check-cfg=cfg(pyo3_disable_reference_pool) cargo:rustc-check-cfg=cfg(pyo3_leak_on_drop_without_reference_pool) cargo:rustc-check-cfg=cfg(diagnostic_namespace) cargo:rustc-check-cfg=cfg(c_str_lit) cargo:rustc-check-cfg=cfg(Py_3_7) cargo:rustc-check-cfg=cfg(Py_3_8) cargo:rustc-check-cfg=cfg(Py_3_9) cargo:rustc-check-cfg=cfg(Py_3_10) cargo:rustc-check-cfg=cfg(Py_3_11) cargo:rustc-check-cfg=cfg(Py_3_12) cargo:rustc-check-cfg=cfg(Py_3_13) cargo:rerun-if-env-changed=PYO3_CROSS cargo:rerun-if-env-changed=PYO3_CROSS_LIB_DIR cargo:rerun-if-env-changed=PYO3_CROSS_PYTHON_VERSION cargo:rerun-if-env-changed=PYO3_CROSS_PYTHON_IMPLEMENTATION cargo:rerun-if-env-changed=PYO3_PRINT_CONFIG cargo:rerun-if-env-changed=PYO3_USE_ABI3_FORWARD_COMPATIBILITY --- stderr error: the configured Python interpreter version (3.14) is newer than PyO3's maximum supported version (3.13) = help: please check if an updated version of PyO3 is available. Current version: 0.22.2 = help: set PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 to suppress this check and build anyway using the stable ABI warning: build failed, waiting for other jobs to finish... ```
Thanks for your feedback. I reverted the commit some errors occurred with Python 3.14-alpha.4. I would appreciate to accept this pull request if you could. |
sounds good to me :] I will wait a week for @lavigne958 to comment |
About This Pull Request
Main changes
Other changes
isort
from 5.12.0 to 6.0.0black
from 24.8.0 to 25.1.0mypy
from 1.11.2 to 1.14.1bandit
from 1.7.10 to 1.8.2google-auth
from 1.12.0 to 2.38.0google-auth-oauthlib
from 0.4.1 to 1.2.1I hope that this PR helps gspread project.
Thanks for reviewing :-)