Chinese Calendar Date
力求简单、稳定、高效的农历日期 Python 库。
功能一览
- 农历日期的判等和比较
- 农历日期的加减(与
datetime.timedelta) - 农历日期的数字化和汉字化
- 公农历的互相转换
- 范围有限的快速转换(
FastCCD) - 范围无限的计算转换(
EphemCCD)
- 范围有限的快速转换(
- 支持 Pickle 协议
- 中文文档注释
兼容性
目前仅支持使用 Python 3.11 及以上版本运行。
如果希望支持旧版本,可以提出 Issue 并注明希望支持的最低版本,或点赞表态,也欢迎参与翻译。
快速上手
安装
pip install CCD
使用
from datetime import date, timedelta
from ccd import FastCCD
gcd = date.today()
print(str(gcd)) # '2020-06-20'
ccd = FastCCD.from_date(gcd)
print(str(ccd)) # '农历2020年闰四月廿九'
print(repr(ccd)) # 'ccd.base.FastCCD(2020, 4, 29, True)'
ccd += timedelta(days=1)
print(str(ccd)) # '农历2020年五月初一'
print(repr(ccd)) # 'ccd.base.FastCCD(2020, 5, 1, False)'
gcd = ccd.to_date()
print(str(gcd)) # '2020-06-21'
说明
农历日期类有以下几个:
ccd.EphemCCD,无限范围。需要安装 PyEphem 库后才可用。ccd.FastCCD,有限范围。无论何时都可用。ccd.ChineseCalendarDate,无论何时都可用。- 默认情况下等同于
FastCCD。 - 安装 PyEphem 库后等同于
EphemCCD。
- 默认情况下等同于
问题反馈
码云:https://gitee.com/aixcyi/CCD/issues
GitHub:https://github.com/aixcyi/CCD/issues
Metadata
Release files for CCD 0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| CCD-0.2-py3-none-any.whl | Python 3 | none | any | Details for CCD-0.2-py3-none-any.whl |
Release files / CCD-0.2-py3-none-any.whl
| Download URL | CCD-0.2-py3-none-any.whl |
|---|---|
| Size | 13.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d64062daae73443ccdfec9d8a6c2aebdf2b900c7b785433e2fa1c8ace9e1319c
|
|
BLAKE2b-256 checksum How to use checksums |
1d4faa5ac838bf4b2cda36824c67218fda19a686a18d6c965ef8032e8d4c7bcb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.0
|
Security for CCD 0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.