Skip to content

Commit 78d5b1b

Browse files
committed
Move setup data to setup.cfg.
1 parent 412186c commit 78d5b1b

2 files changed

Lines changed: 45 additions & 101 deletions

File tree

setup.cfg

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,46 @@
1+
[metadata]
2+
name = sqlparse
3+
version = attr: sqlparse.__version__
4+
url = https://github.com/andialbrecht/sqlparse
5+
author = Andi Albrecht
6+
author_email = [email protected]
7+
description = A non-validating SQL parser.
8+
long_description = file: README.rst
9+
license = BSD-3-Clause
10+
classifiers =
11+
Development Status :: 5 - Production/Stable
12+
Intended Audience :: Developers
13+
License :: OSI Approved :: BSD License
14+
Operating System :: OS Independent
15+
Programming Language :: Python
16+
Programming Language :: Python :: 3
17+
Programming Language :: Python :: 3 :: Only
18+
Programming Language :: Python :: 3.5
19+
Programming Language :: Python :: 3.6
20+
Programming Language :: Python :: 3.7
21+
Programming Language :: Python :: 3.8
22+
Programming Language :: Python :: 3.9
23+
Programming Language :: Python :: Implementation :: CPython
24+
Programming Language :: Python :: Implementation :: PyPy
25+
Topic :: Database
26+
Topic :: Software Development
27+
project_urls =
28+
Documentation = https://sqlparse.readthedocs.io/
29+
Release Notes = https://sqlparse.readthedocs.io/en/latest/changes/
30+
Source = https://github.com/andialbrecht/sqlparse
31+
Tracker = https://github.com/andialbrecht/sqlparse/issues
32+
33+
[options]
34+
python_requires = >=3.5
35+
packages = find:
36+
37+
[options.packages.find]
38+
exclude = tests
39+
40+
[options.entry_points]
41+
console_scripts =
42+
sqlformat = sqlparse.__main__:main
43+
144
[tool:pytest]
245
xfail_strict = True
346

setup.py

Lines changed: 2 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -6,106 +6,7 @@
66
# This setup script is part of python-sqlparse and is released under
77
# the BSD License: https://opensource.org/licenses/BSD-3-Clause
88

9-
import re
9+
from setuptools import setup
1010

11-
from setuptools import setup, find_packages
1211

13-
14-
def get_version():
15-
"""Parse __init__.py for version number instead of importing the file."""
16-
VERSIONFILE = 'sqlparse/__init__.py'
17-
VSRE = r'^__version__ = [\'"]([^\'"]*)[\'"]'
18-
with open(VERSIONFILE) as f:
19-
verstrline = f.read()
20-
mo = re.search(VSRE, verstrline, re.M)
21-
if mo:
22-
return mo.group(1)
23-
raise RuntimeError('Unable to find version in {fn}'.format(fn=VERSIONFILE))
24-
25-
26-
LONG_DESCRIPTION = """
27-
``sqlparse`` is a non-validating SQL parser module.
28-
It provides support for parsing, splitting and formatting SQL statements.
29-
30-
Visit the `project page <https://github.com/andialbrecht/sqlparse>`_ for
31-
additional information and documentation.
32-
33-
**Example Usage**
34-
35-
36-
Splitting SQL statements::
37-
38-
>>> import sqlparse
39-
>>> sqlparse.split('select * from foo; select * from bar;')
40-
[u'select * from foo; ', u'select * from bar;']
41-
42-
43-
Formatting statements::
44-
45-
>>> sql = 'select * from foo where id in (select id from bar);'
46-
>>> print(sqlparse.format(sql, reindent=True, keyword_case='upper'))
47-
SELECT *
48-
FROM foo
49-
WHERE id IN
50-
(SELECT id
51-
FROM bar);
52-
53-
54-
Parsing::
55-
56-
>>> sql = 'select * from someschema.mytable where id = 1'
57-
>>> res = sqlparse.parse(sql)
58-
>>> res
59-
(<Statement 'select...' at 0x9ad08ec>,)
60-
>>> stmt = res[0]
61-
>>> str(stmt) # converting it back to unicode
62-
'select * from someschema.mytable where id = 1'
63-
>>> # This is how the internal representation looks like:
64-
>>> stmt.tokens
65-
(<DML 'select' at 0x9b63c34>,
66-
<Whitespace ' ' at 0x9b63e8c>,
67-
<Operator '*' at 0x9b63e64>,
68-
<Whitespace ' ' at 0x9b63c5c>,
69-
<Keyword 'from' at 0x9b63c84>,
70-
<Whitespace ' ' at 0x9b63cd4>,
71-
<Identifier 'somes...' at 0x9b5c62c>,
72-
<Whitespace ' ' at 0x9b63f04>,
73-
<Where 'where ...' at 0x9b5caac>)
74-
75-
"""
76-
77-
setup(
78-
name='sqlparse',
79-
version=get_version(),
80-
author='Andi Albrecht',
81-
author_email='[email protected]',
82-
url='https://github.com/andialbrecht/sqlparse',
83-
description='Non-validating SQL parser',
84-
long_description=LONG_DESCRIPTION,
85-
license='BSD',
86-
python_requires=">=3.5",
87-
classifiers=[
88-
'Development Status :: 5 - Production/Stable',
89-
'Intended Audience :: Developers',
90-
'License :: OSI Approved :: BSD License',
91-
'Operating System :: OS Independent',
92-
'Programming Language :: Python',
93-
'Programming Language :: Python :: 3',
94-
'Programming Language :: Python :: 3 :: Only',
95-
'Programming Language :: Python :: 3.5',
96-
'Programming Language :: Python :: 3.6',
97-
'Programming Language :: Python :: 3.7',
98-
'Programming Language :: Python :: 3.8',
99-
'Programming Language :: Python :: 3.9',
100-
'Programming Language :: Python :: Implementation :: CPython',
101-
'Programming Language :: Python :: Implementation :: PyPy',
102-
'Topic :: Database',
103-
'Topic :: Software Development',
104-
],
105-
packages=find_packages(exclude=('tests',)),
106-
entry_points={
107-
'console_scripts': [
108-
'sqlformat = sqlparse.__main__:main',
109-
]
110-
},
111-
)
12+
setup()

0 commit comments

Comments
 (0)