Skip to content

Commit d99a512

Browse files
committed
Adopt PEP 621, move metadata into pyproject.toml
1 parent fb3b6bf commit d99a512

File tree

2 files changed

+52
-41
lines changed

2 files changed

+52
-41
lines changed

pyproject.toml

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,52 @@
11
[project]
22
name = "asyncpg"
3+
description = "An asyncio PostgreSQL driver"
4+
readme = "README.rst"
35
requires-python = ">=3.6"
6+
license = { text = "Apache License, Version 2.0" }
7+
authors = [
8+
{ "name" = "MagicStack Inc" },
9+
{ "email" = "hello@magic.io" }
10+
]
11+
classifiers = [
12+
"Development Status :: 5 - Production/Stable",
13+
"Framework :: AsyncIO",
14+
"Intended Audience :: Developers",
15+
"License :: OSI Approved :: Apache Software License",
16+
"Operating System :: POSIX",
17+
"Operating System :: MacOS :: MacOS X",
18+
"Operating System :: Microsoft :: Windows",
19+
"Programming Language :: Python :: 3 :: Only",
20+
"Programming Language :: Python :: 3.6",
21+
"Programming Language :: Python :: 3.7",
22+
"Programming Language :: Python :: 3.8",
23+
"Programming Language :: Python :: 3.9",
24+
"Programming Language :: Python :: 3.10",
25+
"Programming Language :: Python :: Implementation :: CPython",
26+
"Topic :: Database :: Front-Ends",
27+
]
28+
dependencies = ["typing-extensions>=3.7.4.3;python_version<'3.8'"]
29+
dynamic = ["version"]
30+
31+
[project.urls]
32+
homepage = "https://github.com/MagicStack/asyncpg"
33+
documentation = "https://magicstack.github.io/asyncpg/current/"
34+
repository = "https://github.com/MagicStack/asyncpg"
35+
changelog = "https://github.com/MagicStack/asyncpg/releases"
36+
37+
[tool.setuptools]
38+
platforms = ["macOS", "POSIX", "Windows"]
39+
zip-safe = false
40+
41+
[tool.setuptools.packages.find]
42+
exclude = ["tests", "tools"]
43+
44+
[tool.setuptools.package-data]
45+
# Cython sources needed for tracebacks
46+
"*" = ["*.pyx", "*.pxd", "*.pxi"]
447

548
[build-system]
6-
requires = ["setuptools>=42", "wheel"]
49+
requires = ["setuptools>=61", "wheel"]
750
build-backend = "setuptools.build_meta"
851

952
[tool.cibuildwheel]

setup.py

Lines changed: 8 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,16 @@
1717
import re
1818
import subprocess
1919

20+
import setuptools
21+
from distutils.version import StrictVersion
22+
23+
if StrictVersion(setuptools.__version__) < StrictVersion('61.0.0'):
24+
raise RuntimeError(f'Your setuptools version ({setuptools.__version__}) '
25+
f'does not support PEP 621. '
26+
'Please upgrade it first.')
27+
2028
# We use vanilla build_ext, to avoid importing Cython via
2129
# the setuptools version.
22-
import setuptools
2330
from setuptools.command import build_py as setuptools_build_py
2431
from setuptools.command import sdist as setuptools_sdist
2532
from setuptools.command import build_ext as setuptools_build_ext
@@ -65,10 +72,6 @@
6572
_ROOT = pathlib.Path(__file__).parent
6673

6774

68-
with open(str(_ROOT / 'README.rst')) as f:
69-
readme = f.read()
70-
71-
7275
with open(str(_ROOT / 'asyncpg' / '_version.py')) as f:
7376
for line in f:
7477
if line.startswith('__version__ ='):
@@ -246,41 +249,7 @@ def finalize_options(self):
246249

247250

248251
setuptools.setup(
249-
name='asyncpg',
250252
version=VERSION,
251-
description='An asyncio PostgreSQL driver',
252-
long_description=readme,
253-
classifiers=[
254-
'Development Status :: 5 - Production/Stable',
255-
'Framework :: AsyncIO',
256-
'Intended Audience :: Developers',
257-
'License :: OSI Approved :: Apache Software License',
258-
'Operating System :: POSIX',
259-
'Operating System :: MacOS :: MacOS X',
260-
'Operating System :: Microsoft :: Windows',
261-
'Programming Language :: Python :: 3 :: Only',
262-
'Programming Language :: Python :: 3.6',
263-
'Programming Language :: Python :: 3.7',
264-
'Programming Language :: Python :: 3.8',
265-
'Programming Language :: Python :: 3.9',
266-
'Programming Language :: Python :: 3.10',
267-
'Programming Language :: Python :: Implementation :: CPython',
268-
'Topic :: Database :: Front-Ends',
269-
],
270-
platforms=['macOS', 'POSIX', 'Windows'],
271-
python_requires='>=3.6.0',
272-
zip_safe=False,
273-
author='MagicStack Inc',
274-
author_email='hello@magic.io',
275-
url='https://github.com/MagicStack/asyncpg',
276-
license='Apache License, Version 2.0',
277-
packages=setuptools.find_packages(
278-
exclude=['tests', 'tools'],
279-
),
280-
package_data={
281-
# Cython sources needed for tracebacks
282-
"": ["*.pyx", "*.pxd", "*.pxi"],
283-
},
284253
ext_modules=[
285254
setuptools.extension.Extension(
286255
"asyncpg.pgproto.pgproto",
@@ -296,7 +265,6 @@ def finalize_options(self):
296265
extra_compile_args=CFLAGS,
297266
extra_link_args=LDFLAGS),
298267
],
299-
install_requires=['typing-extensions>=3.7.4.3;python_version<"3.8"'],
300268
cmdclass={'build_ext': build_ext, 'build_py': build_py, 'sdist': sdist},
301269
test_suite='tests.suite',
302270
extras_require=EXTRA_DEPENDENCIES,

0 commit comments

Comments
 (0)