Skip to content
Myr

setup.py

This file

Path

setup.py

90 lines · 2.7 KiB · Python

Last changed by

Use either brotli or brotlicffi. (#1618)Tom Christiebefore adoptiond514312

History of this file

Take it

1#!/usr/bin/env python2# -*- coding: utf-8 -*-34import re5from pathlib import Path67from setuptools import setup8910def get_version(package):11    """12    Return package version as listed in `__version__` in `init.py`.13    """14    version = Path(package, "__version__.py").read_text()15    return re.search("__version__ = ['\"]([^'\"]+)['\"]", version).group(1)161718def get_long_description():19    """20    Return the README.21    """22    long_description = ""23    with open("README.md", encoding="utf8") as f:24        long_description += f.read()25    long_description += "\n\n"26    with open("CHANGELOG.md", encoding="utf8") as f:27        long_description += f.read()28    return long_description293031def get_packages(package):32    """33    Return root package and all sub-packages.34    """35    return [str(path.parent) for path in Path(package).glob("**/__init__.py")]363738setup(39    name="httpx",40    python_requires=">=3.6",41    version=get_version("httpx"),42    url="https://github.com/encode/httpx",43    project_urls={44        "Changelog": "https://github.com/encode/httpx/blob/master/CHANGELOG.md",45        "Documentation": "https://www.python-httpx.org",46        "Source": "https://github.com/encode/httpx",47    },48    license="BSD",49    description="The next generation HTTP client.",50    long_description=get_long_description(),51    long_description_content_type="text/markdown",52    author="Tom Christie",53    author_email="tom@tomchristie.com",54    package_data={"httpx": ["py.typed"]},55    packages=get_packages("httpx"),56    include_package_data=True,57    zip_safe=False,58    install_requires=[59        "certifi",60        "charset_normalizer",61        "sniffio",62        "rfc3986[idna2008]>=1.3,<2",63        "httpcore>=0.13.3,<0.14.0",64        "async_generator; python_version < '3.7'"65    ],66    extras_require={67        "http2": "h2>=3,<5",68        "brotli": [69            "brotli; platform_python_implementation == 'CPython'",70            "brotlicffi; platform_python_implementation != 'CPython'"71        ],72    },73    classifiers=[74        "Development Status :: 4 - Beta",75        "Environment :: Web Environment",76        "Intended Audience :: Developers",77        "License :: OSI Approved :: BSD License",78        "Operating System :: OS Independent",79        "Topic :: Internet :: WWW/HTTP",80        "Framework :: AsyncIO",81        "Framework :: Trio",82        "Programming Language :: Python :: 3",83        "Programming Language :: Python :: 3.6",84        "Programming Language :: Python :: 3.7",85        "Programming Language :: Python :: 3.8",86        "Programming Language :: Python :: 3.9",87        "Programming Language :: Python :: 3.10",88        "Programming Language :: Python :: 3 :: Only",89    ],90)