From ca48511dcb0ae0541bf519fdb55bdb82b2e6f568 Mon Sep 17 00:00:00 2001 From: LI Daobing Date: Sun, 22 Nov 2026 15:19:41 -0700 Subject: [PATCH] Drop setup.py, move all metadata to pyproject.toml python3 setup.py failed with ModuleNotFoundError: setuptools because modern Pythons no longer bundle it. With PEP 621 metadata, builds go through pip/build which install setuptools in an isolated env, so running setup.py directly is no longer needed. --- pyproject.toml | 34 ++++++++++++++++++++++++++++++++++ setup.py | 43 ------------------------------------------- 2 files changed, 34 insertions(+), 43 deletions(-) delete mode 100755 setup.py diff --git a/pyproject.toml b/pyproject.toml index 07e10f1..b087d92 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,37 @@ [build-system] requires = ["setuptools >= 77.0.3"] build-backend = "setuptools.build_meta" + +[project] +name = "lunardate" +dynamic = ["version"] +description = "A Chinese Calendar Library in Pure Python" +readme = "README.md" +license = "GPL-3.0-or-later" +requires-python = ">=3.7" +authors = [ + { name = "LI Daobing", email = "lidaobing@gmail.com" }, +] +classifiers = [ + "Development Status :: 4 - Beta", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", + "Operating System :: OS Independent", + "Topic :: Software Development :: Libraries :: Python Modules", +] + +[project.urls] +Homepage = "https://github.com/lidaobing/python-lunardate" + +[tool.setuptools] +py-modules = ["lunardate"] + +[tool.setuptools.dynamic] +version = { attr = "lunardate.__version__" } diff --git a/setup.py b/setup.py deleted file mode 100755 index 11aba20..0000000 --- a/setup.py +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env python - -from setuptools import setup, find_packages -import os -import re - -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=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', - license = 'GPL-3.0-or-later', - python_requires='>=3.7', - classifiers = [ - 'Development Status :: 4 - Beta', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - 'Programming Language :: Python :: 3.11', - 'Programming Language :: Python :: 3.12', - 'Programming Language :: Python :: 3.13', - 'Programming Language :: Python :: 3.14', - 'Operating System :: OS Independent', - 'Topic :: Software Development :: Libraries :: Python Modules' - ] - )