Skip to content

Commit 0874f2e

Browse files
authored
Merge pull request #947 from bact/update-ci
Upgrade Python in CI to 3.9
2 parents d403918 + c4bb673 commit 0874f2e

30 files changed

+183
-211
lines changed

.github/workflows/deploy-docs.yml

+11-11
Original file line numberDiff line numberDiff line change
@@ -8,31 +8,31 @@ on:
88
- '**.yml'
99

1010
jobs:
11-
release:
12-
name: Build
13-
runs-on: ubuntu-20.04
11+
deploy-docs:
12+
name: Build and deploy documentation
13+
runs-on: ubuntu-24.04
1414
steps:
15-
- uses: actions/checkout@v4
16-
- name: Set up Python 3.8
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
- name: Set up Python
1718
uses: actions/setup-python@v5
1819
with:
19-
python-version: '3.8'
20+
python-version: "3.10"
2021
- name: Install dependencies
2122
env:
2223
SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL: True
2324
run: |
2425
python -m pip install --upgrade pip
25-
pip install pytest coverage coveralls
26+
python -m pip install coverage coveralls pytest
2627
if [ -f docker_requirements.txt ]; then pip install -r docker_requirements.txt; fi
27-
pip install deepcut
28-
pip install .[full]
29-
pip install boto smart_open sphinx sphinx-rtd-theme
28+
python -m pip install .[full]
29+
python -m pip install boto smart_open sphinx sphinx-rtd-theme
3030
python -m nltk.downloader omw-1.4
3131
- name: Build sphinx documentation
3232
run: |
3333
cd docs && make html
3434
cd ..
35-
- name: Deploy
35+
- name: Deploy documentation
3636
uses: peaceiris/actions-gh-pages@v4
3737
with:
3838
personal_token: ${{ secrets.PERSONAL_TOKEN }}

.github/workflows/lint.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ on:
1818

1919
jobs:
2020
ruff:
21-
runs-on: ubuntu-24.04
21+
runs-on: ubuntu-latest
2222
steps:
2323
- name: Checkout
2424
uses: actions/checkout@v4

.github/workflows/pypi-publish.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ on:
55
types: [created]
66

77
jobs:
8-
deploy:
8+
pypi-publish:
99

10-
runs-on: ubuntu-20.04
10+
runs-on: ubuntu-24.04
1111
strategy:
1212
matrix:
13-
python-version: [3.8]
13+
python-version: ["3.10"]
1414

1515
steps:
1616
- name: Checkout
@@ -21,9 +21,9 @@ jobs:
2121
python-version: ${{ matrix.python-version }}
2222
- name: Install dependencies
2323
run: |
24-
python -m pip install --upgrade pip
25-
python -m pip install setuptools twine wheel
24+
python -m pip install --upgrade "pip<24.1" setuptools twine wheel
2625
python setup.py sdist bdist_wheel
26+
# "python setup.py" is no longer recommended.
2727
- name: Publish a Python distribution to PyPI
2828
uses: pypa/gh-action-pypi-publish@release/v1
2929
with:

.github/workflows/pypi-test.yml

+4-5
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ on:
55
- cron: '0 0 * * *' # Once per day
66

77
jobs:
8-
build:
8+
pypi-test:
99

1010
runs-on: ubuntu-20.04
1111
strategy:
1212
matrix:
13-
python-version: [3.8]
13+
python-version: ["3.10"]
1414

1515
steps:
1616
- uses: actions/checkout@v4
@@ -22,9 +22,8 @@ jobs:
2222
env:
2323
SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL: True
2424
run: |
25-
python -m pip install --upgrade pip
26-
python -m pip install deepcut tltk
27-
SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL=True python -m pip install -r https://raw.githubusercontent.com/PyThaiNLP/pythainlp/dev/docker_requirements.txt
25+
python -m pip install --upgrade "pip<24.1" setuptools
26+
python -m pip install -r https://raw.githubusercontent.com/PyThaiNLP/pythainlp/dev/docker_requirements.txt
2827
python -m pip install pythainlp[full]
2928
python -m nltk.downloader omw-1.4
3029
- name: Test

.github/workflows/unittest-macos.yml

+31-66
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
name: Unit test and code coverage (MacOS)
1+
name: Unit test and code coverage (macOS)
22

33
on:
44
push:
55
paths-ignore:
66
- '**.md'
7+
- '**.yml'
78
- 'docs/**'
8-
# - '**.yml'
99
pull_request:
1010
branches:
1111
- dev
@@ -15,87 +15,52 @@ on:
1515
- 'docs/**'
1616

1717
jobs:
18-
build:
19-
20-
runs-on: ${{ matrix.os }}
18+
unittest:
2119
strategy:
2220
fail-fast: false
2321
matrix:
24-
os: [macos-latest, self-hosted]
25-
python-version: [3.8]
22+
os: ["macos-latest"]
23+
python-version: ["3.10"]
24+
25+
runs-on: ${{ matrix.os }}
2626

2727
steps:
2828
- name: Checkout
2929
uses: actions/checkout@v4
3030
- name: Set up Python ${{ matrix.python-version }}
31-
uses: conda-incubator/setup-miniconda@v3
31+
uses: actions/setup-python@v5
3232
with:
3333
python-version: ${{ matrix.python-version }}
34-
auto-activate-base: false
35-
auto-update-conda: true
36-
if: matrix.os == 'macos-latest'
37-
# - name: Install mac m1
38-
# run: |
39-
# mkdir -p ~/miniconda3
40-
# wget https://repo.anaconda.com/miniconda/Miniconda3-py38_4.12.0-MacOSX-arm64.sh
41-
# chmod +x Miniconda3-py38_4.12.0-MacOSX-arm64.sh
42-
# bash Miniconda3-py38_4.12.0-MacOSX-arm64.sh -b -u -p ~/miniconda3
43-
# ~/miniconda3/bin/conda init bash
44-
# ~/miniconda3/bin/conda init zsh
45-
# if: matrix.os == 'self-hosted'
46-
- name: Test PyThaiNLP - M1
47-
shell: bash -l {0}
34+
- name: Print system info
35+
run: sw_vers; python --version; arch
36+
- name: Install build tools
4837
run: |
49-
source ~/miniconda3/etc/profile.d/conda.sh
50-
conda create -y -n pythainlpwork38 python=3.8
51-
conda activate pythainlpwork38
52-
conda info
53-
conda list
54-
python -m pip install --upgrade pip
55-
SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL=True pip install -r docker_requirements.txt
56-
conda install -y -c conda-forge protobuf
57-
pip install pytest coverage coveralls typing_extensions==4.5.0
58-
pip install ssg epitran
59-
pip install fastai==1.0.61
60-
pip install fairseq==0.10.2
61-
conda install -y -c conda-forge icu
62-
conda install -y -c conda-forge pyicu
63-
pip install deepcut tltk
64-
pip install .[full]
65-
python -m nltk.downloader omw-1.4
66-
python -m pip cache purge
67-
python -m unittest discover
68-
if: matrix.os == 'self-hosted'
69-
- name: Show environment
70-
shell: bash -l {0}
38+
python -m pip install --upgrade "pip<24.1" "setuptools==73.0.1"
39+
python -m pip install coverage coveralls pytest
40+
- name: Install ICU
7141
run: |
72-
conda info
73-
conda list
74-
if: matrix.os == 'self-hosted'
42+
brew install icu4c
43+
PKG_CONFIG_PATH=$(brew --prefix)/opt/icu4c/lib/pkgconfig
44+
echo "PKG_CONFIG_PATH=${PKG_CONFIG_PATH}" >> "${GITHUB_ENV}"
45+
ICU_VER=$(pkg-config --modversion icu-i18n)
46+
echo "ICU_VER=${ICU_VER}"
47+
echo "ICU_VER=${ICU_VER}" >> "${GITHUB_ENV}"
7548
- name: Install PyTorch
76-
shell: bash -l {0}
77-
run: |
78-
pip install torch==1.10.0
79-
if: matrix.os != 'self-hosted'
80-
- name: Install dependencies
81-
shell: bash -l {0}
49+
run: pip install torch
50+
# if needed, get pip wheel link from http://download.pytorch.org/whl/torch/
51+
# - name: Install dependencies
52+
# env:
53+
# SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL: True
54+
# run: |
55+
# python -m pip install -r docker_requirements.txt
56+
- name: Install PyThaiNLP
8257
run: |
83-
python -m pip install --upgrade pip
84-
pip install pytest coverage coveralls
85-
conda install -c conda-forge icu
86-
conda install -c conda-forge pyicu
87-
SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL=True pip install -r docker_requirements.txt
88-
pip install deepcut tltk
89-
pip install .[full]
90-
python -m nltk.downloader omw-1.4
91-
python -m pip cache purge
92-
if: matrix.os != 'self-hosted'
58+
python -m pip install .
9359
- name: Test
94-
shell: bash -l {0}
9560
env:
9661
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9762
COVERALLS_SERVICE_NAME: github
9863
run: |
99-
coverage run -m unittest discover
64+
python -m nltk.downloader omw-1.4
10065
coveralls
101-
if: matrix.os != 'self-hosted'
66+
# coverage run -m unittest discover

.github/workflows/unittest-windows.yml

+27-21
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ on:
1515
- 'docs/**'
1616

1717
jobs:
18-
build:
19-
20-
runs-on: ${{ matrix.os }}
18+
unittest:
2119
strategy:
2220
fail-fast: false
2321
matrix:
24-
os: [windows-latest]
25-
python-version: [3.8]
22+
os: ["windows-latest"]
23+
python-version: ["3.10"]
24+
25+
runs-on: ${{ matrix.os }}
2626

2727
steps:
2828
- name: Checkout
@@ -38,30 +38,36 @@ jobs:
3838
run: |
3939
conda info
4040
conda list
41-
- name: Install PyTorch
41+
- name: Install build tools
4242
shell: powershell
4343
run: |
44-
pip install torch==1.8.1
45-
- name: Install dependencies
44+
python -m pip install --upgrade "pip<24.1" "setuptools==73.0.1"
45+
python -m pip install coverage coveralls pytest
46+
- name: Install ICU
4647
shell: powershell
47-
env:
48-
SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL: True
4948
run: |
50-
python -m pip install --disable-pip-version-check --user --upgrade pip setuptools
51-
python -m pip install backports.zoneinfo[tzdata]
52-
python -m pip --version
53-
python -m pip install pytest coverage coveralls
54-
conda install -y -c conda-forge fairseq
55-
python -m pip install https://www.dropbox.com/s/o6p2sj5z50iim1e/PyICU-2.3.1-cp38-cp38-win_amd64.whl?dl=1
56-
python -m pip install -r docker_requirements.txt
57-
python -m pip install .[full]
58-
python -m nltk.downloader omw-1.4
59-
python -m pip install spacy deepcut tltk
49+
python -m pip install "https://github.com/cgohlke/pyicu-build/releases/download/v2.14/PyICU-2.14-cp310-cp310-win_amd64.whl"
50+
# if needed, get pip wheel link from https://github.com/cgohlke/pyicu-build/releases
51+
- name: Install PyTorch
52+
shell: powershell
53+
run: python -m pip install torch
54+
# if needed, get pip wheel link from http://download.pytorch.org/whl/torch/
55+
# - name: Install dependencies
56+
# shell: powershell
57+
# env:
58+
# SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL: True
59+
# run: |
60+
# python -m pip install -r docker_requirements.txt
61+
- name: Install PyThaiNLP
62+
shell: powershell
63+
run: |
64+
python -m pip install .
6065
- name: Test
6166
shell: powershell
6267
env:
6368
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6469
COVERALLS_SERVICE_NAME: github
6570
run: |
66-
coverage run -m unittest discover
71+
python -m nltk.downloader omw-1.4
6772
coveralls
73+
# coverage run -m unittest discover

.github/workflows/unitttest-ubuntu.yml

+24-15
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,22 @@ on:
77
- '**.yml'
88
- 'docs/**'
99
pull_request:
10+
branches:
11+
- dev
1012
paths-ignore:
1113
- '**.md'
1214
- '**.yml'
1315
- 'docs/**'
1416

1517
jobs:
16-
build:
17-
18-
runs-on: ubuntu-22.04
18+
unittest:
1919
strategy:
20+
fail-fast: false
2021
matrix:
21-
python-version: [3.9]
22+
os: ["ubuntu-24.04"]
23+
python-version: ["3.10"]
24+
25+
runs-on: ${{ matrix.os }}
2226

2327
steps:
2428
- name: Checkout
@@ -27,21 +31,26 @@ jobs:
2731
uses: actions/setup-python@v5
2832
with:
2933
python-version: ${{ matrix.python-version }}
30-
- name: Install dependencies
34+
- name: Install build tools
3135
run: |
32-
python -m pip install --upgrade pip
33-
python -m pip install backports.zoneinfo[tzdata]
34-
pip install pytest coverage coveralls
35-
SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL=True pip install -r docker_requirements.txt
36-
pip install deepcut tltk
37-
pip install .[full]
38-
python -m nltk.downloader omw-1.4
39-
python -m pip install spacy deepcut tltk
40-
python -m pip cache purge
36+
python -m pip install --upgrade "pip<24.1" "setuptools==73.0.1"
37+
python -m pip install coverage coveralls pytest
38+
- name: Install PyTorch
39+
run: python -m pip install torch
40+
# if needed, get pip wheel link from http://download.pytorch.org/whl/torch/
41+
# - name: Install dependencies
42+
# env:
43+
# SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL: True
44+
# run: |
45+
# python -m pip install -r docker_requirements.txt
46+
- name: Install PyThaiNLP
47+
run: |
48+
python -m pip install .
4149
- name: Test
4250
env:
4351
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4452
COVERALLS_SERVICE_NAME: github
4553
run: |
46-
coverage run -m unittest discover
54+
python -m nltk.downloader omw-1.4
4755
coveralls
56+
# coverage run -m unittest discover

.python-version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.10

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[tool.ruff]
55
line-length = 79
66
indent-width = 4
7-
target-version = "py38"
7+
target-version = "py310"
88

99
[tool.ruff.format]
1010
quote-style = "double"

pythainlp/util/date.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ def thai_strptime(
236236
# 9,
237237
# 0,
238238
# 1,
239-
# tzinfo=backports.zoneinfo.ZoneInfo(key='Asia/Bangkok')
239+
# tzinfo=zoneinfo.ZoneInfo(key='Asia/Bangkok')
240240
# )
241241
"""
242242
d = ""

0 commit comments

Comments
 (0)