1# -*- coding: utf-8 -*-
2import re
3from setuptools import setup, find_packages
4
5
6EXTRAS_REQUIRE = {
7    "sqlalchemy": [
8        "flask-sqlalchemy",
9        'marshmallow-sqlalchemy>=0.13.0; python_version >= "3.6"',
10        'marshmallow-sqlalchemy>=0.13.0,<0.19.0; python_version < "3.6"',
11    ],
12    "docs": ["marshmallow-sqlalchemy>=0.13.0", "Sphinx==3.2.1", "sphinx-issues==1.2.0"],
13    "lint": [
14        "flake8==3.8.3",
15        'flake8-bugbear==20.1.4; python_version >= "3.5"',
16        "pre-commit~=2.4",
17    ],
18}
19EXTRAS_REQUIRE["tests"] = EXTRAS_REQUIRE["sqlalchemy"] + ["pytest", "mock"]
20EXTRAS_REQUIRE["dev"] = EXTRAS_REQUIRE["tests"] + EXTRAS_REQUIRE["lint"] + ["tox"]
21
22REQUIRES = ["Flask", "marshmallow>=2.0.0", "six>=1.9.0"]
23
24
25def find_version(fname):
26    """Attempts to find the version number in the file names fname.
27    Raises RuntimeError if not found.
28    """
29    version = ""
30    with open(fname, "r") as fp:
31        reg = re.compile(r'__version__ = [\'"]([^\'"]*)[\'"]')
32        for line in fp:
33            m = reg.match(line)
34            if m:
35                version = m.group(1)
36                break
37    if not version:
38        raise RuntimeError("Cannot find version information")
39    return version
40
41
42def read(fname):
43    with open(fname) as fp:
44        content = fp.read()
45    return content
46
47
48setup(
49    name="flask-marshmallow",
50    version=find_version("src/flask_marshmallow/__init__.py"),
51    description="Flask + marshmallow for beautiful APIs",
52    long_description=read("README.rst"),
53    author="Steven Loria",
54    author_email="sloria1@gmail.com",
55    url="https://github.com/marshmallow-code/flask-marshmallow",
56    packages=find_packages("src"),
57    package_dir={"": "src"},
58    include_package_data=True,
59    install_requires=REQUIRES,
60    extras_require=EXTRAS_REQUIRE,
61    license="MIT",
62    zip_safe=False,
63    keywords="flask-marshmallow",
64    classifiers=[
65        "Development Status :: 4 - Beta",
66        "Environment :: Web Environment",
67        "Intended Audience :: Developers",
68        "License :: OSI Approved :: MIT License",
69        "Natural Language :: English",
70        "Programming Language :: Python :: 2",
71        "Programming Language :: Python :: 2.7",
72        "Programming Language :: Python :: 3",
73        "Programming Language :: Python :: 3.5",
74        "Programming Language :: Python :: 3.6",
75        "Programming Language :: Python :: 3.7",
76        "Programming Language :: Python :: 3.8",
77        "Topic :: Internet :: WWW/HTTP :: Dynamic Content",
78    ],
79    test_suite="tests",
80    project_urls={
81        "Issues": "https://github.com/marshmallow-code/flask-marshmallow/issues",
82        "Funding": "https://opencollective.com/marshmallow",
83    },
84)
85