Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tzdata as a dependency on Windows #841

Merged
merged 1 commit into from
Sep 24, 2023
Merged

Add tzdata as a dependency on Windows #841

merged 1 commit into from
Sep 24, 2023

Conversation

BLKSerene
Copy link
Contributor

@BLKSerene BLKSerene commented Sep 24, 2023

What does this changes

Add tzdata as a dependency on Windows, and also some code cleanups in pythainlp.util.data.

What was wrong

pythainlp.util.data use the standard library zoneinfo, which would uses the system鈥檚 time zone data if available, otherwise it would use tzdata.

Time zone data is included on macOS and Linux, but not on Windows, so tzdata is required to be installed on Windows, otherwise on import pythainlp it would show this error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "D:\Python\lib\site-packages\pythainlp\__init__.py", line 57, in <module>
    from pythainlp.soundex import soundex
  File "D:\Python\lib\site-packages\pythainlp\soundex\__init__.py", line 29, in <module>
    from pythainlp.soundex.lk82 import lk82
  File "D:\Python\lib\site-packages\pythainlp\soundex\lk82.py", line 23, in <module>
    from pythainlp.util import remove_tonemark
  File "D:\Python\lib\site-packages\pythainlp\util\__init__.py", line 71, in <module>
    from pythainlp.util.date import (
  File "D:\Python\lib\site-packages\pythainlp\util\date.py", line 213, in <module>
    tzinfo=ZoneInfo("Asia/Bangkok")
  File "D:\Python\lib\zoneinfo\_common.py", line 24, in load_tzdata
    raise ZoneInfoNotFoundError(f"No time zone found with key {key}")
zoneinfo._common.ZoneInfoNotFoundError: 'No time zone found with key Asia/Bangkok'

How this fixes it

Add tzdata as a dependency on Windows.

Your checklist for this pull request

馃毃Please review the guidelines for contributing to this repository.

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

@sonarcloud
Copy link

sonarcloud bot commented Sep 24, 2023

Kudos, SonarCloud Quality Gate passed!聽 聽 Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

Copy link
Member

@wannaphong wannaphong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@wannaphong wannaphong added this to the 4.1 milestone Sep 24, 2023
@wannaphong wannaphong merged commit 28594c2 into PyThaiNLP:dev Sep 24, 2023
10 of 14 checks passed
@BLKSerene
Copy link
Contributor Author

@wannaphong Could you please publish a new (beta) release to fix dependency issues on CI?

@wannaphong
Copy link
Member

@wannaphong Could you please publish a new (beta) release to fix dependency issues on CI?

Done https://pypi.org/project/pythainlp/4.1.0b5/

@bact
Copy link
Member

bact commented Sep 25, 2023

Fantastic. Much appreciated for cross-platform runability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants