From 8e9484888af7327ca176602c492d3eb6874ac76c Mon Sep 17 00:00:00 2001 From: LI Daobing Date: Mon, 6 Jul 2026 22:01:59 -0700 Subject: [PATCH 1/3] 1 --- .gitignore | 1 + lunardate.egg-info/PKG-INFO | 132 ------------------------ lunardate.egg-info/SOURCES.txt | 8 -- lunardate.egg-info/dependency_links.txt | 1 - lunardate.egg-info/top_level.txt | 1 - pyproject.toml | 3 + setup.py | 17 ++- 7 files changed, 18 insertions(+), 145 deletions(-) delete mode 100644 lunardate.egg-info/PKG-INFO delete mode 100644 lunardate.egg-info/SOURCES.txt delete mode 100644 lunardate.egg-info/dependency_links.txt delete mode 100644 lunardate.egg-info/top_level.txt create mode 100644 pyproject.toml diff --git a/.gitignore b/.gitignore index f72f665..f939994 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ *.swp build dist +lunardate.egg-info diff --git a/lunardate.egg-info/PKG-INFO b/lunardate.egg-info/PKG-INFO deleted file mode 100644 index 09c28a6..0000000 --- a/lunardate.egg-info/PKG-INFO +++ /dev/null @@ -1,132 +0,0 @@ -Metadata-Version: 2.4 -Name: lunardate -Version: 0.2.2 -Summary: A Chinese Calendar Library in Pure Python -Home-page: https://github.com/lidaobing/python-lunardate -Author: LI Daobing -Author-email: lidaobing@gmail.com -License: GPLv3 -Classifier: Development Status :: 4 - Beta -Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.7 -Classifier: Programming Language :: Python :: 3.8 -Classifier: Programming Language :: Python :: 3.9 -Classifier: Programming Language :: Python :: 3.10 -Classifier: Programming Language :: Python :: 3.11 -Classifier: License :: OSI Approved :: GNU General Public License (GPL) -Classifier: Operating System :: OS Independent -Classifier: Topic :: Software Development :: Libraries :: Python Modules -Requires-Python: >=3.7 -License-File: LICENSE.txt -Dynamic: author -Dynamic: author-email -Dynamic: classifier -Dynamic: description -Dynamic: home-page -Dynamic: license -Dynamic: license-file -Dynamic: requires-python -Dynamic: summary - - -A Chinese Calendar Library in Pure Python -========================================= - -Chinese Calendar: http://en.wikipedia.org/wiki/Chinese_calendar - -Usage ------ - >>> LunarDate.fromSolarDate(1976, 10, 1) - LunarDate(1976, 8, 8, 1) - >>> LunarDate(1976, 8, 8, 1).toSolarDate() - datetime.date(1976, 10, 1) - >>> LunarDate(1976, 8, 8, 1).year - 1976 - >>> LunarDate(1976, 8, 8, 1).month - 8 - >>> LunarDate(1976, 8, 8, 1).day - 8 - >>> LunarDate(1976, 8, 8, 1).isLeapMonth - True - - >>> today = LunarDate.today() - >>> type(today).__name__ - 'LunarDate' - - >>> # support '+' and '-' between datetime.date and datetime.timedelta - >>> ld = LunarDate(1976,8,8) - >>> sd = datetime.date(2008,1,1) - >>> td = datetime.timedelta(days=10) - >>> ld-ld - datetime.timedelta(0) - >>> (ld-sd).days - -11444 - >>> ld-td - LunarDate(1976, 7, 27, 0) - >>> (sd-ld).days - 11444 - >>> ld+td - LunarDate(1976, 8, 18, 0) - >>> td+ld - LunarDate(1976, 8, 18, 0) - >>> ld2 = LunarDate.today() - >>> ld < ld2 - True - >>> ld <= ld2 - True - >>> ld > ld2 - False - >>> ld >= ld2 - False - >>> ld == ld2 - False - >>> ld != ld2 - True - >>> ld == ld - True - >>> LunarDate.today() == LunarDate.today() - True - >>> before_leap_month = LunarDate.fromSolarDate(2088, 5, 17) - >>> before_leap_month.year - 2088 - >>> before_leap_month.month - 4 - >>> before_leap_month.day - 27 - >>> before_leap_month.isLeapMonth - False - >>> leap_month = LunarDate.fromSolarDate(2088, 6, 17) - >>> leap_month.year - 2088 - >>> leap_month.month - 4 - >>> leap_month.day - 28 - >>> leap_month.isLeapMonth - True - >>> after_leap_month = LunarDate.fromSolarDate(2088, 7, 17) - >>> after_leap_month.year - 2088 - >>> after_leap_month.month - 5 - >>> after_leap_month.day - 29 - >>> after_leap_month.isLeapMonth - False - - >>> LunarDate.leapMonthForYear(2023) - 2 - >>> LunarDate.leapMonthForYear(2022) # will return None - -Limits ------- - -this library can only deal with year from 1900 to 2099 (in chinese calendar). - -See also --------- - -* lunar: http://packages.qa.debian.org/l/lunar.html, - A converter written in C, this program is derived from it. -* python-lunar: http://code.google.com/p/liblunar/ - Another library written in C, including a python binding. diff --git a/lunardate.egg-info/SOURCES.txt b/lunardate.egg-info/SOURCES.txt deleted file mode 100644 index b37ab12..0000000 --- a/lunardate.egg-info/SOURCES.txt +++ /dev/null @@ -1,8 +0,0 @@ -LICENSE.txt -README.md -lunardate.py -setup.py -lunardate.egg-info/PKG-INFO -lunardate.egg-info/SOURCES.txt -lunardate.egg-info/dependency_links.txt -lunardate.egg-info/top_level.txt \ No newline at end of file diff --git a/lunardate.egg-info/dependency_links.txt b/lunardate.egg-info/dependency_links.txt deleted file mode 100644 index 8b13789..0000000 --- a/lunardate.egg-info/dependency_links.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/lunardate.egg-info/top_level.txt b/lunardate.egg-info/top_level.txt deleted file mode 100644 index 4f91082..0000000 --- a/lunardate.egg-info/top_level.txt +++ /dev/null @@ -1 +0,0 @@ -lunardate diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..251dd7a --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["setuptools >= 77.0.3"] +build-backend = "setuptools.build_meta" \ No newline at end of file diff --git a/setup.py b/setup.py index d043b5a..ce33abf 100755 --- a/setup.py +++ b/setup.py @@ -1,14 +1,25 @@ #!/usr/bin/env python from setuptools import setup, find_packages +import os +import re -import lunardate +def get_version(): + with open( + os.path.join(os.path.dirname(__file__), "lunardate.py"), + "r", + encoding="utf-8", + ) as f: + version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", f.read(), re.M) + if version_match: + return version_match.group(1) + raise RuntimeError("Unable to find version string.") setup(name='lunardate', - version=lunardate.__version__, + version=get_version(), py_modules = ['lunardate'], description = 'A Chinese Calendar Library in Pure Python', - long_description = lunardate.__doc__, + long_description = open("README.md", "r", encoding="utf-8").read(), author = 'LI Daobing', author_email = 'lidaobing@gmail.com', url = 'https://github.com/lidaobing/python-lunardate', From f9bf73b02982956bcef3b32bfde4d8469092e2aa Mon Sep 17 00:00:00 2001 From: LI Daobing Date: Mon, 6 Jul 2026 22:03:04 -0700 Subject: [PATCH 2/3] 1 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 251dd7a..07e10f1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,3 @@ [build-system] requires = ["setuptools >= 77.0.3"] -build-backend = "setuptools.build_meta" \ No newline at end of file +build-backend = "setuptools.build_meta" From 3e3e97d85250a75986e0abd5e399103673717094 Mon Sep 17 00:00:00 2001 From: LI Daobing Date: Mon, 6 Jul 2026 22:06:12 -0700 Subject: [PATCH 3/3] 1 --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index 2638d8f..31858de 100755 --- a/setup.py +++ b/setup.py @@ -20,6 +20,7 @@ def get_version(): py_modules = ['lunardate'], description = 'A Chinese Calendar Library in Pure Python', long_description = open("README.md", "r", encoding="utf-8").read(), + long_description_content_type="text/markdown", author = 'LI Daobing', author_email = 'lidaobing@gmail.com', url = 'https://github.com/lidaobing/python-lunardate',