Skip to content

Commit 9ca81f5

Browse files
committed
Move most setup options to setup.cfg
Installation has been modernized to use setup.cfg for most package metadata. Fixes: sqlalchemy#5404 Change-Id: Id59c0c4e7f81eca89999d1f1f8b03c89835a09d1
1 parent 5624430 commit 9ca81f5

3 files changed

Lines changed: 79 additions & 95 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.. change::
2+
:tags: installation
3+
:tickets: 5404
4+
5+
Installation has been modernized to use setup.cfg for most package
6+
metadata.

setup.cfg

Lines changed: 72 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,61 @@
1+
[metadata]
2+
name = SQLAlchemy
3+
version = attr: sqlalchemy.__version__
4+
description = Database Abstraction Library
5+
long_description = file: README.dialects.rst
6+
long_description_content_type = text/x-rst
7+
url = http://www.sqlalchemy.org
8+
author = Mike Bayer
9+
author_email = mike_mp@zzzcomputing.com
10+
license = MIT
11+
license_file = LICENSE
12+
classifiers =
13+
Development Status :: 5 - Production/Stable
14+
Intended Audience :: Developers
15+
License :: OSI Approved :: MIT License
16+
Operating System :: OS Independent
17+
Programming Language :: Python
18+
Programming Language :: Python :: 2
19+
Programming Language :: Python :: 2.7
20+
Programming Language :: Python :: 3
21+
Programming Language :: Python :: 3.5
22+
Programming Language :: Python :: 3.6
23+
Programming Language :: Python :: 3.7
24+
Programming Language :: Python :: 3.8
25+
Programming Language :: Python :: Implementation :: CPython
26+
Programming Language :: Python :: Implementation :: PyPy
27+
Topic :: Database :: Front-Ends
28+
project_urls =
29+
Documentation=https://docs.sqlalchemy.org
30+
Issue Tracker=https://github.com/sqlalchemy/sqlalchemy/
31+
32+
[options]
33+
packages = find:
34+
python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*
35+
package_dir =
36+
=lib
37+
38+
[options.extras_require]
39+
mssql = pyodbc
40+
mssql_pymssql = pymssql
41+
mssql_pyodbc = pyodbc
42+
mysql = mysqlclient
43+
oracle = cx_oracle
44+
postgresql = psycopg2
45+
postgresql_pg8000 = pg8000
46+
postgresql_psycopg2binary = psycopg2-binary
47+
postgresql_psycopg2cffi = psycopg2cffi
48+
pymysql = pymysql
49+
150
[egg_info]
251
tag_build = dev
352

4-
[metadata]
5-
license_file = LICENSE
53+
[options.packages.find]
54+
where = lib
655

756
[tool:pytest]
8-
addopts= --tb native -v -r sfxX --maxfail=25 -p no:warnings -p no:logging
9-
python_files=test/*test_*.py
57+
addopts = --tb native -v -r sfxX --maxfail=25 -p no:warnings -p no:logging
58+
python_files = test/*test_*.py
1059

1160
[upload]
1261
sign = 1
@@ -15,6 +64,7 @@ identity = C4DAFEE1
1564
[flake8]
1665
show-source = false
1766
enable-extensions = G
67+
1868
# E203 is due to https://github.com/PyCQA/pycodestyle/issues/373
1969
ignore =
2070
A003,
@@ -27,15 +77,15 @@ exclude = .venv,.git,.tox,dist,doc,*egg,build
2777
import-order-style = google
2878
application-import-names = sqlalchemy,test
2979

30-
3180
[sqla_testing]
32-
requirement_cls=test.requirements:DefaultRequirements
33-
profile_file=test/profiles.txt
81+
requirement_cls = test.requirements:DefaultRequirements
82+
profile_file = test/profiles.txt
3483

3584
# name of a "loopback" link set up on the oracle database.
3685
# to create this, suppose your DB is scott/tiger@xe. You'd create it
3786
# like:
38-
# create public database link test_link connect to scott identified by tiger using 'xe';
87+
# create public database link test_link connect to scott identified by tiger
88+
# using 'xe';
3989
oracle_db_link = test_link
4090

4191
# host name of a postgres database that has the postgres_fdw extension.
@@ -45,24 +95,18 @@ oracle_db_link = test_link
4595
# this can be localhost to create a loopback foreign table
4696
# postgres_test_db_link = localhost
4797

48-
4998
[db]
50-
default=sqlite:///:memory:
51-
sqlite=sqlite:///:memory:
52-
sqlite_file=sqlite:///querytest.db
53-
54-
postgresql=postgresql://scott:tiger@127.0.0.1:5432/test
55-
pg8000=postgresql+pg8000://scott:tiger@127.0.0.1:5432/test
56-
postgresql_psycopg2cffi=postgresql+psycopg2cffi://scott:tiger@127.0.0.1:5432/test
57-
58-
mysql=mysql://scott:tiger@127.0.0.1:3306/test?charset=utf8mb4
59-
pymysql=mysql+pymysql://scott:tiger@127.0.0.1:3306/test?charset=utf8mb4
60-
61-
mssql=mssql+pyodbc://scott:tiger^5HHH@mssql2017:1433/test?driver=ODBC+Driver+13+for+SQL+Server
62-
mssql_pymssql=mssql+pymssql://scott:tiger@ms_2008
63-
docker_mssql=mssql+pymssql://scott:tiger^5HHH@127.0.0.1:1433/test
64-
65-
oracle=oracle://scott:tiger@127.0.0.1:1521
66-
oracle8=oracle://scott:tiger@127.0.0.1:1521/?use_ansi=0
67-
68-
firebird=firebird://sysdba:masterkey@localhost//Users/classic/foo.fdb
99+
default = sqlite:///:memory:
100+
sqlite = sqlite:///:memory:
101+
sqlite_file = sqlite:///querytest.db
102+
postgresql = postgresql://scott:tiger@127.0.0.1:5432/test
103+
pg8000 = postgresql+pg8000://scott:tiger@127.0.0.1:5432/test
104+
postgresql_psycopg2cffi = postgresql+psycopg2cffi://scott:tiger@127.0.0.1:5432/test
105+
mysql = mysql://scott:tiger@127.0.0.1:3306/test?charset=utf8mb4
106+
pymysql = mysql+pymysql://scott:tiger@127.0.0.1:3306/test?charset=utf8mb4
107+
mssql = mssql+pyodbc://scott:tiger^5HHH@mssql2017:1433/test?driver=ODBC+Driver+13+for+SQL+Server
108+
mssql_pymssql = mssql+pymssql://scott:tiger@ms_2008
109+
docker_mssql = mssql+pymssql://scott:tiger^5HHH@127.0.0.1:1433/test
110+
oracle = oracle://scott:tiger@127.0.0.1:1521
111+
oracle8 = oracle://scott:tiger@127.0.0.1:1521/?use_ansi=0
112+
firebird = firebird://sysdba:masterkey@localhost//Users/classic/foo.fdb

setup.py

Lines changed: 1 addition & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,15 @@
44
from distutils.errors import DistutilsPlatformError
55
import os
66
import platform
7-
import re
87
import sys
98

109
from setuptools import Distribution as _Distribution
1110
from setuptools import Extension
12-
from setuptools import find_packages
1311
from setuptools import setup
1412
from setuptools.command.test import test as TestCommand
1513

1614

1715
cmdclass = {}
18-
if sys.version_info < (2, 7):
19-
raise Exception("SQLAlchemy requires Python 2.7 or higher.")
2016

2117
cpython = platform.python_implementation() == "CPython"
2218

@@ -120,19 +116,6 @@ def status_msgs(*msgs):
120116
print("*" * 75)
121117

122118

123-
with open(
124-
os.path.join(os.path.dirname(__file__), "lib", "sqlalchemy", "__init__.py")
125-
) as v_file:
126-
VERSION = (
127-
re.compile(r""".*__version__ = ["'](.*?)['"]""", re.S)
128-
.match(v_file.read())
129-
.group(1)
130-
)
131-
132-
with open(os.path.join(os.path.dirname(__file__), "README.rst")) as r_file:
133-
readme = r_file.read()
134-
135-
136119
def run_setup(with_cext):
137120
kwargs = {}
138121
if with_cext:
@@ -146,56 +129,7 @@ def run_setup(with_cext):
146129

147130
kwargs["ext_modules"] = []
148131

149-
setup(
150-
name="SQLAlchemy",
151-
version=VERSION,
152-
description="Database Abstraction Library",
153-
author="Mike Bayer",
154-
author_email="mike_mp@zzzcomputing.com",
155-
url="http://www.sqlalchemy.org",
156-
project_urls={
157-
"Documentation": "https://docs.sqlalchemy.org",
158-
"Issue Tracker": "https://github.com/sqlalchemy/sqlalchemy/",
159-
},
160-
packages=find_packages("lib"),
161-
package_dir={"": "lib"},
162-
license="MIT",
163-
cmdclass=cmdclass,
164-
long_description=readme,
165-
python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*",
166-
classifiers=[
167-
"Development Status :: 5 - Production/Stable",
168-
"Intended Audience :: Developers",
169-
"License :: OSI Approved :: MIT License",
170-
"Programming Language :: Python",
171-
"Programming Language :: Python :: 2",
172-
"Programming Language :: Python :: 2.7",
173-
"Programming Language :: Python :: 3",
174-
"Programming Language :: Python :: 3.5",
175-
"Programming Language :: Python :: 3.6",
176-
"Programming Language :: Python :: 3.7",
177-
"Programming Language :: Python :: 3.8",
178-
"Programming Language :: Python :: 3.9",
179-
"Programming Language :: Python :: Implementation :: CPython",
180-
"Programming Language :: Python :: Implementation :: PyPy",
181-
"Topic :: Database :: Front-Ends",
182-
"Operating System :: OS Independent",
183-
],
184-
distclass=Distribution,
185-
extras_require={
186-
"mysql": ["mysqlclient"],
187-
"pymysql": ["pymysql"],
188-
"postgresql": ["psycopg2"],
189-
"postgresql_psycopg2binary": ["psycopg2-binary"],
190-
"postgresql_pg8000": ["pg8000"],
191-
"postgresql_psycopg2cffi": ["psycopg2cffi"],
192-
"oracle": ["cx_oracle"],
193-
"mssql_pyodbc": ["pyodbc"],
194-
"mssql_pymssql": ["pymssql"],
195-
"mssql": ["pyodbc"],
196-
},
197-
**kwargs
198-
)
132+
setup(cmdclass=cmdclass, distclass=Distribution, **kwargs)
199133

200134

201135
if not cpython:

0 commit comments

Comments
 (0)