Repository: burnash/gspread (branch: feature/release_6_0_0)
Commit date: 2023-11-05T12:14:28Z

Workflow file: .github/workflows/main.yaml (lint_python)
name: lint_python
on:
  push:
    branches:
      - "**" # run all branches
    tags-ignore:
      - "*" # ignore all tags, release.yaml will trigger the CI
  pull_request: # run on all pull requests

concurrency:
  cancel-in-progress: true
  group: group-${{ github.ref_name }}

jobs:
  lint_python:
    runs-on: ubuntu-latest
    services:
      pypi_wayback:
        image: ghcr.io/waleko/pypi-wayback
        ports:
          - 8629:8080
    strategy:
      fail-fast: false
      matrix:
        python: ["3.8", "3.9", "3.10", "3.11", "3.x"]
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v4
        with:
          python-version: ${{ matrix.python }}
      - run: pip install -U pip
      - run: pip install -U bandit mypy pyupgrade safety tox setuptools
      - run: bandit --recursive --skip B105,B110,B311,B605,B607 --exclude ./.tox .
        if: ${{ matrix.python >= '3.8' }}
      - run: tox -e lint
      - run: tox -e py
      - run: shopt -s globstar && pyupgrade --py3-only **/*.py # --py36-plus
      - run: safety check -i 42559 # pip <= 20.1.1, we upgrade it just above
      - run: tox -e build
      - run: tox -e doc

env:
  PIP_INDEX_URL: http://localhost:8629/2023-11-05
  UV_INDEX_URL: http://localhost:8629/2023-11-05


Failed build logs:
step_name: lint_python (3.8)/7_Run tox -e lint.txt
log: ##[group]Run tox -e lint
[36;1mtox -e lint[0m
shell: /usr/bin/bash -e {0}
env:
  pythonLocation: /opt/hostedtoolcache/Python/3.8.18/x64
  PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.8.18/x64/lib/pkgconfig
  Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.8.18/x64
  Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.8.18/x64
  Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.8.18/x64
  LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.8.18/x64/lib
##[endgroup]
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 /opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/pyproject_api/_backend.py True flit_core.buildapi
.pkg: get_requires_for_build_sdist> python /opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/pyproject_api/_backend.py True flit_core.buildapi
.pkg: build_sdist> python /opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/pyproject_api/_backend.py True flit_core.buildapi
lint: install_package_deps> python -I -m pip install StrEnum==0.4.15 'google-auth-oauthlib>=0.4.1' 'google-auth>=1.12.0'
lint: install_package> python -I -m pip install --force-reinstall --no-deps /home/runner/work/gspread/gspread/.tox/.pkg/dist/gspread-6.0.0.tar.gz
lint: commands[0]> black --check --diff --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 2 files
lint: commands[4]> mypy --install-types --non-interactive --ignore-missing-imports ./gspread
Collecting types-requests
  Downloading types_requests-2.31.0.10-py3-none-any.whl.metadata (1.8 kB)
Requirement already satisfied: urllib3>=2 in ./.tox/lint/lib/python3.8/site-packages (from types-requests) (2.0.7)
Downloading types_requests-2.31.0.10-py3-none-any.whl (14 kB)
Installing collected packages: types-requests
Successfully installed types-requests-2.31.0.10
gspread/worksheet.py:316: error: Item "List[List[Any]]" of "Union[ValueRange, List[List[Any]]]" has no attribute "first"  [union-attr]
Installing missing stub packages:
/home/runner/work/gspread/gspread/.tox/lint/bin/python -m pip install types-requests


Found 1 error in 1 file (checked 10 source files)
lint: exit 1 (4.89 seconds) /home/runner/work/gspread/gspread> mypy --install-types --non-interactive --ignore-missing-imports ./gspread pid=2072
.pkg: _exit> python /opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/pyproject_api/_backend.py True flit_core.buildapi
  lint: FAIL code 1 (22.65=setup[14.30]+cmd[1.09,0.93,1.23,0.21,4.89] seconds)
  evaluation failed :( (22.93 seconds)
##[error]Process completed with exit code 1.

step_name: lint_python (3.9)/7_Run tox -e lint.txt
log: ##[group]Run tox -e lint
[36;1mtox -e lint[0m
shell: /usr/bin/bash -e {0}
env:
  pythonLocation: /opt/hostedtoolcache/Python/3.9.18/x64
  PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.9.18/x64/lib/pkgconfig
  Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64
  Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64
  Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64
  LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.9.18/x64/lib
##[endgroup]
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 /opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/pyproject_api/_backend.py True flit_core.buildapi
.pkg: get_requires_for_build_sdist> python /opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/pyproject_api/_backend.py True flit_core.buildapi
.pkg: build_sdist> python /opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/pyproject_api/_backend.py True flit_core.buildapi
lint: install_package_deps> python -I -m pip install StrEnum==0.4.15 'google-auth-oauthlib>=0.4.1' 'google-auth>=1.12.0'
lint: install_package> python -I -m pip install --force-reinstall --no-deps /home/runner/work/gspread/gspread/.tox/.pkg/dist/gspread-6.0.0.tar.gz
lint: commands[0]> black --check --diff --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 2 files
lint: commands[4]> mypy --install-types --non-interactive --ignore-missing-imports ./gspread
Collecting types-requests
  Downloading types_requests-2.31.0.10-py3-none-any.whl.metadata (1.8 kB)
Requirement already satisfied: urllib3>=2 in ./.tox/lint/lib/python3.9/site-packages (from types-requests) (2.0.7)
Downloading types_requests-2.31.0.10-py3-none-any.whl (14 kB)
Installing collected packages: types-requests
Successfully installed types-requests-2.31.0.10
gspread/worksheet.py:316: error: Item "list[list[Any]]" of "Union[ValueRange, list[list[Any]]]" has no attribute "first"  [union-attr]
Installing missing stub packages:
/home/runner/work/gspread/gspread/.tox/lint/bin/python -m pip install types-requests


Found 1 error in 1 file (checked 10 source files)
lint: exit 1 (3.81 seconds) /home/runner/work/gspread/gspread> mypy --install-types --non-interactive --ignore-missing-imports ./gspread pid=2225
.pkg: _exit> python /opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/pyproject_api/_backend.py True flit_core.buildapi
  lint: FAIL code 1 (17.76=setup[11.70]+cmd[0.79,0.64,0.66,0.16,3.81] seconds)
  evaluation failed :( (17.91 seconds)
##[error]Process completed with exit code 1.

step_name: lint_python (3.10)/7_Run tox -e lint.txt
log: ##[group]Run tox -e lint
[36;1mtox -e lint[0m
shell: /usr/bin/bash -e {0}
env:
  pythonLocation: /opt/hostedtoolcache/Python/3.10.13/x64
  PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.10.13/x64/lib/pkgconfig
  Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.10.13/x64
  Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.10.13/x64
  Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.10.13/x64
  LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.10.13/x64/lib
##[endgroup]
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 /opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/pyproject_api/_backend.py True flit_core.buildapi
.pkg: get_requires_for_build_sdist> python /opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/pyproject_api/_backend.py True flit_core.buildapi
.pkg: build_sdist> python /opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/pyproject_api/_backend.py True flit_core.buildapi
lint: install_package_deps> python -I -m pip install StrEnum==0.4.15 'google-auth-oauthlib>=0.4.1' 'google-auth>=1.12.0'
lint: install_package> python -I -m pip install --force-reinstall --no-deps /home/runner/work/gspread/gspread/.tox/.pkg/dist/gspread-6.0.0.tar.gz
lint: commands[0]> black --check --diff --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 2 files
lint: commands[4]> mypy --install-types --non-interactive --ignore-missing-imports ./gspread
Collecting types-requests
  Downloading types_requests-2.31.0.10-py3-none-any.whl.metadata (1.8 kB)
Requirement already satisfied: urllib3>=2 in ./.tox/lint/lib/python3.10/site-packages (from types-requests) (2.0.7)
Downloading types_requests-2.31.0.10-py3-none-any.whl (14 kB)
Installing collected packages: types-requests
Successfully installed types-requests-2.31.0.10
gspread/worksheet.py:316: error: Item "list[list[Any]]" of "ValueRange | list[list[Any]]" has no attribute "first"  [union-attr]
Installing missing stub packages:
/home/runner/work/gspread/gspread/.tox/lint/bin/python -m pip install types-requests


Found 1 error in 1 file (checked 10 source files)
lint: exit 1 (3.61 seconds) /home/runner/work/gspread/gspread> mypy --install-types --non-interactive --ignore-missing-imports ./gspread pid=2090
.pkg: _exit> python /opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/pyproject_api/_backend.py True flit_core.buildapi
  lint: FAIL code 1 (16.84=setup[11.02]+cmd[0.74,0.64,0.66,0.16,3.61] seconds)
  evaluation failed :( (16.98 seconds)
##[error]Process completed with exit code 1.

step_name: lint_python (3.11)/7_Run tox -e lint.txt
log: ##[group]Run tox -e lint
[36;1mtox -e lint[0m
shell: /usr/bin/bash -e {0}
env:
  pythonLocation: /opt/hostedtoolcache/Python/3.11.6/x64
  PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.11.6/x64/lib/pkgconfig
  Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.6/x64
  Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.6/x64
  Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.6/x64
  LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.11.6/x64/lib
##[endgroup]
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 /opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/site-packages/pyproject_api/_backend.py True flit_core.buildapi
.pkg: get_requires_for_build_sdist> python /opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/site-packages/pyproject_api/_backend.py True flit_core.buildapi
.pkg: build_sdist> python /opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/site-packages/pyproject_api/_backend.py True flit_core.buildapi
lint: install_package_deps> python -I -m pip install StrEnum==0.4.15 'google-auth-oauthlib>=0.4.1' 'google-auth>=1.12.0'
lint: install_package> python -I -m pip install --force-reinstall --no-deps /home/runner/work/gspread/gspread/.tox/.pkg/dist/gspread-6.0.0.tar.gz
lint: commands[0]> black --check --diff --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 2 files
lint: commands[4]> mypy --install-types --non-interactive --ignore-missing-imports ./gspread
Collecting types-requests
  Downloading types_requests-2.31.0.10-py3-none-any.whl.metadata (1.8 kB)
Requirement already satisfied: urllib3>=2 in ./.tox/lint/lib/python3.11/site-packages (from types-requests) (2.0.7)
Downloading types_requests-2.31.0.10-py3-none-any.whl (14 kB)
Installing collected packages: types-requests
Successfully installed types-requests-2.31.0.10
gspread/worksheet.py:316: error: Item "list[list[Any]]" of "ValueRange | list[list[Any]]" has no attribute "first"  [union-attr]
Installing missing stub packages:
/home/runner/work/gspread/gspread/.tox/lint/bin/python -m pip install types-requests


Found 1 error in 1 file (checked 10 source files)
lint: exit 1 (4.67 seconds) /home/runner/work/gspread/gspread> mypy --install-types --non-interactive --ignore-missing-imports ./gspread pid=2066
.pkg: _exit> python /opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/site-packages/pyproject_api/_backend.py True flit_core.buildapi
  lint: FAIL code 1 (21.32=setup[13.58]+cmd[1.29,0.76,0.83,0.19,4.67] seconds)
  evaluation failed :( (21.45 seconds)
##[error]Process completed with exit code 1.

step_name: lint_python (3.x)/7_Run tox -e lint.txt
log: ##[group]Run tox -e lint
[36;1mtox -e lint[0m
shell: /usr/bin/bash -e {0}
env:
  pythonLocation: /opt/hostedtoolcache/Python/3.12.0/x64
  PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.12.0/x64/lib/pkgconfig
  Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.0/x64
  Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.0/x64
  Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.0/x64
  LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.12.0/x64/lib
##[endgroup]
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 /opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/pyproject_api/_backend.py True flit_core.buildapi
.pkg: get_requires_for_build_sdist> python /opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/pyproject_api/_backend.py True flit_core.buildapi
.pkg: build_sdist> python /opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/pyproject_api/_backend.py True flit_core.buildapi
lint: install_package_deps> python -I -m pip install StrEnum==0.4.15 'google-auth-oauthlib>=0.4.1' 'google-auth>=1.12.0'
lint: install_package> python -I -m pip install --force-reinstall --no-deps /home/runner/work/gspread/gspread/.tox/.pkg/dist/gspread-6.0.0.tar.gz
lint: commands[0]> black --check --diff --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 2 files
lint: commands[4]> mypy --install-types --non-interactive --ignore-missing-imports ./gspread
Collecting types-requests
  Downloading types_requests-2.31.0.10-py3-none-any.whl.metadata (1.8 kB)
Requirement already satisfied: urllib3>=2 in ./.tox/lint/lib/python3.12/site-packages (from types-requests) (2.0.7)
Downloading types_requests-2.31.0.10-py3-none-any.whl (14 kB)
Installing collected packages: types-requests
Successfully installed types-requests-2.31.0.10
gspread/worksheet.py:316: error: Item "list[list[Any]]" of "ValueRange | list[list[Any]]" has no attribute "first"  [union-attr]
Installing missing stub packages:
/home/runner/work/gspread/gspread/.tox/lint/bin/python -m pip install types-requests


Found 1 error in 1 file (checked 10 source files)
lint: exit 1 (4.07 seconds) /home/runner/work/gspread/gspread> mypy --install-types --non-interactive --ignore-missing-imports ./gspread pid=2089
.pkg: _exit> python /opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/pyproject_api/_backend.py True flit_core.buildapi
  lint: FAIL code 1 (18.77=setup[12.09]+cmd[1.17,0.62,0.66,0.16,4.07] seconds)
  evaluation failed :( (18.83 seconds)
##[error]Process completed with exit code 1.


Changed files:
gspread/worksheet.py

Fix diff:
diff --git a/gspread/worksheet.py b/gspread/worksheet.py
index 9812bc8..c224cb2 100644
--- a/gspread/worksheet.py
+++ b/gspread/worksheet.py
@@ -310,10 +310,14 @@ class Worksheet:
         """
         try:
             data = self.get(
-                rowcol_to_a1(row, col), value_render_option=value_render_option
+                rowcol_to_a1(row, col),
+                value_render_option=value_render_option,
+                return_type=GridRangeType.ValueRange,
             )
-
-            value = str(data.first())
+            try:
+                value = str(data[0][0])
+            except IndexError:
+                value = str(None)
         except KeyError:
             value = ""