python 打包相关

python包目录示例

my_package/
├── __init__.py
├── module1.py
├── module2.py
├── setup.py
├── requirements.txt
├── README.md
├── docs/
│   ├── guide.md
│   └── api_reference.md
├── tests/
│   ├── test_module1.py
│   └── test_module2.py
└── examples/
    └── example.py

内容可以放到python package,tests不要是python package

setup.py 示例

from setuptools import setup, find_packages

setup(
    name='my_package',
    version='1.0.0',
    author='Your Name',
    author_email='your_email@example.com',
    description='A description of my package',
    packages=find_packages(),
    install_requires=[
        'numpy>=1.0.0',
        'requests>=2.0.0',
    ],
)
paramsdesc
name包的名称
version包的版本号
author包的作者名字
author_email作者的电子邮件地址
description对包的简要描述
packages要包含的包列表,可以使用 find_packages() 函数自动查找包
install_requires包的依赖项列表,指定其他需要安装的包及其版本号
classifiers一组用于描述包特性的分类标签
keywords描述包的关键字列表
url包的官方网址
license包的许可证类型
long_description包的详细描述,通常是一个包含文本的文件名
long_description_content_type长描述的内容类型
entry_points定义包的可执行脚本或命令行工具的入口点
python_requires指定所需的 Python 版本范围
extras_require指定可选的额外依赖项
package_data指定包含在包中的其他非 Python 文件

打包命令:

打wheel包:python setup.py bdist_wheel

打tar包:python setup.py sdist

一起用:python setup.py bdist_wheel sdist

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值