Skip to content

Upgrade Python in CI to 3.10 #947

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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 38 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
e3f38e6
Python 3.9
bact Oct 30, 2024
31ee9b2
Remove backports.zoneinfo
bact Oct 30, 2024
ccc4bd6
Remove duplicated pip
bact Oct 30, 2024
b355bb6
Remove PyTorch (already in requirements.txt)
bact Oct 30, 2024
67dba67
Update docker_requirements.txt
bact Oct 30, 2024
4269923
Make consistent yaml across OSes
bact Oct 30, 2024
7f88dc3
Don't use docker_requirements.txt
bact Oct 30, 2024
3b90599
Install ICU
bact Oct 30, 2024
e88fdb6
Use torch>=2
bact Oct 30, 2024
b3cf9f1
Use "pip<24.1"
bact Oct 30, 2024
dbf2082
Use light-the-torch for torch installation
bact Oct 30, 2024
f9bcd0b
torch --cpuonly
bact Oct 30, 2024
abbca93
--cpuonly
bact Oct 30, 2024
e45dc38
Use wheels from http://download.pytorch.org/whl/torch/
bact Oct 30, 2024
aa5ec74
Use macos-11
bact Oct 30, 2024
87b05f7
try macos-latest
bact Oct 30, 2024
7cdb3ab
Update unittest-macos.yml
bact Oct 30, 2024
cfd1f60
Update unittest-macos.yml
bact Oct 30, 2024
3be97c1
Try torch 2.2.2 on macOS
bact Oct 30, 2024
cf10101
Try macOS 12
bact Oct 30, 2024
c2f1dc3
Update unittest-macos.yml
bact Oct 30, 2024
0542c87
try macos-15
bact Oct 30, 2024
bcf905a
Update unittest-macos.yml
bact Oct 30, 2024
4308037
Update unittest-macos.yml
bact Oct 30, 2024
6bd0c54
Update unittest-macos.yml
bact Oct 30, 2024
85c5fde
pip install .[icu,isa,thai2fit,translate,textaugment,wordnet,generate…
bact Oct 30, 2024
7123515
Try install just default features
bact Oct 31, 2024
92e67b7
sort module
bact Oct 31, 2024
97aed61
Tidy up
bact Oct 31, 2024
1951548
Put names to jobs
bact Oct 31, 2024
481223b
try Pyton 3.10
bact Oct 31, 2024
781e345
Update PyICU win to 3.10
bact Oct 31, 2024
c95301c
Add wheel notes
bact Oct 31, 2024
27a48d3
try macos-latest without bash -l
bact Oct 31, 2024
8af1f2d
Revert docker_requriements.txt
bact Oct 31, 2024
308e7d0
Revert versions in setup.py
bact Oct 31, 2024
2864da3
add back backports.zoneinfo
bact Oct 31, 2024
c4bb673
Try minimum
bact Oct 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,31 @@ on:
- '**.yml'

jobs:
release:
name: Build
runs-on: ubuntu-20.04
deploy-docs:
name: Build and deploy documentation
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.8
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.8'
python-version: "3.10"
- name: Install dependencies
env:
SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL: True
run: |
python -m pip install --upgrade pip
pip install pytest coverage coveralls
python -m pip install coverage coveralls pytest
if [ -f docker_requirements.txt ]; then pip install -r docker_requirements.txt; fi
pip install deepcut
pip install .[full]
pip install boto smart_open sphinx sphinx-rtd-theme
python -m pip install .[full]
python -m pip install boto smart_open sphinx sphinx-rtd-theme
python -m nltk.downloader omw-1.4
- name: Build sphinx documentation
run: |
cd docs && make html
cd ..
- name: Deploy
- name: Deploy documentation
uses: peaceiris/actions-gh-pages@v4
with:
personal_token: ${{ secrets.PERSONAL_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ on:

jobs:
ruff:
runs-on: ubuntu-24.04
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ on:
types: [created]

jobs:
deploy:
pypi-publish:

runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
strategy:
matrix:
python-version: [3.8]
python-version: ["3.10"]

steps:
- name: Checkout
Expand All @@ -21,9 +21,9 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install setuptools twine wheel
python -m pip install --upgrade "pip<24.1" setuptools twine wheel
python setup.py sdist bdist_wheel
# "python setup.py" is no longer recommended.
- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/pypi-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ on:
- cron: '0 0 * * *' # Once per day

jobs:
build:
pypi-test:

runs-on: ubuntu-20.04
strategy:
matrix:
python-version: [3.8]
python-version: ["3.10"]

steps:
- uses: actions/checkout@v4
Expand All @@ -22,9 +22,8 @@ jobs:
env:
SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL: True
run: |
python -m pip install --upgrade pip
python -m pip install deepcut tltk
SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL=True python -m pip install -r https://raw.githubusercontent.com/PyThaiNLP/pythainlp/dev/docker_requirements.txt
python -m pip install --upgrade "pip<24.1" setuptools
python -m pip install -r https://raw.githubusercontent.com/PyThaiNLP/pythainlp/dev/docker_requirements.txt
python -m pip install pythainlp[full]
python -m nltk.downloader omw-1.4
- name: Test
Expand Down
97 changes: 31 additions & 66 deletions .github/workflows/unittest-macos.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: Unit test and code coverage (MacOS)
name: Unit test and code coverage (macOS)

on:
push:
paths-ignore:
- '**.md'
- '**.yml'
- 'docs/**'
# - '**.yml'
pull_request:
branches:
- dev
Expand All @@ -15,87 +15,52 @@ on:
- 'docs/**'

jobs:
build:

runs-on: ${{ matrix.os }}
unittest:
strategy:
fail-fast: false
matrix:
os: [macos-latest, self-hosted]
python-version: [3.8]
os: ["macos-latest"]
python-version: ["3.10"]

runs-on: ${{ matrix.os }}

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v3
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
auto-activate-base: false
auto-update-conda: true
if: matrix.os == 'macos-latest'
# - name: Install mac m1
# run: |
# mkdir -p ~/miniconda3
# wget https://repo.anaconda.com/miniconda/Miniconda3-py38_4.12.0-MacOSX-arm64.sh
# chmod +x Miniconda3-py38_4.12.0-MacOSX-arm64.sh
# bash Miniconda3-py38_4.12.0-MacOSX-arm64.sh -b -u -p ~/miniconda3
# ~/miniconda3/bin/conda init bash
# ~/miniconda3/bin/conda init zsh
# if: matrix.os == 'self-hosted'
- name: Test PyThaiNLP - M1
shell: bash -l {0}
- name: Print system info
run: sw_vers; python --version; arch
- name: Install build tools
run: |
source ~/miniconda3/etc/profile.d/conda.sh
conda create -y -n pythainlpwork38 python=3.8
conda activate pythainlpwork38
conda info
conda list
python -m pip install --upgrade pip
SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL=True pip install -r docker_requirements.txt
conda install -y -c conda-forge protobuf
pip install pytest coverage coveralls typing_extensions==4.5.0
pip install ssg epitran
pip install fastai==1.0.61
pip install fairseq==0.10.2
conda install -y -c conda-forge icu
conda install -y -c conda-forge pyicu
pip install deepcut tltk
pip install .[full]
python -m nltk.downloader omw-1.4
python -m pip cache purge
python -m unittest discover
if: matrix.os == 'self-hosted'
- name: Show environment
shell: bash -l {0}
python -m pip install --upgrade "pip<24.1" "setuptools==73.0.1"
python -m pip install coverage coveralls pytest
- name: Install ICU
run: |
conda info
conda list
if: matrix.os == 'self-hosted'
brew install icu4c
PKG_CONFIG_PATH=$(brew --prefix)/opt/icu4c/lib/pkgconfig
echo "PKG_CONFIG_PATH=${PKG_CONFIG_PATH}" >> "${GITHUB_ENV}"
ICU_VER=$(pkg-config --modversion icu-i18n)
echo "ICU_VER=${ICU_VER}"
echo "ICU_VER=${ICU_VER}" >> "${GITHUB_ENV}"
- name: Install PyTorch
shell: bash -l {0}
run: |
pip install torch==1.10.0
if: matrix.os != 'self-hosted'
- name: Install dependencies
shell: bash -l {0}
run: pip install torch
# if needed, get pip wheel link from http://download.pytorch.org/whl/torch/
# - name: Install dependencies
# env:
# SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL: True
# run: |
# python -m pip install -r docker_requirements.txt
- name: Install PyThaiNLP
run: |
python -m pip install --upgrade pip
pip install pytest coverage coveralls
conda install -c conda-forge icu
conda install -c conda-forge pyicu
SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL=True pip install -r docker_requirements.txt
pip install deepcut tltk
pip install .[full]
python -m nltk.downloader omw-1.4
python -m pip cache purge
if: matrix.os != 'self-hosted'
python -m pip install .
- name: Test
shell: bash -l {0}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_SERVICE_NAME: github
run: |
coverage run -m unittest discover
python -m nltk.downloader omw-1.4
coveralls
if: matrix.os != 'self-hosted'
# coverage run -m unittest discover
48 changes: 27 additions & 21 deletions .github/workflows/unittest-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ on:
- 'docs/**'

jobs:
build:

runs-on: ${{ matrix.os }}
unittest:
strategy:
fail-fast: false
matrix:
os: [windows-latest]
python-version: [3.8]
os: ["windows-latest"]
python-version: ["3.10"]

runs-on: ${{ matrix.os }}

steps:
- name: Checkout
Expand All @@ -38,30 +38,36 @@ jobs:
run: |
conda info
conda list
- name: Install PyTorch
- name: Install build tools
shell: powershell
run: |
pip install torch==1.8.1
- name: Install dependencies
python -m pip install --upgrade "pip<24.1" "setuptools==73.0.1"
python -m pip install coverage coveralls pytest
- name: Install ICU
shell: powershell
env:
SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL: True
run: |
python -m pip install --disable-pip-version-check --user --upgrade pip setuptools
python -m pip install backports.zoneinfo[tzdata]
python -m pip --version
python -m pip install pytest coverage coveralls
conda install -y -c conda-forge fairseq
python -m pip install https://www.dropbox.com/s/o6p2sj5z50iim1e/PyICU-2.3.1-cp38-cp38-win_amd64.whl?dl=1
python -m pip install -r docker_requirements.txt
python -m pip install .[full]
python -m nltk.downloader omw-1.4
python -m pip install spacy deepcut tltk
python -m pip install "https://github.com/cgohlke/pyicu-build/releases/download/v2.14/PyICU-2.14-cp310-cp310-win_amd64.whl"
# if needed, get pip wheel link from https://github.com/cgohlke/pyicu-build/releases
- name: Install PyTorch
shell: powershell
run: python -m pip install torch
# if needed, get pip wheel link from http://download.pytorch.org/whl/torch/
# - name: Install dependencies
# shell: powershell
# env:
# SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL: True
# run: |
# python -m pip install -r docker_requirements.txt
- name: Install PyThaiNLP
shell: powershell
run: |
python -m pip install .
- name: Test
shell: powershell
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_SERVICE_NAME: github
run: |
coverage run -m unittest discover
python -m nltk.downloader omw-1.4
coveralls
# coverage run -m unittest discover
39 changes: 24 additions & 15 deletions .github/workflows/unitttest-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,22 @@ on:
- '**.yml'
- 'docs/**'
pull_request:
branches:
- dev
paths-ignore:
- '**.md'
- '**.yml'
- 'docs/**'

jobs:
build:

runs-on: ubuntu-22.04
unittest:
strategy:
fail-fast: false
matrix:
python-version: [3.9]
os: ["ubuntu-24.04"]
python-version: ["3.10"]

runs-on: ${{ matrix.os }}

steps:
- name: Checkout
Expand All @@ -27,21 +31,26 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
- name: Install build tools
run: |
python -m pip install --upgrade pip
python -m pip install backports.zoneinfo[tzdata]
pip install pytest coverage coveralls
SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL=True pip install -r docker_requirements.txt
pip install deepcut tltk
pip install .[full]
python -m nltk.downloader omw-1.4
python -m pip install spacy deepcut tltk
python -m pip cache purge
python -m pip install --upgrade "pip<24.1" "setuptools==73.0.1"
python -m pip install coverage coveralls pytest
- name: Install PyTorch
run: python -m pip install torch
# if needed, get pip wheel link from http://download.pytorch.org/whl/torch/
# - name: Install dependencies
# env:
# SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL: True
# run: |
# python -m pip install -r docker_requirements.txt
- name: Install PyThaiNLP
run: |
python -m pip install .
- name: Test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_SERVICE_NAME: github
run: |
coverage run -m unittest discover
python -m nltk.downloader omw-1.4
coveralls
# coverage run -m unittest discover
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.10
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[tool.ruff]
line-length = 79
indent-width = 4
target-version = "py38"
target-version = "py310"

[tool.ruff.format]
quote-style = "double"
Expand Down
2 changes: 1 addition & 1 deletion pythainlp/util/date.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def thai_strptime(
# 9,
# 0,
# 1,
# tzinfo=backports.zoneinfo.ZoneInfo(key='Asia/Bangkok')
# tzinfo=zoneinfo.ZoneInfo(key='Asia/Bangkok')
# )
"""
d = ""
Expand Down
Loading
Loading