1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3
4import os
5import re
6
7from setuptools import setup
8
9
10def get_version(package):
11    """
12    Return package version as listed in `__version__` in `init.py`.
13    """
14    with open(os.path.join(package, "__init__.py")) as f:
15        return re.search("__version__ = ['\"]([^'\"]+)['\"]", f.read()).group(1)
16
17
18def get_long_description():
19    """
20    Return the README.
21    """
22    with open("README.md", encoding="utf8") as f:
23        return f.read()
24
25
26def get_packages(package):
27    """
28    Return root package and all sub-packages.
29    """
30    return [
31        dirpath
32        for dirpath, dirnames, filenames in os.walk(package)
33        if os.path.exists(os.path.join(dirpath, "__init__.py"))
34    ]
35
36
37setup(
38    name="databases",
39    version=get_version("databases"),
40    python_requires='>=3.6',
41    url="https://github.com/encode/databases",
42    license="BSD",
43    description="Async database support for Python.",
44    long_description=get_long_description(),
45    long_description_content_type="text/markdown",
46    author="Tom Christie",
47    author_email="tom@tomchristie.com",
48    packages=get_packages("databases"),
49    package_data={"databases": ["py.typed"]},
50    # data_files=[("", ["LICENSE.md"])],
51    install_requires=['sqlalchemy>=1.4,<1.5', 'aiocontextvars;python_version<"3.7"'],
52    extras_require={
53        "postgresql": ["asyncpg"],
54        "mysql": ["aiomysql"],
55        "sqlite": ["aiosqlite"],
56        "postgresql+aiopg": ["aiopg"]
57    },
58    classifiers=[
59        "Development Status :: 3 - Alpha",
60        "Environment :: Web Environment",
61        "Intended Audience :: Developers",
62        "License :: OSI Approved :: BSD License",
63        "Operating System :: OS Independent",
64        "Topic :: Internet :: WWW/HTTP",
65        "Programming Language :: Python :: 3",
66        "Programming Language :: Python :: 3.6",
67        "Programming Language :: Python :: 3.7",
68    ],
69    zip_safe=False,
70)
71