-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathsetup.py
156 lines (135 loc) · 4.27 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
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 2023, madkote'
if sys.version_info < (3, 8, 0):
raise RuntimeError("Python 3.8+ 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()))
def package_files(directory=None):
paths = []
if directory:
for (path, _, filenames) in os.walk(directory):
for filename in filenames:
paths.append(os.path.join('..', path, filename))
return paths
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.100.0',
'pydantic>=2.0.0',
'pydantic-settings>=2.0.0',
'tenacity>=8.0.0',
#
'python-json-logger>=2.0.0',
'redis[hiredis]>=4.3.0,<5',
'aiojobs>=1.0.0'
]
REQUIRES_FAKEREDIS = ['fakeredis[lua]>=1.8.0']
REQUIRES_MEMCACHED = ['aiomcache>=0.7.0']
REQUIRES_TESTS = [
'bandit',
'docker-compose',
'flake8',
'pytest',
'pytest-asyncio',
'pytest-cov',
'tox',
'twine',
#
'fastapi[all]',
'PyYAML>=5.3.1,!=5.4.0,!=5.4.1,<6'
]
REQUIRES_EXTRA = {
'all': REQUIRES_MEMCACHED,
'fakeredis': REQUIRES_FAKEREDIS,
'memcached': REQUIRES_MEMCACHED,
'dev': REQUIRES_MEMCACHED + REQUIRES_FAKEREDIS + 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',
'Programming Language :: Python :: 3.8',
'Topic :: Utilities',
'Topic :: Software Development :: Libraries',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: System :: Logging',
'Framework :: AsyncIO',
'Operating System :: OS Independent',
'Intended Audience :: Developers',
]
)