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 path = os.path.join(package, "__init__.py") 15 init_py = open(path, "r", encoding="utf8").read() 16 return re.search("__version__ = ['\"]([^'\"]+)['\"]", init_py).group(1) 17 18 19def get_long_description(): 20 """ 21 Return the README. 22 """ 23 return open("README.md", "r", encoding="utf8").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 37env_marker_cpython = ( 38 "sys_platform != 'win32'" 39 " and (sys_platform != 'cygwin'" 40 " and platform_python_implementation != 'PyPy')" 41) 42 43env_marker_win = "sys_platform == 'win32'" 44env_marker_below_38 = "python_version < '3.8'" 45 46minimal_requirements = [ 47 "asgiref>=3.4.0", 48 "click>=7.0", 49 "h11>=0.8", 50 "typing-extensions;" + env_marker_below_38, 51] 52 53 54extra_requirements = [ 55 "websockets>=9.1", 56 "httptools>=0.2.0,<0.4", 57 "uvloop>=0.14.0,!=0.15.0,!=0.15.1; " + env_marker_cpython, 58 "colorama>=0.4;" + env_marker_win, 59 "watchgod>=0.6", 60 "python-dotenv>=0.13", 61 "PyYAML>=5.1", 62] 63 64 65setup( 66 name="uvicorn", 67 version=get_version("uvicorn"), 68 url="https://www.uvicorn.org/", 69 license="BSD", 70 description="The lightning-fast ASGI server.", 71 long_description=get_long_description(), 72 long_description_content_type="text/markdown", 73 author="Tom Christie", 74 author_email="tom@tomchristie.com", 75 packages=get_packages("uvicorn"), 76 install_requires=minimal_requirements, 77 extras_require={"standard": extra_requirements}, 78 include_package_data=True, 79 classifiers=[ 80 "Development Status :: 4 - Beta", 81 "Environment :: Web Environment", 82 "Intended Audience :: Developers", 83 "License :: OSI Approved :: BSD License", 84 "Operating System :: OS Independent", 85 "Topic :: Internet :: WWW/HTTP", 86 "Programming Language :: Python :: 3", 87 "Programming Language :: Python :: 3.6", 88 "Programming Language :: Python :: 3.7", 89 "Programming Language :: Python :: 3.8", 90 "Programming Language :: Python :: 3.9", 91 "Programming Language :: Python :: 3.10", 92 "Programming Language :: Python :: Implementation :: CPython", 93 "Programming Language :: Python :: Implementation :: PyPy", 94 ], 95 entry_points=""" 96 [console_scripts] 97 uvicorn=uvicorn.main:main 98 """, 99 project_urls={ 100 "Funding": "https://github.com/sponsors/encode", 101 "Source": "https://github.com/encode/uvicorn", 102 "Changelog": "https://github.com/encode/uvicorn/blob/master/CHANGELOG.md", 103 }, 104) 105