From af4e35fbc532ab9adbd80a4455af190dd3f5fe40 Mon Sep 17 00:00:00 2001 From: vince62s Date: Fri, 9 Jan 2026 22:57:08 +0100 Subject: [PATCH 01/10] fix linux image and cibuildwheel version --- .github/workflows/ci.yml | 6 +++--- bindings/python/pyonmttok/version.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b4449461..67ad988f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -115,7 +115,7 @@ jobs: uses: docker/setup-qemu-action@v3 - name: Build wheels - uses: pypa/cibuildwheel@v2.11.2 + uses: pypa/cibuildwheel@v2.16.0 with: package-dir: bindings/python output-dir: wheelhouse @@ -135,8 +135,8 @@ jobs: CIBW_ENVIRONMENT_LINUX: | TOKENIZER_ROOT=/project/build/install ICU_ROOT=/project/icu - CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 - CIBW_MANYLINUX_AARCH64_IMAGE: manylinux2014 + CIBW_MANYLINUX_X86_64_IMAGE: quay.io/pypa/manylinux2014_x86_64:2024-01-10 + CIBW_MANYLINUX_AARCH64_IMAGE: quay.io/pypa/manylinux2014_aarch64:2024-01-10 # ---- macOS ---- CIBW_BEFORE_ALL_MACOS: bindings/python/tools/prepare_build_environment_macos.sh diff --git a/bindings/python/pyonmttok/version.py b/bindings/python/pyonmttok/version.py index 46362d72..7b416e3a 100644 --- a/bindings/python/pyonmttok/version.py +++ b/bindings/python/pyonmttok/version.py @@ -1,3 +1,3 @@ """Version information.""" -__version__ = "1.38.0" +__version__ = "1.38.1" From a42a8b5fad1b0e9404d60cdc00af5708eacc4035 Mon Sep 17 00:00:00 2001 From: vince62s Date: Sat, 10 Jan 2026 08:27:26 +0100 Subject: [PATCH 02/10] new error --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 67ad988f..0f57b1a5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -119,6 +119,7 @@ jobs: with: package-dir: bindings/python output-dir: wheelhouse + only: cp3* env: # ---- Build selection ---- # Linux/Windows: Python 3.10, 3.11, 3.12 @@ -135,8 +136,6 @@ jobs: CIBW_ENVIRONMENT_LINUX: | TOKENIZER_ROOT=/project/build/install ICU_ROOT=/project/icu - CIBW_MANYLINUX_X86_64_IMAGE: quay.io/pypa/manylinux2014_x86_64:2024-01-10 - CIBW_MANYLINUX_AARCH64_IMAGE: quay.io/pypa/manylinux2014_aarch64:2024-01-10 # ---- macOS ---- CIBW_BEFORE_ALL_MACOS: bindings/python/tools/prepare_build_environment_macos.sh From a20a8ea90bafd19b27b166be6531d638843c6ad4 Mon Sep 17 00:00:00 2001 From: vince62s Date: Sat, 10 Jan 2026 08:31:42 +0100 Subject: [PATCH 03/10] . --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0f57b1a5..99003552 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -119,7 +119,7 @@ jobs: with: package-dir: bindings/python output-dir: wheelhouse - only: cp3* + only: "*" env: # ---- Build selection ---- # Linux/Windows: Python 3.10, 3.11, 3.12 From ba12b8af6c1f8b187cca81784349b62f5d1337d3 Mon Sep 17 00:00:00 2001 From: vince62s Date: Sat, 10 Jan 2026 08:33:17 +0100 Subject: [PATCH 04/10] . --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 99003552..f6c93a82 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -119,7 +119,7 @@ jobs: with: package-dir: bindings/python output-dir: wheelhouse - only: "*" + only: "cp3*-manylinux* cp3*-win* cp3*-macosx*" env: # ---- Build selection ---- # Linux/Windows: Python 3.10, 3.11, 3.12 From 7a748c524ed7d3274077405fdc00dd8b40f1b757 Mon Sep 17 00:00:00 2001 From: vince62s Date: Sat, 10 Jan 2026 08:38:47 +0100 Subject: [PATCH 05/10] newer ciwheelbuild version --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f6c93a82..9e759e65 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -115,11 +115,11 @@ jobs: uses: docker/setup-qemu-action@v3 - name: Build wheels - uses: pypa/cibuildwheel@v2.16.0 + uses: pypa/cibuildwheel@v2.23.3 with: package-dir: bindings/python output-dir: wheelhouse - only: "cp3*-manylinux* cp3*-win* cp3*-macosx*" + env: # ---- Build selection ---- # Linux/Windows: Python 3.10, 3.11, 3.12 From b3de266dddae8bcc3638f8dd34b934c3d3746134 Mon Sep 17 00:00:00 2001 From: vince62s Date: Sat, 10 Jan 2026 09:03:08 +0100 Subject: [PATCH 06/10] remove package resource --- bindings/python/pyonmttok/__init__.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/bindings/python/pyonmttok/__init__.py b/bindings/python/pyonmttok/__init__.py index 70157fef..84a2f3f0 100644 --- a/bindings/python/pyonmttok/__init__.py +++ b/bindings/python/pyonmttok/__init__.py @@ -4,11 +4,10 @@ import ctypes import glob import os + from importlib import resources - import pkg_resources - - module_name = sys.modules[__name__].__name__ - package_dir = pkg_resources.resource_filename(module_name, "") + # Get the package directory safely (no setuptools) + package_dir = str(resources.files(__package__)) add_dll_directory = getattr(os, "add_dll_directory", None) if add_dll_directory is not None: From 6a00f1fb0ac309a38ddabb4238db19b730514373 Mon Sep 17 00:00:00 2001 From: vince62s Date: Sat, 10 Jan 2026 09:08:44 +0100 Subject: [PATCH 07/10] isort --- bindings/python/pyonmttok/__init__.py | 18 ++++-------------- bindings/python/setup.py | 1 - bindings/python/test/test.py | 3 +-- 3 files changed, 5 insertions(+), 17 deletions(-) diff --git a/bindings/python/pyonmttok/__init__.py b/bindings/python/pyonmttok/__init__.py index 84a2f3f0..74e8d4eb 100644 --- a/bindings/python/pyonmttok/__init__.py +++ b/bindings/python/pyonmttok/__init__.py @@ -16,20 +16,10 @@ for library in glob.glob(os.path.join(package_dir, "*.dll")): ctypes.CDLL(library) -from pyonmttok._ext import ( - BPELearner, - Casing, - SentencePieceLearner, - SentencePieceTokenizer, - SubwordLearner, - Token, - Tokenizer, - TokenType, - Vocab, - is_placeholder, - is_valid_language, - set_random_seed, -) +from pyonmttok._ext import (BPELearner, Casing, SentencePieceLearner, + SentencePieceTokenizer, SubwordLearner, Token, + Tokenizer, TokenType, Vocab, is_placeholder, + is_valid_language, set_random_seed) from pyonmttok.version import __version__ diff --git a/bindings/python/setup.py b/bindings/python/setup.py index 1ac44c94..ef769db1 100644 --- a/bindings/python/setup.py +++ b/bindings/python/setup.py @@ -2,7 +2,6 @@ import sys import pybind11 - from setuptools import Extension, find_packages, setup include_dirs = [pybind11.get_include()] diff --git a/bindings/python/test/test.py b/bindings/python/test/test.py index 6485babf..a6d15226 100644 --- a/bindings/python/test/test.py +++ b/bindings/python/test/test.py @@ -3,9 +3,8 @@ import os import pickle -import pytest - import pyonmttok +import pytest _DATA_DIR = os.path.join( os.path.dirname(os.path.abspath(__file__)), "..", "..", "..", "test", "data" From 7ada4481fa07856fd8d94f5120b2c47a0e283277 Mon Sep 17 00:00:00 2001 From: vince62s Date: Sat, 10 Jan 2026 09:13:47 +0100 Subject: [PATCH 08/10] black --- bindings/python/pyonmttok/__init__.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/bindings/python/pyonmttok/__init__.py b/bindings/python/pyonmttok/__init__.py index 74e8d4eb..84a2f3f0 100644 --- a/bindings/python/pyonmttok/__init__.py +++ b/bindings/python/pyonmttok/__init__.py @@ -16,10 +16,20 @@ for library in glob.glob(os.path.join(package_dir, "*.dll")): ctypes.CDLL(library) -from pyonmttok._ext import (BPELearner, Casing, SentencePieceLearner, - SentencePieceTokenizer, SubwordLearner, Token, - Tokenizer, TokenType, Vocab, is_placeholder, - is_valid_language, set_random_seed) +from pyonmttok._ext import ( + BPELearner, + Casing, + SentencePieceLearner, + SentencePieceTokenizer, + SubwordLearner, + Token, + Tokenizer, + TokenType, + Vocab, + is_placeholder, + is_valid_language, + set_random_seed, +) from pyonmttok.version import __version__ From 864e6d58482c6bbb4b4f38381c063c08c34cfeae Mon Sep 17 00:00:00 2001 From: vince62s Date: Sat, 10 Jan 2026 09:29:42 +0100 Subject: [PATCH 09/10] isort --- bindings/python/pyonmttok/__init__.py | 4 +++- bindings/python/pyproject.toml | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/bindings/python/pyonmttok/__init__.py b/bindings/python/pyonmttok/__init__.py index 84a2f3f0..19c88c5c 100644 --- a/bindings/python/pyonmttok/__init__.py +++ b/bindings/python/pyonmttok/__init__.py @@ -15,7 +15,7 @@ for library in glob.glob(os.path.join(package_dir, "*.dll")): ctypes.CDLL(library) - +# isort: off from pyonmttok._ext import ( BPELearner, Casing, @@ -30,6 +30,8 @@ is_valid_language, set_random_seed, ) + +# isort: on from pyonmttok.version import __version__ diff --git a/bindings/python/pyproject.toml b/bindings/python/pyproject.toml index 7e40d19c..6e4c5f86 100644 --- a/bindings/python/pyproject.toml +++ b/bindings/python/pyproject.toml @@ -5,4 +5,5 @@ requires = [ "pybind11>=2.10.4" ] build-backend = "setuptools.build_meta" - +[tool.isort] +profile = "black" From d8a9909ae3516d3c008c5aaa6fd122fe4d1f2fe4 Mon Sep 17 00:00:00 2001 From: vince62s Date: Sat, 10 Jan 2026 09:37:43 +0100 Subject: [PATCH 10/10] isort sucks --- bindings/python/test/test.py | 1 + 1 file changed, 1 insertion(+) diff --git a/bindings/python/test/test.py b/bindings/python/test/test.py index a6d15226..66c1bbea 100644 --- a/bindings/python/test/test.py +++ b/bindings/python/test/test.py @@ -1,3 +1,4 @@ +# isort: off import copy import itertools import os