Skip to content

Commit 9e2cdcb

Browse files
committed
Drop support for python 2.7
1 parent b53822c commit 9e2cdcb

File tree

13 files changed

+19
-73
lines changed

13 files changed

+19
-73
lines changed

README.rst

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ Example
142142

143143
.. code:: python
144144
145-
from __future__ import print_function
146145
import pandas as pd
147146
from gspread_pandas import Spread, Client
148147
@@ -174,28 +173,6 @@ Example
174173
Troubleshooting
175174
===============
176175

177-
SSL Error
178-
---------
179-
180-
If you're getting an SSL related error or can't seem to be able to open existing
181-
spreadsheets that you have access to, you might be running into an issue caused by
182-
``certifi``. This has mainly been experienced on RHEL and CentOS running Python 2.7.
183-
You can read more about it in `issue 223
184-
<https://github.com/burnash/gspread/issues/223>`_
185-
and `issue 354 <https://github.com/burnash/gspread/issues/354>`_ but, in short, the
186-
solution is to either install a specific version of ``certifi`` that works for you,
187-
or remove it altogether.
188-
189-
.. code-block:: console
190-
191-
pip install certifi==2015.4.28
192-
193-
or
194-
195-
.. code-block:: console
196-
197-
pip uninstall certifi
198-
199176
EOFError in Rodeo
200177
-----------------
201178

gspread_pandas/client.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
from __future__ import print_function
2-
3-
from builtins import super
4-
51
import requests
6-
import six
72
from google.auth.credentials import Credentials
83
from google.auth.transport.requests import AuthorizedSession
94
from gspread.client import Client as ClientV4
@@ -86,7 +81,7 @@ def __init__(
8681
credentials = creds
8782
elif creds is not None and "oauth2client" in creds.__module__:
8883
credentials = convert_credentials(creds)
89-
elif isinstance(user, six.string_types):
84+
elif isinstance(user, str):
9085
credentials = get_creds(user, config, self.scope)
9186
else:
9287
raise TypeError(

gspread_pandas/conf.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
11
import json
22
import sys
33
from os import environ, name
4+
from pathlib import Path
45

5-
import six
66
from google.oauth2.credentials import Credentials as OAuthCredentials
77
from google.oauth2.service_account import Credentials as SACredentials
88
from google_auth_oauthlib.flow import InstalledAppFlow
99

1010
from gspread_pandas.exceptions import ConfigException
1111
from gspread_pandas.util import decode
1212

13-
try:
14-
from pathlib import Path
15-
except ImportError:
16-
from pathlib2 import Path
17-
18-
1913
__all__ = ["default_scope", "get_config", "get_creds"]
2014
if name == "nt":
2115
_default_dir = Path(environ.get("APPDATA")) / "gspread_pandas"
@@ -144,7 +138,7 @@ def get_creds(
144138
if "private_key_id" in config:
145139
return SACredentials.from_service_account_info(config, scopes=scope)
146140

147-
if not isinstance(user, six.string_types):
141+
if not isinstance(user, str):
148142
raise ConfigException(
149143
"Need to provide a user key as a string if not using a service account"
150144
)
@@ -178,6 +172,4 @@ def get_creds(
178172
return creds
179173
except Exception:
180174
exc_info = sys.exc_info()
181-
182-
if "exc_info" in locals():
183-
six.reraise(ConfigException, *exc_info[1:])
175+
raise ConfigException(*exc_info[1:])

gspread_pandas/spread.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
from __future__ import print_function
2-
31
from builtins import range, str
42
from re import match
53

64
import numpy as np
75
import pandas as pd
8-
import six
96
from gspread.exceptions import (
107
APIError,
118
NoValidUrlKeyFound,
@@ -543,10 +540,7 @@ def _find_sheet(self, sheet):
543540
Tuple like (index, worksheet)
544541
"""
545542
for ix, worksheet in enumerate(self.sheets):
546-
if (
547-
isinstance(sheet, six.string_types)
548-
and sheet.lower() == worksheet.title.lower()
549-
):
543+
if isinstance(sheet, str) and sheet.lower() == worksheet.title.lower():
550544
return ix, worksheet
551545
if isinstance(sheet, Worksheet) and sheet.id == worksheet.id:
552546
return ix, worksheet

gspread_pandas/util.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
import numpy as np
77
import pandas as pd
8-
import six
98
from google.oauth2 import credentials as oauth2, service_account
109
from gspread.client import Client as ClientV4
1110
from gspread.exceptions import APIError
@@ -51,7 +50,7 @@ def parse_df_col_names(df, include_index, index_size=1, flatten_sep=None):
5150
# handle multi-index headers
5251
if len(headers) > 0 and type(headers[0]) == tuple:
5352

54-
if isinstance(flatten_sep, six.string_types):
53+
if isinstance(flatten_sep, str):
5554
headers = [
5655
[
5756
# Remove blank elements and join using sep
@@ -238,7 +237,7 @@ def get_cell_as_tuple(cell):
238237
):
239238
raise TypeError("{0} is not a valid cell tuple".format(cell))
240239
return cell
241-
elif isinstance(cell, six.string_types):
240+
elif isinstance(cell, str):
242241
if not match("[a-zA-Z]+[0-9]+", cell):
243242
raise TypeError("{0} is not a valid address".format(cell))
244243
return a1_to_rowcol(cell)
@@ -454,7 +453,7 @@ def parse_permission(perm):
454453

455454
def remove_keys(dct, keys=[]):
456455
"""Remove keys from a dict."""
457-
return {key: val for key, val in six.iteritems(dct) if key not in keys}
456+
return {key: val for key, val in dct.items() if key not in keys}
458457

459458

460459
def remove_keys_from_list(lst, keys=[]):

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ include_trailing_comma = true
77
force_grid_wrap = 0
88
combine_as_imports = true
99
line_length = 88
10-
known_third_party = ["Crypto", "betamax", "betamax_serializers", "google", "google_auth_oauthlib", "gspread", "numpy", "oauth2client", "pandas", "pytest", "requests", "setuptools", "six"]
10+
known_third_party = ["Crypto", "betamax", "betamax_serializers", "google", "google_auth_oauthlib", "gspread", "numpy", "oauth2client", "pandas", "pytest", "requests", "setuptools"]

requirements.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,5 @@
22
gspread<5.0.0
33
pandas>=0.20.0
44
decorator
5-
six
6-
pathlib2;python_version=="2.7"
75
google-auth
86
google-auth-oauthlib

requirements_dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ flake8
99
pytest
1010
pre-commit
1111
isort
12-
black;python_version>="3.6"
12+
black
1313
pycryptodome
1414
betamax
1515
betamax_serializers

setup.cfg

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,24 @@ max-complexity = 18
1919
select = B,C,E,F,W,T4,B9
2020

2121
[tox:tox]
22-
envlist = py27, py35, py36, py37, flake8
22+
envlist = py35, py36, py37, py38, py39, py310, flake8
2323

2424
[travis]
25-
python =
25+
python =
26+
3.10: py310
27+
3.9: py39
28+
3.8: py38
2629
3.7: py37
2730
3.6: py36
2831
3.5: py35
29-
2.7: py27
3032

3133
[testenv:flake8]
3234
basepython = python
3335
deps = flake8
3436
commands = flake8 gspread_pandas
3537

3638
[testenv]
37-
setenv =
39+
setenv =
3840
PYTHONPATH = {toxinidir}
3941
deps = -r requirements_dev.txt
4042
commands = python setup.py test

setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
"Development Status :: 4 - Beta",
4141
"Intended Audience :: Developers",
4242
"Intended Audience :: Science/Research",
43-
"Programming Language :: Python :: 2.7",
4443
"Programming Language :: Python :: 3",
4544
],
4645
keywords="gspread pandas google spreadsheets",

0 commit comments

Comments
 (0)