Skip to content

Commit c2526e3

Browse files
Copilotbact
andcommitted
Use string-based import to avoid broad import
Replace `import pythainlp; files(pythainlp)` with `files("pythainlp")` in get_pythainlp_path() to avoid importing the entire package unnecessarily. This is consistent with the pattern used elsewhere in the codebase and avoids potential circular import issues. Co-authored-by: bact <128572+bact@users.noreply.github.com>
1 parent a9750f1 commit c2526e3

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

pythainlp/tools/path.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ def get_pythainlp_path() -> str:
7777
get_pythainlp_path()
7878
# output: '/usr/local/lib/python3.6/dist-packages/pythainlp'
7979
"""
80-
import pythainlp
81-
package_path = files(pythainlp)
80+
package_path = files("pythainlp")
8281
# For compatibility, convert to string path if possible
8382
# This works for both regular installations and zip files
8483
if hasattr(package_path, '__fspath__'):

0 commit comments

Comments
 (0)