Skip to content

Commit 3e3892f

Browse files
committed
Remove support for end-of-life Pythons
Python 2.7 and 3.4 are end-of-life. They are no longer receiving bug fixes, including for security issues. Python 2.7 went EOL on 2020-01-01 and 3.4 on 2019-03-18. For additional details on support Python versions, see: Supported: https://devguide.python.org/#status-of-python-branches EOL: https://devguide.python.org/devcycle/#end-of-life-branches Removing support for EOL Pythons will reduce testing and maintenance resources while allowing the library to move towards modern Python 3. Using pypinfo, we can show the PyPI download statistics, showing less than 10% of users are using Python 2.7. | python_version | percent | download_count | | -------------- | ------: | -------------: | | 3.7 | 45.36% | 3,056,010 | | 3.6 | 26.46% | 1,782,778 | | 3.8 | 12.22% | 823,213 | | 2.7 | 9.97% | 671,459 | | 3.5 | 5.86% | 394,846 | | 3.4 | 0.10% | 6,700 | | 3.9 | 0.03% | 2,346 | | 2.6 | 0.00% | 57 | | 3.3 | 0.00% | 21 | | 3.10 | 0.00% | 6 | | Total | | 6,737,436 | Library users who continue to use Python 2.7 will still be able to install previous versions of sqlparse. Compatibility shims have been dropped, simplifying the code. Using pyupgrade, the codebase has been updated to take advantage of modern syntax <https://github.com/asottile/pyupgrade>. The wheel is no longer marked as "universal" as it is now Python 3 only.
1 parent 28a2acd commit 3e3892f

41 files changed

Lines changed: 131 additions & 256 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.travis.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
language: python
22
python:
3-
- "2.7"
4-
- "3.4"
53
- "3.5"
64
- "3.6"
75
- "3.7"
86
- "3.8"
97
- "nightly"
10-
- "pypy"
118
- "pypy3"
129

1310
matrix:

CHANGELOG

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
Development Version
22
-------------------
33

4-
Nothing yet. ¯\_(ツ)_/¯
4+
Notable Changes
5+
6+
* Remove support for end-of-life Python 2.7 and 3.4. Python 3.5+ is now
7+
required.
58

69

710
Release 0.3.1 (Feb 29, 2020)

README.rst

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,8 @@ python-sqlparse - Parse SQL statements
99
sqlparse is a non-validating SQL parser for Python.
1010
It provides support for parsing, splitting and formatting SQL statements.
1111

12-
The module is compatible with Python 2.7 and Python 3 (>= 3.4)
13-
and released under the terms of the `New BSD license
14-
<https://opensource.org/licenses/BSD-3-Clause>`_.
15-
16-
.. note::
17-
18-
Support for Python<3.4 (including 2.x) will be dropped soon.
12+
The module is compatible with Python 3.5+ and released under the terms of the
13+
`New BSD license <https://opensource.org/licenses/BSD-3-Clause>`_.
1914

2015
Visit the project page at https://github.com/andialbrecht/sqlparse for
2116
further information about this project.

docs/source/conf.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
#
31
# python-sqlparse documentation build configuration file, created by
42
# sphinx-quickstart on Thu Feb 26 08:19:28 2009.
53
#

docs/source/intro.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ To check out the latest sources of this module run
120120
121121
to check out the latest sources from the repository.
122122

123-
:mod:`sqlparse` is currently tested under Python 2.7, >=3.4 and pypy. Tests are
123+
:mod:`sqlparse` is currently tested under Python 3.5+ and pypy. Tests are
124124
automatically run on each commit and for each pull request on Travis:
125125
https://travis-ci.org/andialbrecht/sqlparse
126126

examples/column_defs_lowlevel.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env python
2-
# -*- coding: utf-8 -*-
32
#
43
# Copyright (C) 2009-2018 the sqlparse authors and contributors
54
# <see AUTHORS file>

examples/extract_table_names.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env python
2-
# -*- coding: utf-8 -*-
32
#
43
# Copyright (C) 2009-2018 the sqlparse authors and contributors
54
# <see AUTHORS file>
@@ -32,8 +31,7 @@ def extract_from_part(parsed):
3231
for item in parsed.tokens:
3332
if from_seen:
3433
if is_subselect(item):
35-
for x in extract_from_part(item):
36-
yield x
34+
yield from extract_from_part(item)
3735
elif item.ttype is Keyword:
3836
return
3937
else:
@@ -67,4 +65,4 @@ def extract_tables(sql):
6765
"""
6866

6967
tables = ', '.join(extract_tables(sql))
70-
print('Tables: {0}'.format(tables))
68+
print('Tables: {}'.format(tables))

setup.cfg

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
1-
[bdist_wheel]
2-
universal = 1
3-
41
[metadata]
52
license_file = LICENSE
63

74
[tool:pytest]
85
xfail_strict = True
96

107
[flake8]
11-
exclude =
12-
sqlparse/compat.py
138
ignore =
149
W503,
1510
E731

setup.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env python
2-
# -*- coding: utf-8 -*-
32
#
43
# Copyright (C) 2009-2018 the sqlparse authors and contributors
54
# <see AUTHORS file>
@@ -84,17 +83,15 @@ def get_version():
8483
description='Non-validating SQL parser',
8584
long_description=LONG_DESCRIPTION,
8685
license='BSD',
87-
python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",
86+
python_requires=">=3.5",
8887
classifiers=[
8988
'Development Status :: 5 - Production/Stable',
9089
'Intended Audience :: Developers',
9190
'License :: OSI Approved :: BSD License',
9291
'Operating System :: OS Independent',
9392
'Programming Language :: Python',
94-
'Programming Language :: Python :: 2',
95-
'Programming Language :: Python :: 2.7',
9693
'Programming Language :: Python :: 3',
97-
'Programming Language :: Python :: 3.4',
94+
'Programming Language :: Python :: 3 :: Only',
9895
'Programming Language :: Python :: 3.5',
9996
'Programming Language :: Python :: 3.6',
10097
'Programming Language :: Python :: 3.7',

sqlparse/__init__.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
#
32
# Copyright (C) 2009-2018 the sqlparse authors and contributors
43
# <see AUTHORS file>
@@ -16,7 +15,6 @@
1615
from sqlparse import filters
1716
from sqlparse import formatter
1817

19-
from sqlparse.compat import text_type
2018

2119
__version__ = '0.3.2.dev0'
2220
__all__ = ['engine', 'filters', 'formatter', 'sql', 'tokens', 'cli']
@@ -58,7 +56,7 @@ def format(sql, encoding=None, **options):
5856
options = formatter.validate_options(options)
5957
stack = formatter.build_filter_stack(stack, options)
6058
stack.postprocess.append(filters.SerializerUnicode())
61-
return u''.join(stack.run(sql, encoding))
59+
return ''.join(stack.run(sql, encoding))
6260

6361

6462
def split(sql, encoding=None):
@@ -69,4 +67,4 @@ def split(sql, encoding=None):
6967
:returns: A list of strings.
7068
"""
7169
stack = engine.FilterStack()
72-
return [text_type(stmt).strip() for stmt in stack.run(sql, encoding)]
70+
return [str(stmt).strip() for stmt in stack.run(sql, encoding)]

0 commit comments

Comments
 (0)