Skip to content
Myr

setup.py

This file

Path

setup.py

67 lines · 1.7 KiB · Python

Last changed by

Use pathlib.Path instead of os.path functions (#188)Stephen Brown IIbefore adoptionfde30b8

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    with open("README.md", encoding="utf8") as f:23        return f.read()242526def get_packages(package):27    """28    Return root package and all sub-packages.29    """30    return [str(path.parent) for path in Path(package).glob("**/__init__.py")]313233setup(34    name="httpx",35    python_requires=">=3.6",36    version=get_version("httpx"),37    url="https://github.com/encode/httpx",38    license="BSD",39    description="The next generation HTTP client.",40    long_description=get_long_description(),41    long_description_content_type="text/markdown",42    author="Tom Christie",43    author_email="tom@tomchristie.com",44    package_data={"httpx": ["py.typed"]},45    packages=get_packages("httpx"),46    install_requires=[47        "certifi",48        "chardet==3.*",49        "h11==0.8.*",50        "h2==3.*",51        "hstspreload",52        "idna==2.*",53        "rfc3986==1.*",54    ],55    classifiers=[56        "Development Status :: 3 - Alpha",57        "Environment :: Web Environment",58        "Intended Audience :: Developers",59        "License :: OSI Approved :: BSD License",60        "Operating System :: OS Independent",61        "Topic :: Internet :: WWW/HTTP",62        "Programming Language :: Python :: 3",63        "Programming Language :: Python :: 3.6",64        "Programming Language :: Python :: 3.7",65        "Programming Language :: Python :: 3.8",66    ],67)