Skip to content
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

gspread 6.0.0 - be careful #124

Closed
djhmateer opened this issue Jan 30, 2024 · 4 comments
Closed

gspread 6.0.0 - be careful #124

djhmateer opened this issue Jan 30, 2024 · 4 comments

Comments

@djhmateer
Copy link
Contributor

I'm pinning gspread for the time being to 5.12.4 as I found an issue in 6.0.0 version:

https://github.com/bellingcat/auto-archiver/blob/main/src/auto_archiver/feeders/gsheet_feeder.py#L60

  # 30th Jan - refresh the status just in case
  status = gw.get_cell(row, 'status', fresh=original_status in ['', None])

  # 30th Jan - when refreshed cell comes back, it is now a string 'None'
  # I had just done a pipenv update to gspread 6.0.0
  # reverting to 5.12.4 works as expected
  if status not in ['', None]: continue

  # this worked with 6.0.0 but not happy as it may have other effects in codebase
  # if status not in ['', None, 'None']: continue
@GalenReich
Copy link
Contributor

Thanks @djhmateer, pinning to 5.12.4 seems like a sensible idea until we know if there are any cases that are broken by gspread 6.0.0.

Looks like this change occurred here: burnash/gspread@6457676

@msramalho
Copy link
Contributor

Pinning is a good decision for now.

Adapting to the new version should not be too hard and require changes only to https://github.com/bellingcat/auto-archiver/blob/main/src/auto_archiver/utils/gworksheet.py

namely

if fresh:
return self.wks.cell(row, col_index + 1).value

should be

        if fresh:
            val = self.wks.cell(row, col_index + 1).value
            return val if val != "None" else ""

to keep consistency.

I'm not making the changes yet since testing if there were other changes to gspread.worksheet.get_values() to return "None"s too. But those are the only 2 places we interact with the gspread.worksheet to read the values.

@msramalho
Copy link
Contributor

gspread devs were quick to acknowledge this and there will be a patch in 6.0.1: burnash/gspread#1403

@msramalho
Copy link
Contributor

warning stands: do not use gspread 6.0.0, we can fix it at >=6.0.1 after that's released and tested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants