From 05f8bf2250ccf69678fab3e0a3dd7b1e63a4f757 Mon Sep 17 00:00:00 2001 From: Arthit Suriyawongkul Date: Sun, 8 Mar 2026 14:44:52 +0700 Subject: [PATCH 1/2] Migrate build backend to hatchling Simplify configurations, remove the need of MANIFEST.in --- .github/workflows/deploy-docs.yml | 6 +----- .github/workflows/pypi-test.yml | 2 +- .github/workflows/unittest.yml | 7 +------ MANIFEST.in | 8 -------- pyproject.toml | 20 +++++++++++--------- 5 files changed, 14 insertions(+), 29 deletions(-) delete mode 100644 MANIFEST.in diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index 0fa4ee0ac..749c17e54 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -30,11 +30,7 @@ jobs: with: python-version: "3.12" - name: Install build tools and doc build tools - run: | - pip install --upgrade "pip<24.1" "setuptools>=69.0.0,<=73.0.1" - # pip<24.1 because https://github.com/omry/omegaconf/pull/1195 - # setuptools>=65.0.2 because https://github.com/pypa/setuptools/commit/d03da04e024ad4289342077eef6de40013630a44#diff-9ea6e1e3dde6d4a7e08c7c88eceed69ca745d0d2c779f8f85219b22266efff7fR1 - # setuptools<=73.0.1 because https://github.com/pypa/setuptools/issues/4620 + run: pip install --upgrade pip - name: Install PyThaiNLP run: pip install ".[docs]" - name: Build sphinx documentation diff --git a/.github/workflows/pypi-test.yml b/.github/workflows/pypi-test.yml index 8cb8ac2c9..d18a6d22d 100644 --- a/.github/workflows/pypi-test.yml +++ b/.github/workflows/pypi-test.yml @@ -33,7 +33,7 @@ jobs: env: SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL: True run: | - python -m pip install --upgrade "pip<24.1" setuptools + python -m pip install --upgrade pip python -m pip install ".[compact]" python -m nltk.downloader omw-1.4 diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index 181395a3f..16ecc2d34 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -21,7 +21,6 @@ on: - "pythainlp/**" - "tests/**" - "Makefile" - - "MANIFEST.in" - "pyproject.toml" pull_request: branches: @@ -33,7 +32,6 @@ on: - "pythainlp/**" - "tests/**" - "Makefile" - - "MANIFEST.in" - "pyproject.toml" # Avoid duplicate runs for the same source branch and repository. @@ -94,11 +92,8 @@ jobs: - name: Install build tools run: | - pip install --upgrade "pip<24.1" "setuptools>=69.0.0,<=73.0.1" + pip install --upgrade pip pip install coverage coveralls - # pip<24.1 because https://github.com/omry/omegaconf/pull/1195 - # setuptools>=65.0.2 because https://github.com/pypa/setuptools/commit/d03da04e024ad4289342077eef6de40013630a44#diff-9ea6e1e3dde6d4a7e08c7c88eceed69ca745d0d2c779f8f85219b22266efff7fR1 - # setuptools<=73.0.1 because https://github.com/pypa/setuptools/issues/4620 - name: Install ICU (macOS) if: startsWith(matrix.os, 'macos-') diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 68f94ef42..000000000 --- a/MANIFEST.in +++ /dev/null @@ -1,8 +0,0 @@ -include CONTRIBUTING.md -include LICENSE -include README.md -include README_TH.md - -recursive-include tests * -recursive-exclude * __pycache__ -recursive-exclude * *.py[co] diff --git a/pyproject.toml b/pyproject.toml index 447e840ea..efd02f6e2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,8 +3,8 @@ # SPDX-License-Identifier: Apache-2.0 [build-system] -requires = ["setuptools>=69.0.0", "wheel"] -build-backend = "setuptools.build_meta" +requires = ["hatchling"] +build-backend = "hatchling.build" [project] name = "pythainlp" @@ -297,14 +297,16 @@ issues = "https://github.com/PyThaiNLP/pythainlp/issues" [project.scripts] thainlp = "pythainlp.__main__:main" -[tool.setuptools] -include-package-data = true +[tool.hatch.build.targets.wheel] +packages = ["pythainlp"] -[tool.setuptools.packages.find] -exclude = ["tests", "tests.*"] - -[tool.setuptools.package-data] -pythainlp = ["corpus/*"] +[tool.hatch.build.targets.sdist] +include = [ + "pythainlp/", + "tests/", + "LICENSE", + "README.md", +] # Bumpversion configuration [tool.bumpversion] From 9a72389ae47c87e01f3e4de09188fbdc048e8ace Mon Sep 17 00:00:00 2001 From: Arthit Suriyawongkul Date: Sun, 8 Mar 2026 14:52:13 +0700 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index de60f144b..8ee2b1a7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -51,6 +51,7 @@ The minimum requirement is now Python 3.9. when the var is set; auto-downloads otherwise (#1306) - Callers raise `FileNotFoundError` with download instructions when a corpus path cannot be resolved (#1306) +- Migrate build backend to `hatchling` (#1311) ### Deprecated