From acad6b84c75418691b1ee12107588fe32cdcdbf8 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Sun, 13 Apr 2025 13:35:20 +0200 Subject: [PATCH 1/4] Modernize packaging --- pyproject.toml | 35 +++++++++++++++++++++++++++++++++++ setup.py | 43 ------------------------------------------- 2 files changed, 35 insertions(+), 43 deletions(-) delete mode 100644 setup.py diff --git a/pyproject.toml b/pyproject.toml index 43a0672..56f4e6a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,38 @@ +[build-system] +build-backend = "setuptools.build_meta" +requires = ["setuptools>=77.0"] + +[project] +name = "cssselect" +license = "BSD-3-Clause" +description = "cssselect parses CSS3 Selectors and translates them to XPath 1.0" +readme = "README.rst" +authors = [{ name = "Ian Bicking", email = "ianb@colorstudy.com" }] +maintainers = [{ name = "Paul Tremberth", email = "paul.tremberth@gmail.com" }] +requires-python = ">=3.9" +classifiers = [ + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "Programming Language :: Python :: 3", + "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 :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", +] +dynamic = ["version"] + +[project.urls] +"Homepage" = "https://github.com/scrapy/cssselect" + +[tool.setuptools.dynamic] +version = { attr = "cssselect.VERSION" } + +[tool.setuptools.packages.find] +include = ["cssselect*"] + [tool.bumpversion] current_version = "1.3.0" commit = true diff --git a/setup.py b/setup.py deleted file mode 100644 index cb870dd..0000000 --- a/setup.py +++ /dev/null @@ -1,43 +0,0 @@ -import re -from pathlib import Path - -from setuptools import setup - -ROOT = Path(__file__).parent -README = (ROOT / "README.rst").read_text(encoding="utf-8") -INIT_PY = (ROOT / "cssselect" / "__init__.py").read_text(encoding="utf-8") -VERSION = re.search('VERSION = "([^"]+)"', INIT_PY).group(1) - - -setup( - name="cssselect", - version=VERSION, - author="Ian Bicking", - author_email="ianb@colorstudy.com", - maintainer="Paul Tremberth", - maintainer_email="paul.tremberth@gmail.com", - description="cssselect parses CSS3 Selectors and translates them to XPath 1.0", - long_description=README, - long_description_content_type="text/x-rst", - url="https://github.com/scrapy/cssselect", - license="BSD", - packages=["cssselect"], - package_data={ - "cssselect": ["py.typed"], - }, - include_package_data=True, - python_requires=">=3.9", - classifiers=[ - "Development Status :: 4 - Beta", - "Intended Audience :: Developers", - "License :: OSI Approved :: BSD License", - "Programming Language :: Python :: 3", - "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 :: Implementation :: CPython", - "Programming Language :: Python :: Implementation :: PyPy", - ], -) From 87f045c42ccfbe5b801e7bd6e2baa6537cfc02a4 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Sun, 13 Apr 2025 14:06:26 +0200 Subject: [PATCH 2/4] Fix pylint --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 7746739..026741a 100644 --- a/tox.ini +++ b/tox.ini @@ -18,7 +18,7 @@ deps = {[testenv]deps} pylint==3.3.5 commands = - pylint {posargs: cssselect setup.py tests docs} + pylint {posargs: cssselect tests docs} [testenv:docs] changedir = docs From 19da36715c1c88520e2a03d989cc0ebc1cf8767b Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Thu, 17 Apr 2025 18:32:12 +0200 Subject: [PATCH 3/4] Switch build-backend to hatchling --- MANIFEST.in | 4 ---- pyproject.toml | 26 ++++++++++++++++++++------ 2 files changed, 20 insertions(+), 10 deletions(-) delete mode 100644 MANIFEST.in diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 18022a7..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1,4 +0,0 @@ -include AUTHORS CHANGES LICENSE README.rst tox.ini cssselect/py.typed -recursive-include docs * -recursive-include tests * -prune docs/_build diff --git a/pyproject.toml b/pyproject.toml index 56f4e6a..033dd1c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,11 @@ [build-system] -build-backend = "setuptools.build_meta" -requires = ["setuptools>=77.0"] +build-backend = "hatchling.build" +requires = ["hatchling>=1.27.0"] [project] name = "cssselect" license = "BSD-3-Clause" +license-files = ["LICENSE", "AUTHORS"] description = "cssselect parses CSS3 Selectors and translates them to XPath 1.0" readme = "README.rst" authors = [{ name = "Ian Bicking", email = "ianb@colorstudy.com" }] @@ -27,11 +28,24 @@ dynamic = ["version"] [project.urls] "Homepage" = "https://github.com/scrapy/cssselect" -[tool.setuptools.dynamic] -version = { attr = "cssselect.VERSION" } +[tool.hatch.version] +path = "cssselect/__init__.py" -[tool.setuptools.packages.find] -include = ["cssselect*"] +[tool.hatch.build.targets.sdist] +include = [ + "cssselect", + "docs", + "tests", + "CHANGES", + "README.rst", + "tox.ini", +] +exclude = [ + "docs/_build", +] + +[tool.hatch.build.targets.wheel] +packages = ["cssselect"] [tool.bumpversion] current_version = "1.3.0" From fb04b830dc68465d23219b79c6eb80908bd5fcdf Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Fri, 18 Apr 2025 14:46:14 +0200 Subject: [PATCH 4/4] Fix glob patterns --- pyproject.toml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 033dd1c..782657e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,15 +33,15 @@ path = "cssselect/__init__.py" [tool.hatch.build.targets.sdist] include = [ - "cssselect", - "docs", - "tests", - "CHANGES", - "README.rst", - "tox.ini", + "/cssselect", + "/docs", + "/tests", + "/CHANGES", + "/README.rst", + "/tox.ini", ] exclude = [ - "docs/_build", + "/docs/_build", ] [tool.hatch.build.targets.wheel]