/
setup.py
156 lines (135 loc) · 4.07 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# setup
'''
:author: madkote
:contact: madkote(at)bluewin.ch
:copyright: Copyright 2019, madkote
setup
-----
Setup script
https://pypi.org/pypi?%3Aaction=list_classifiers
'''
from __future__ import absolute_import
import codecs
import importlib.util
import os
import sys
from setuptools import setup
from setuptools import find_packages
__author__ = 'madkote <madkote(at)bluewin.ch>'
__copyright__ = 'Copyright 2019, madkote'
if sys.version_info < (3, 6, 0):
raise RuntimeError("Python 3.6+ required")
with open("README.md", "r") as fh:
long_description = fh.read()
with open("CHANGES.md", "r") as fh:
changes_description = fh.read()
def get_version(package_name):
try:
version_file = os.path.join(
os.path.dirname(__file__),
package_name,
'version.py'
)
spec = importlib.util.spec_from_file_location(
'%s.version' % package_name,
version_file
)
version_module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(version_module)
package_version = version_module.__version__
except Exception as e:
raise ValueError(
'can not determine "%s" version: %s :: %s' % (
package_name, type(e), e
)
)
else:
return package_version
def load_requirements(filename):
def _is_req(s):
return s and not s.startswith('-r ') and not s.startswith('git+http') and not s.startswith('#') # noqa E501
def _read():
with codecs.open(filename, 'r', encoding='utf-8-sig') as fh:
for line in fh:
line = line.strip()
if _is_req(line):
yield line
return sorted(list(_read()))
NAME = 'fastapi-plugins'
NAME_PACKAGE = NAME.replace('-', '_')
VERSION = get_version(NAME_PACKAGE)
DESCRIPTION = 'Plugins for FastAPI framework'
URL = 'https://github.com/madkote/%s' % NAME
REQUIRES_INSTALL = [
# 'fastapi>=0.61.*',
# 'pydantic >=1.0.0,<2.0.0',
'fastapi>=0.41.*',
'pydantic>=0.32.*',
'tenacity>=6.2.*'
]
REQUIRES_INSTALL += [
'aioredis>=1.3.*'
]
REQUIRES_INSTALL += [
'aiojobs>=0.3.*'
]
REQUIRES_MEMCACHED = ['aiomcache>=0.6.*']
REQUIRES_TESTS = [
'bandit',
'docker-compose',
'flake8',
'm2r',
'pytest',
'pytest-cov',
'tox',
'uvicorn'
]
REQUIRES_EXTRA = {
'all': REQUIRES_INSTALL + REQUIRES_MEMCACHED,
'memcached': REQUIRES_INSTALL + REQUIRES_MEMCACHED,
'test': REQUIRES_INSTALL + REQUIRES_TESTS
}
PACKAGES = find_packages(exclude=('scripts', 'tests'))
PACKAGE_DATA = {}
# =============================================================================
# SETUP
# =============================================================================
setup(
name=NAME,
version=VERSION,
description=DESCRIPTION,
author='madkote',
author_email=__author__.replace('(at)', '@'),
url=URL,
download_url=URL + '/archive/{}.tar.gz'.format(VERSION),
license='MIT License',
keywords=[
'async', 'redis', 'aioredis', 'json', 'asyncio', 'plugin', 'fastapi',
'aiojobs', 'scheduler', 'starlette', 'memcached', 'aiomcache'
],
install_requires=REQUIRES_INSTALL,
tests_require=REQUIRES_TESTS,
extras_require=REQUIRES_EXTRA,
packages=PACKAGES,
package_data=PACKAGE_DATA,
python_requires='>=3.6.0',
include_package_data=True,
long_description='\n\n'.join((long_description, changes_description)),
long_description_content_type='text/markdown',
platforms=['any'],
classifiers=[
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Topic :: Utilities',
'Topic :: Software Development :: Libraries',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: System :: Logging',
'Framework :: AsyncIO',
'Operating System :: OS Independent',
'Intended Audience :: Developers',
]
)