setup.py
from setuptools import setup, find_packages
setup(
name='ifindex', # 包名
version='0.0.2', # 版本
description="some index", # 包简介
long_description=open('README.md').read(), # 读取文件中介绍包的详细内容
include_package_data=True, # 是否允许上传资源文件
author='haifan', # 作者
author_email='', # 作者邮件
maintainer='', # 维护者
maintainer_email='', # 维护者邮件
license='MIT License', # 协议
url='', # github或者自己的网站地址
packages=find_packages(), # 包的目录
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'Topic :: Software Development :: Build Tools',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3', # 设置编写时的python版本
],
python_requires='>=3.7', # 设置python版本要求
install_requires=[''], # 安装所需要的库
# entry_points={
# 'console_scripts': [
# ''],
# }, # 设置命令行工具(可不使用就可以注释掉)
)
# 生成打包文件
python setup.py sdist
# 上传pypi
twine upload dist/*
安装之后就可以使用了
总结上文:
要使from iftool import *
能正常工作,各级__init__.py需要加上
__all__ = ["ifdb","index"]
要使import iftool
之后能直接使用iftool中各模块,各级__init__.py中需要加入import各模块相关代码
如果是import xxx,则需要xxx.yyy全名使用
如果是from xxx import yyy。则可直接使用yyy