pip的whell包.whl打包过程记录
安装库: pip install setuptools wheel
1.目录结构
1 2 3 4 5 6 | -test_package --src --test_package -- __init__.py --function.py --pyproject.toml<br> --readme.md |
2.文件说明
1 | pyproject.toml< br >[build-system]< br >requires = ["setuptools", "wheel"]< br >build-backend = "setuptools.build_meta"< br >< br >[project]< br >name = "holiday-chn"< br >version = "1.2024.3"< br >authors = [< br > { name="lytcreate", email="lytcreate@163.com" },< br >]< br >description = "This package provides judgment on Chinese holidays and outputs the dates of all holidays.By using it, one can determine whether a certain date is a holiday and obtain the working days or holidays of a certain year.\n该库提供了2018年以后的中国节假日查询,包含法定节假日及周末,主要有is_holiday()方法判断日期是否为节假日,holidays()方法获取指定年的节假日日期,workdays()方法获取指定年的工作日日期。"< br >readme = "README.md"< br >requires-python = ">=3.0"< br >classifiers = [< br > "Programming Language :: Python :: 3",< br > "License :: OSI Approved :: MIT License"< br >]< br >< br >< br >__init__.py < br >from .function import function1 < br >from .function import function2 __all__ = ('function1', 'function2') < br >< br >< br >function.py 自定义功能实现< br >< br >readme.mc< br >随便写写md的介绍,末尾双空格为换行 |
3.打包:先安装build库 pip install build, 在根目录执行 python -m build
完成后dist目录下会生成对应的whl 和 tar.gz文件,直接使用pip install xxx.whl安装即可
4.发布pypi: 需要先注册账号,登录后台,验证邮箱,获取token,
安装库: pip install twine
在dist外层目录执行: twine upload dist/*
输入账号: __token__ (双下划线)
密码:token
成功后会出现线上地址,访问即可看到
holiday-chn库介绍:该库可实现对日期进行判断是否为节假日,可输出指定年份的所有休假日和工作日列表,举例使用:
提示[tips]
仅适用于2018-01-01以后的中国节假日查询, 包含法定节假日及周末
安装[install]
pip install holiday-chn
使用[use]
import holiday_chn
判断传入日期是否为节假日[Determine whether the incoming date is a holiday]
holiday_chn.is_holiday('2024-01-01') // return True
获取指定年份的节假日日期[Obtain holiday dates for the specified year]
holiday_chn.holidays(2024) // return date list of holidays
获取指定年份的工作日日期[Obtain the working day date of the specified year]
holiday_chn.workdays(2024) // return date list of workdays
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· 提示词工程——AI应用必不可少的技术
· 字符编码:从基础到乱码解决
· 地球OL攻略 —— 某应届生求职总结