pip的whell包.whl打包过程记录

安装库: pip install setuptools wheel  

1.目录结构

-test_package
    --src
        --test_package
            -- __init__.py
            --function.py
    --pyproject.toml
--readme.md

2.文件说明

pyproject.toml
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "holiday-chn"
version = "1.2024.3"
authors = [
{ name="lytcreate", email="lytcreate@163.com" },
]
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()方法获取指定年的工作日日期。"
readme = "README.md"
requires-python = ">=3.0"
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License"
]


__init__.py 
from .function import function1 from .function import function2 __all__ = ('function1', 'function2')


function.py 自定义功能实现

readme.mc
随便写写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
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

lytcreate.

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值