Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
40 changes: 38 additions & 2 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version:
["3.9", "3.10", "3.11", "3.12", "3.13", "pypy3.10"]
["3.10", "3.11", "3.12", "3.13", "pypy3.11"]
experimental: [false]
include:
- python-version: "3.13"
Expand All @@ -25,6 +25,36 @@ jobs:
- python-version: "3.13"
os: windows-11-arm
experimental: false
- python-version: "3.14"
os: ubuntu-latest
experimental: true
- python-version: "3.14"
os: ubuntu-24.04-arm
experimental: true
- python-version: "3.14"
os: windows-latest
experimental: true
- python-version: "3.14"
os: windows-11-arm
experimental: true
- python-version: "3.14"
os: macos-latest
experimental: true
- python-version: "3.14t"
os: ubuntu-latest
experimental: true
- python-version: "3.14t"
os: ubuntu-24.04-arm
experimental: true
- python-version: "3.14t"
os: windows-latest
experimental: true
- python-version: "3.14t"
os: windows-11-arm
experimental: true
- python-version: "3.14t"
os: macos-latest
experimental: true
steps:
- uses: actions/checkout@v5
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -33,9 +63,15 @@ jobs:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
cache: pip
- name: tox-gh workaround for freethreaded(!windows)
if: ${{ runner.os != 'Windows' && matrix.python-version == '3.14t' }}
run: echo "TOX_GH_MAJOR_MINOR=3.14t" >> $GITHUB_ENV
- name: tox-gh workaround for freethreaded(windows)
if: ${{ runner.os == 'Windows' && matrix.python-version == '3.14t' }}
run: echo "TOX_GH_MAJOR_MINOR=3.14t" >> $env:GITHUB_ENV
- name: Install dependencies
run: |
python3 -m pip install 'tox>=4' 'tox-gh-actions>=3'
python3 -m pip install 'tox' 'tox-gh'
tox --version
- name: Install native deps (Linux)
if: runner.os == 'Linux'
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
[project]
name = "sqlitefts"
version = "1.0.0"
version = "1.0.1"
description = "A Python binding for tokenizers of SQLite Full Text Search"
authors = [{ name = "Hideaki Takahashi", email = "mymelo@gmail.com" }]
dependencies = [
"cffi>=2.0.0; python_version >= '3.14'",
"cffi>=1.17.0; python_version >= '3.9'",
"cffi>=1.15.1 ; platform_python_implementation != 'PyPy'",
]
readme = "README.rst"
requires-python = ">=2.7,!=3.0,!=3.1,!=3.2,!=3.3,!=3.4,!=3.5,!=3.6"
requires-python = ">=2.7,!=3.0,!=3.1,!=3.2,!=3.3,!=3.4,!=3.5,!=3.6,!=3.7,!=3.8"
license = { text = "MIT" }
keywords = [
"SQLite",
Expand All @@ -26,7 +27,6 @@ classifiers = [
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
Expand Down
27 changes: 23 additions & 4 deletions sqlitefts/tokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
"""
a proof of concept implementation of SQLite FTS tokenizers in Python
"""

import sys
import sysconfig

from cffi import FFI # type: ignore

Expand All @@ -26,15 +28,32 @@
except:
dll = ffi.dlopen(find_library("sqlite3"))

if hasattr(sys, "getobjects"):
if sysconfig.get_config_var("Py_GIL_DISABLED") == 1:
ffi.cdef(
"""
typedef struct sqlite3 sqlite3;
typedef struct {
uintptr_t ob_tid;
uint16_t _padding;
uint8_t ob_mutex;
uint8_t ob_gc_bits;
uint32_t ob_ref_local;
ssize_t ob_ref_shared;
void *ob_type;
sqlite3 *db;
} PyObject;
"""
)
elif hasattr(sys, "getobjects"):
# for a python built with Py_TRACE_REFS
ffi.cdef(
"""
typedef struct sqlite3 sqlite3;
typedef struct {
void *_ob_next;
void *_ob_prev;
size_t ob_refcnt;
union {
ssize_t ob_refcnt;
uint32_t ob_refcnt_split[2];
};
void *ob_type;
sqlite3 *db;
} PyObject;
Expand Down
28 changes: 11 additions & 17 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
[tox]
envlist = {py39,py310,py311,py312,py313,pypy3}-{macos,win,linux},py313-apsw-linux
envlist = {py310,py311,py312,py313,py314,py314t,pypy3}-{macos,win,linux},py313-apsw-linux
skip_missing_interpreters = true
requires =
tox>=4

[gh-actions]
[gh]
python =
3.9: py39
3.10: py310
3.11: py311
3.12: py312
3.13: py313
pypy-3: pypy3

[gh-actions:env]
PLATFORM =
ubuntu-latest: linux
macos-latest: macos
windows-latest: windows
3.14t = py314t
3.14 = py314
3.13 = py313
3.12 = py312
3.11 = py311
3.10 = py310

[testenv]
changedir = tests
Expand All @@ -29,11 +23,11 @@ platform =
deps =
pytest
igo-python
py{39,310,311,312,313},pypy3: janome
py{310,311,312,313},pypy3: janome
tinysegmenter
faker
py{39,310,311,312,313}-linux,pypy3-linux: mecab
py{39,310,311,312,313}-linux,pypy3-linux: natto-py
py{310,311,312,313,314,314t}-linux,pypy3-linux: mecab
py{310,311,312,313,314,314t}-linux,pypy3-linux: natto-py
commands=
py.test -svrx

Expand Down
Loading
Loading