Skip to content

Commit c1a56e5

Browse files
committed
🔥 drop support for Python 2.7, 3.5 and 3.6
1 parent 6f40c6a commit c1a56e5

File tree

14 files changed

+74
-329
lines changed

14 files changed

+74
-329
lines changed

.github/workflows/test.yml

Lines changed: 0 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,6 @@ jobs:
3333
strategy:
3434
matrix:
3535
include:
36-
- toxenv: "python2.7"
37-
db: "mariadb:5.5"
38-
legacy_db: 1
39-
experimental: false
40-
py: "2.7"
41-
4236
- toxenv: "python3.7"
4337
db: "mariadb:5.5"
4438
legacy_db: 1
@@ -69,12 +63,6 @@ jobs:
6963
experimental: false
7064
py: "3.11"
7165

72-
- toxenv: "python2.7"
73-
db: "mariadb:10.0"
74-
legacy_db: 1
75-
experimental: false
76-
py: "2.7"
77-
7866
- toxenv: "python3.7"
7967
db: "mariadb:10.0"
8068
legacy_db: 1
@@ -105,12 +93,6 @@ jobs:
10593
experimental: false
10694
py: "3.11"
10795

108-
- toxenv: "python2.7"
109-
db: "mariadb:10.1"
110-
legacy_db: 1
111-
experimental: false
112-
py: "2.7"
113-
11496
- toxenv: "python3.7"
11597
db: "mariadb:10.1"
11698
legacy_db: 1
@@ -141,12 +123,6 @@ jobs:
141123
experimental: false
142124
py: "3.11"
143125

144-
- toxenv: "python2.7"
145-
db: "mariadb:10.2"
146-
legacy_db: 0
147-
experimental: false
148-
py: "2.7"
149-
150126
- toxenv: "python3.7"
151127
db: "mariadb:10.2"
152128
legacy_db: 0
@@ -177,12 +153,6 @@ jobs:
177153
experimental: false
178154
py: "3.11"
179155

180-
- toxenv: "python2.7"
181-
db: "mariadb:10.3"
182-
legacy_db: 0
183-
experimental: false
184-
py: "2.7"
185-
186156
- toxenv: "python3.7"
187157
db: "mariadb:10.3"
188158
legacy_db: 0
@@ -213,12 +183,6 @@ jobs:
213183
experimental: false
214184
py: "3.11"
215185

216-
- toxenv: "python2.7"
217-
db: "mariadb:10.4"
218-
legacy_db: 0
219-
experimental: false
220-
py: "2.7"
221-
222186
- toxenv: "python3.7"
223187
db: "mariadb:10.4"
224188
legacy_db: 0
@@ -249,12 +213,6 @@ jobs:
249213
experimental: false
250214
py: "3.11"
251215

252-
- toxenv: "python2.7"
253-
db: "mariadb:10.5"
254-
legacy_db: 0
255-
experimental: false
256-
py: "2.7"
257-
258216
- toxenv: "python3.7"
259217
db: "mariadb:10.5"
260218
legacy_db: 0
@@ -285,12 +243,6 @@ jobs:
285243
experimental: false
286244
py: "3.11"
287245

288-
- toxenv: "python2.7"
289-
db: "mariadb:10.6"
290-
legacy_db: 0
291-
experimental: false
292-
py: "2.7"
293-
294246
- toxenv: "python3.7"
295247
db: "mariadb:10.6"
296248
legacy_db: 0
@@ -321,12 +273,6 @@ jobs:
321273
experimental: false
322274
py: "3.11"
323275

324-
- toxenv: "python2.7"
325-
db: "mariadb:10.11"
326-
legacy_db: 0
327-
experimental: false
328-
py: "2.7"
329-
330276
- toxenv: "python3.7"
331277
db: "mariadb:10.11"
332278
legacy_db: 0
@@ -357,12 +303,6 @@ jobs:
357303
experimental: false
358304
py: "3.11"
359305

360-
- toxenv: "python2.7"
361-
db: "mysql:5.5"
362-
legacy_db: 1
363-
experimental: false
364-
py: "2.7"
365-
366306
- toxenv: "python3.7"
367307
db: "mysql:5.5"
368308
legacy_db: 1
@@ -393,12 +333,6 @@ jobs:
393333
experimental: false
394334
py: "3.11"
395335

396-
- toxenv: "python2.7"
397-
db: "mysql:5.6"
398-
legacy_db: 1
399-
experimental: false
400-
py: "2.7"
401-
402336
- toxenv: "python3.7"
403337
db: "mysql:5.6"
404338
legacy_db: 1
@@ -429,12 +363,6 @@ jobs:
429363
experimental: false
430364
py: "3.11"
431365

432-
- toxenv: "python2.7"
433-
db: "mysql:5.7"
434-
legacy_db: 0
435-
experimental: false
436-
py: "2.7"
437-
438366
- toxenv: "python3.7"
439367
db: "mysql:5.7"
440368
legacy_db: 0
@@ -465,12 +393,6 @@ jobs:
465393
experimental: false
466394
py: "3.11"
467395

468-
- toxenv: "python2.7"
469-
db: "mysql:8.0"
470-
legacy_db: 0
471-
experimental: false
472-
py: "2.7"
473-
474396
- toxenv: "python3.7"
475397
db: "mysql:8.0"
476398
legacy_db: 0

CONTRIBUTING.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,7 @@ interactions related to the project.
1313

1414
Ensuring backward compatibility is an imperative requirement.
1515

16-
Currently, the tool supports Python versions 2.7, 3.5, 3.6, 3.7, 3.8, 3.9, 3.10 and 3.11.
17-
18-
Despite the fact that Python 2.7 has indeed reached the conclusion of its lifecycle in early 2020, a considerable number
19-
of individuals still rely heavily upon it. Consequently, it is incumbent upon us to maintain our support for this
20-
version until such time as the fundamental tools unequivocally discontinue their backing for it.
16+
Currently, the tool supports Python versions 3.7, 3.8, 3.9, 3.10 and 3.11.
2117

2218
## MySQL version support
2319

mysql_to_sqlite3/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
"""Utility to transfer data from MySQL to SQLite 3."""
2-
__version__ = "1.4.18"
2+
__version__ = "2.0.0"
33

44
from .transporter import MySQLtoSQLite

mysql_to_sqlite3/debug_info.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
Adapted from https://github.com/psf/requests/blob/master/requests/help.py
44
"""
55

6-
from __future__ import print_function
7-
86
import platform
97
import sqlite3
108
import sys
@@ -13,21 +11,15 @@
1311

1412
import click
1513
import mysql.connector
14+
import pytimeparse2
1615
import simplejson
17-
import six
1816
import slugify
1917
import tabulate
2018
import tqdm
2119

2220
from . import __version__ as package_version
2321

2422

25-
if six.PY2 or (sys.version_info.major == 3 and 4 <= sys.version_info.minor <= 6):
26-
import pytimeparse # pylint: disable=E0401
27-
else:
28-
import pytimeparse2 as pytimeparse
29-
30-
3123
def _implementation():
3224
"""Return a dict with the Python implementation and version.
3325
@@ -98,9 +90,8 @@ def info():
9890
["click", click.__version__],
9991
["mysql-connector-python", mysql.connector.__version__],
10092
["python-slugify", slugify.__version__],
101-
["pytimeparse", pytimeparse.__version__],
93+
["pytimeparse2", pytimeparse2.__version__],
10294
["simplejson", simplejson.__version__],
103-
["six", six.__version__],
10495
["tabulate", tabulate.__version__],
10596
["tqdm", tqdm.__version__],
10697
]

mysql_to_sqlite3/sixeptions.py

Lines changed: 0 additions & 7 deletions
This file was deleted.

mysql_to_sqlite3/sqlite_utils.py

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,10 @@
11
"""SQLite adapters and converters for unsupported data types."""
22

3-
from __future__ import division
4-
53
import sqlite3
6-
from datetime import date, datetime, timedelta
4+
from datetime import date, timedelta
75
from decimal import Decimal
8-
from sys import version_info
9-
10-
import six
11-
12-
13-
if six.PY2 or (version_info.major == 3 and 4 <= version_info.minor <= 6):
14-
from pytimeparse.timeparse import timeparse # pylint: disable=E0401
15-
else:
16-
from pytimeparse2 import parse as timeparse
17-
18-
if version_info.major == 3 and 4 <= version_info.minor <= 6:
19-
from backports.datetime_fromisoformat import MonkeyPatch # pylint: disable=E0401
206

21-
MonkeyPatch.patch_fromisoformat()
7+
from pytimeparse2 import parse
228

239

2410
def adapt_decimal(value):
@@ -40,7 +26,7 @@ def adapt_timedelta(value):
4026

4127
def convert_timedelta(value):
4228
"""Convert %H:%M:%S string to datetime.timedelta."""
43-
return timedelta(seconds=timeparse(value))
29+
return timedelta(seconds=parse(value))
4430

4531

4632
def encode_data_for_sqlite(value):
@@ -61,12 +47,7 @@ class CollatingSequences:
6147

6248
def convert_date(value):
6349
"""Handle SQLite date conversion."""
64-
if six.PY3:
65-
try:
66-
return date.fromisoformat(value.decode())
67-
except ValueError as err:
68-
raise ValueError("DATE field contains {}".format(err)) # pylint: disable=W0707
6950
try:
70-
return datetime.strptime(value.decode(), "%Y-%m-%d").date()
51+
return date.fromisoformat(value.decode())
7152
except ValueError as err:
72-
raise ValueError("DATE field contains Invalid isoformat string: {}".format(err)) # pylint: disable=W0707
53+
raise ValueError("DATE field contains {}".format(err)) # pylint: disable=W0707

mysql_to_sqlite3/transporter.py

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
"""Use to transfer a MySQL database to SQLite."""
22

3-
from __future__ import division
4-
53
import logging
64
import re
75
import sqlite3
@@ -12,7 +10,6 @@
1210
from sys import stdout
1311

1412
import mysql.connector
15-
import six
1613
from mysql.connector import errorcode
1714
from tqdm import tqdm, trange
1815

@@ -27,10 +24,6 @@
2724
)
2825

2926

30-
if six.PY2:
31-
from .sixeptions import * # pylint: disable=W0401
32-
33-
3427
class MySQLtoSQLite:
3528
"""Use this class to transfer a MySQL database to SQLite."""
3629

@@ -232,7 +225,7 @@ def _translate_type_from_mysql_to_sqlite(cls, column_type, sqlite_json1_extensio
232225

233226
@classmethod
234227
def _translate_default_from_mysql_to_sqlite(cls, column_default=None, column_type=None):
235-
if isinstance(column_default, six.binary_type):
228+
if isinstance(column_default, bytes):
236229
if column_type in {
237230
"BIT",
238231
"BINARY",
@@ -242,13 +235,7 @@ def _translate_default_from_mysql_to_sqlite(cls, column_default=None, column_typ
242235
"TINYBLOB",
243236
"VARBINARY",
244237
}:
245-
if six.PY2:
246-
try:
247-
return "DEFAULT x'{}'".format(column_default.encode("hex"))
248-
except AttributeError:
249-
pass
250-
else:
251-
return "DEFAULT x'{}'".format(column_default.hex())
238+
return "DEFAULT x'{}'".format(column_default.hex())
252239

253240
try:
254241
column_default = column_default.decode()
@@ -263,9 +250,7 @@ def _translate_default_from_mysql_to_sqlite(cls, column_default=None, column_typ
263250
return "DEFAULT(TRUE)"
264251
return "DEFAULT(FALSE)"
265252
return "DEFAULT '{}'".format(int(column_default))
266-
if (six.PY2 and isinstance(column_default, unicode)) or isinstance( # noqa: ignore=F405 pylint: disable=E0602
267-
column_default, str
268-
):
253+
if isinstance(column_default, str):
269254
if column_default.upper() in {
270255
"CURRENT_TIME",
271256
"CURRENT_DATE",

0 commit comments

Comments
 (0)