封装自己的库,文件夹需按以下格式
├── LICENSE
├── README.md
├── packageName
│ ├── __init__.py
│ ├── hello.py
│ ├── word.py
├── setup.py
setup.py
from setuptools import setup
setup(
name='example_package',
version='0.0.1',
packages=['packageName'],
install_requires=[
'requests',
'importlib'
],
license = 'MIT License',
description = 'record my study',
author = 'hello world',
author_email = 'hellow@qq.com',
)
setup.py参数介绍以及详细使用,参考:https://www.cnblogs.com/maociping/p/6633948.html
项目打包
python setup.py sdist bdist_wheel
上传库文件
1.前去 https://pypi.org/ 注册账号 2.创建 ~/.pypirc 文件
windows: C:\Users\Administrator(C盘根目录创建.pypirc文件)
[distutils]
index-servers=pypi
[pypi]
repository = https://upload.pypi.org/legacy/
username = xxx
password = xxx
3.python setup.py sdist upload
上传package(详细) 参考:https://packaging.python.org/tutorials/packaging-projects/
项目维护
python setup.py sdist upload
|