From 76eb8fa8ec36280327d15048ae80c74ce561faf1 Mon Sep 17 00:00:00 2001 From: Konstantin Chernyshev Date: Mon, 13 Dec 2021 23:38:23 +0300 Subject: [PATCH] Refactored setup.py to setup.cfg --- setup.cfg | 50 +++++++++++++++++++++++++++++++++++++++++ setup.py | 67 ++----------------------------------------------------- 2 files changed, 52 insertions(+), 65 deletions(-) diff --git a/setup.cfg b/setup.cfg index 20c2588a1..f4ab05c1b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,3 +1,53 @@ +[metadata] +name = starlette +version = attr: starlette.__init__.__version__ +author = Tom Christie +author_email = tom@tomchristie.com +description = The little ASGI library that shines. +long_description = file: README.md +long_description_content_type = text/markdown +url = https://github.com/encode/starlette +license = BSD +classifiers = + Development Status :: 3 - Alpha + Environment :: Web Environment + Intended Audience :: Developers + License :: OSI Approved :: BSD License + Operating System :: OS Independent + Topic :: Internet :: WWW/HTTP + Programming Language :: Python :: 3 + Programming Language :: Python :: 3.6 + Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 + +[options] +packages = find: +include_package_data = True +zip_safe = False +python_requires = >=3.6 +install_requires = + anyio >=3.0.0, <4 + typing_extensions; python_version <'3.8' + contextlib2 >=21.6.0; python_version <'3.7' + +[options.package_data] +starlette = py.typed + +[options.packages.find] +exclude = + tests* + +[options.extras_require] +full = + itsdangerous + jinja2 + python-multipart + pyyaml + requests + + [flake8] ignore = W503, E203, B305 max-line-length = 88 diff --git a/setup.py b/setup.py index 3b8d32e16..3e30711ea 100644 --- a/setup.py +++ b/setup.py @@ -1,69 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- +from setuptools import setup -import os -import re -from setuptools import setup, find_packages - - -def get_version(package): - """ - Return package version as listed in `__version__` in `init.py`. - """ - with open(os.path.join(package, "__init__.py")) as f: - return re.search("__version__ = ['\"]([^'\"]+)['\"]", f.read()).group(1) - - -def get_long_description(): - """ - Return the README. - """ - with open("README.md", encoding="utf8") as f: - return f.read() - - -setup( - name="starlette", - python_requires=">=3.6", - version=get_version("starlette"), - url="https://github.com/encode/starlette", - license="BSD", - description="The little ASGI library that shines.", - long_description=get_long_description(), - long_description_content_type="text/markdown", - author="Tom Christie", - author_email="tom@tomchristie.com", - packages=find_packages(exclude=["tests*"]), - package_data={"starlette": ["py.typed"]}, - include_package_data=True, - install_requires=[ - "anyio>=3.0.0,<4", - "typing_extensions; python_version < '3.8'", - "contextlib2 >= 21.6.0; python_version < '3.7'", - ], - extras_require={ - "full": [ - "itsdangerous", - "jinja2", - "python-multipart", - "pyyaml", - "requests", - ] - }, - classifiers=[ - "Development Status :: 3 - Alpha", - "Environment :: Web Environment", - "Intended Audience :: Developers", - "License :: OSI Approved :: BSD License", - "Operating System :: OS Independent", - "Topic :: Internet :: WWW/HTTP", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - ], - zip_safe=False, -) +setup()