Python项目标准库化

from setuptools import setup, find_packages

with open("README.md") as f:
    readme = f.read()

with open("LICENSE") as f:
    license = f.read()

setup(
    name="sample",
    version="0.1.0",
    description="Sample package for python.org",
    author="sql",
    url="https://github.com/sql/repository",
    license=license,
    packages=find_packages(exclude=("tests","docs"))
)
制作pip开源包:https://www.pythonav.com/wiki/detail/6/95/

自己的项目制作成第三方库,可以使用setup.py完成,安装完成,就能像标准库一样引用项目内的包和模块

给setup()函数传入必要的参数,使用find_packages()执行项目中哪些目录是包(无论是打包发布,还是直接copy,用户都可以使用pip来安装)

原文地址:https://www.cnblogs.com/qlshao/p/13706980.html