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

feature/readme migration v6 #1297

Merged
merged 11 commits into from
Oct 25, 2023
52 changes: 52 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,61 @@ Features:
## v6.0.0 migration

### Silence the warnings
lavigne958 marked this conversation as resolved.
Show resolved Hide resolved

In version 5 there are many warnings to mark deprecated feature/functions/methods.
They can be silenced by setting the `GSPREAD_SILENCE_WARNINGS` environment variable to `1`

### HTTP Client

HTTP Clients have moved a dedicated file. GSpread uses by default the `HTTPClient`.
If you wish to use the new `BackoffHTTPClient` please update your code as follow:
lavigne958 marked this conversation as resolved.
Show resolved Hide resolved

```pythong
lavigne958 marked this conversation as resolved.
Show resolved Hide resolved
client = gspread.service_account(http_client=gspread.http_client.BackOffHTTPClient)
```

It works the same wayt for:

- `gspread.service_account`
- `gspread.oauth`
- `gspread.service_account_from_dict`
- `gspread.oauth_from_dict`
alifeee marked this conversation as resolved.
Show resolved Hide resolved

### Stop support for python-3.7
lavigne958 marked this conversation as resolved.
Show resolved Hide resolved

Python-3.7 is now end-of-life, GSpread stopped supporting it.

Lowest supported python version: 3.8
lavigne958 marked this conversation as resolved.
Show resolved Hide resolved

### Method signature changes
lavigne958 marked this conversation as resolved.
Show resolved Hide resolved

The method ``Worksheet.update()`` has changed it's signature. The arguments ``range_name`` and ``values`` have swapped.

Please now use kwargs to assign arguments to be compatible with both v5.X.Y and v6.X.Y version.

```python
file.sheet1.update(range_name="I7", values=[["54"]])
```

#### Notice:
lavigne958 marked this conversation as resolved.
Show resolved Hide resolved

the argument `values` must be a list of list !
lavigne958 marked this conversation as resolved.
Show resolved Hide resolved

### New tab color usage
lavigne958 marked this conversation as resolved.
Show resolved Hide resolved

GSpread now uses hexadecimal value to color a tab.

You can use the utility function `gspread.utils.convert_colors_to_hex_value` to convert dict values to a single hexadecimal values.

The method ``gspread.Worksheet.update_tab_color()` accepts both dict and string values.

You can update you code as follow:
lavigne958 marked this conversation as resolved.
Show resolved Hide resolved

```python
tab_color = {"red": 1, "green": 0.1345, "blue": 1}
file.sheet1.update_tab_color(convert_colors_to_hex_value(**tab_color))
```

## Installation

```sh
Expand Down