Skip to content

Use pyicu-wheels for tests via PEP 735 dependency groups; remove redundant optional-deps#1337

Draft
Copilot wants to merge 5 commits intodevfrom
copilot/use-pyicu-wheels-for-tests
Draft

Use pyicu-wheels for tests via PEP 735 dependency groups; remove redundant optional-deps#1337
Copilot wants to merge 5 commits intodevfrom
copilot/use-pyicu-wheels-for-tests

Conversation

Copy link
Contributor

Copilot AI commented Mar 14, 2026

Installing pyicu for testing required compiling ICU from source on macOS (via Homebrew) and downloading unofficial wheels on Windows. Development/testing deps were also mixed into [project.optional-dependencies], which is meant for end-users.

What do these changes do

  • Introduces PEP 735 [dependency-groups] in pyproject.toml covering all test suites (test-core, test-compact, test-extra, test-noauto-{torch,tensorflow,onnx,cython,network}, test-corpus, test-full) plus dev and docs
  • Replaces pyicu with pyicu-wheels in all test groups — pre-built wheels for all platforms, no compilation needed
  • Removes compact, extra, noauto-*, full, dev, docs from [project.optional-dependencies]; feature sets (icu, spell, wordnet, etc.) remain untouched
  • Updates all CI workflows to use pip install --group <name>
  • Removes macOS brew install icu4c and Windows unofficial-wheel-download steps from unittest.yml
# Before
pip install ".[compact]"         # required compiling ICU on macOS/Windows

# After
pip install pythainlp
pip install --group test-compact  # resolves pyicu-wheels pre-built wheel

What was wrong

[project.optional-dependencies] grouped both end-user feature sets and test/dev tooling together. Testing with pyicu required platform-specific ICU compilation or unofficial binary sources, making local setup on macOS/Windows unnecessarily difficult.

How this fixes it

PEP 735 [dependency-groups] cleanly separates dev/test deps from the distributed package metadata. Substituting pyicu-wheels (Init7's pre-built distribution, for testing only — distribution deps still declare pyicu) eliminates all platform-specific ICU setup steps in CI and locally.

Security note: pyicu-wheels is a third-party pre-built distribution of PyICU by Init7, scoped to test groups only. The published package's icu = ["pyicu>=2.3"] optional-dep continues to reference the official PyICU package.

Your checklist for this pull request

  • Passed code styles and structures
  • Passed code linting checks and unit test
Original prompt

This section details on the original issue you should resolve

<issue_title>Use pyicu-wheels for tests</issue_title>
<issue_description>Consider to use https://pypi.org/project/pyicu-wheels/ (source code https://github.com/Init7/pyicu) instead of https://pypi.org/project/pyicu/ (source code https://gitlab.pyicu.org/main/pyicu), for testing purpose.

  • This will allow easier test on Windows / macOS locally (currently, it is quite complicated to install pyicu on macOS as it involves compiling and link with icu4c / for Windows user, it require a download from separated source)
  • Maybe quicker in CI as it doesn't require build the lib from scratch

For distribution, the declared project dependency in pyproject.toml should still stick to https://pypi.org/project/pyicu/.

Each test suite dependencies could be declared by using the PEP 735 dependency groups https://packaging.python.org/en/latest/specifications/dependency-groups/#dependency-groups. Modify pyproject.toml for that. Modify test workflow accordingly (for example, use pip install --group)

Make sure that dependency groups for test suites are covering what are actually needed by the test suites (core, compact, extra, noauto, corpus) See https://github.com/PyThaiNLP/pythainlp/blob/dev/tests/README.md

The main goal is to allow developers to install pythainlp dependency for testing purpose easily -- without the need to compile pyicu themselves.

The second goal is, once the first goal is achieved, it will simplify the CI in .github/workflows/unittest.yml
</issue_description>

<agent_instructions>As https://github.com/Init7/pyicu is not the official repo of PyICU, be mindful about possible security issues.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

- Add [dependency-groups] section to pyproject.toml with test groups
  (test-core, test-compact, test-extra, test-noauto-{torch,tensorflow,
  onnx,cython,network}, test-corpus) using pyicu-wheels for pre-built
  ICU wheels instead of pyicu
- Simplify unittest.yml by removing macOS brew install icu4c step and
  Windows PyICU wheel download step; use pip install --group instead
- Update tests/README.md to document the new dependency groups approach
- Update CHANGELOG.md

Co-authored-by: bact <128572+bact@users.noreply.github.com>
@bact bact added the tests Unit test, code coverage, test case label Mar 14, 2026
@bact bact added this to the Future milestone Mar 14, 2026
@coveralls
Copy link

coveralls commented Mar 14, 2026

Coverage Status

coverage: 66.312%. remained the same
when pulling d8a1e3b on copilot/use-pyicu-wheels-for-tests
into fcb9210 on dev.

…roups

- Remove dev, docs, compact, extra, noauto-*, full from
  [project.optional-dependencies]
- Add dev, docs, test-full to [dependency-groups]; test-full uses
  pyicu-wheels instead of pyicu
- Update deploy-docs.yml and pypi-test.yml to use pip install --group
- Update tests/README.md to use only PEP 735 syntax
- Update CHANGELOG.md

Co-authored-by: bact <128572+bact@users.noreply.github.com>
Copilot AI changed the title [WIP] Use pyicu-wheels for tests in project Use pyicu-wheels for tests via PEP 735 dependency groups; remove redundant optional-deps Mar 14, 2026
Copilot AI requested a review from bact March 14, 2026 10:40
Copilot finished work on behalf of bact March 14, 2026 10:40
@bact bact marked this pull request as ready for review March 14, 2026 10:51
@sonarqubecloud
Copy link

@bact
Copy link
Member

bact commented Mar 14, 2026

pyicu-wheels does not provide a wheel for Python 3.9 on Windows.
May need to stick with current setup for a while.

But Python 3.9 is EOL and PyThaiNLP 6.0.0 may move to Python 3.10, so it is possible to proceed at that point.

Keep this PR open.

@bact bact marked this pull request as draft March 15, 2026 05:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests Unit test, code coverage, test case

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use pyicu-wheels for tests

3 participants