Skip to content

Commit bd8e1d3

Browse files
committed
ci: enhance CI workflow to support pysqlite3 installation across multiple OS
* Added steps to install pysqlite3-binary for Linux, macOS, and Windows * Created sitecustomize.py overrides to enable SQLite extensions in Python for each OS * Updated PYTHONPATH environment variable accordingly
1 parent 7f1c0e5 commit bd8e1d3

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

.github/workflows/test.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,55 @@ jobs:
8585
pip install -e .
8686
pip install -r requirements-dev.txt
8787
88+
- name: Use pysqlite3 on Linux (enable SQLite extensions in Python)
89+
if: runner.os == 'Linux'
90+
run: |
91+
pip install pysqlite3-binary
92+
python - <<'PY'
93+
import textwrap, pathlib
94+
pathlib.Path('sitecustomize.py').write_text(textwrap.dedent('''
95+
import pysqlite3 as sqlite3
96+
import sys
97+
sys.modules['sqlite3'] = sqlite3
98+
sys.modules['sqlite3.dbapi2'] = sqlite3
99+
''').lstrip())
100+
print('Wrote sitecustomize.py override for Linux')
101+
PY
102+
echo "PYTHONPATH=$PWD:$PYTHONPATH" >> $GITHUB_ENV
103+
104+
- name: Use pysqlite3 on macOS (enable SQLite extensions in Python)
105+
if: runner.os == 'macOS'
106+
run: |
107+
pip install pysqlite3-binary
108+
python - <<'PY'
109+
import textwrap, pathlib
110+
pathlib.Path('sitecustomize.py').write_text(textwrap.dedent('''
111+
import pysqlite3 as sqlite3
112+
import sys
113+
sys.modules['sqlite3'] = sqlite3
114+
sys.modules['sqlite3.dbapi2'] = sqlite3
115+
''').lstrip())
116+
print('Wrote sitecustomize.py override for macOS')
117+
PY
118+
echo "PYTHONPATH=$PWD:$PYTHONPATH" >> $GITHUB_ENV
119+
120+
- name: Use pysqlite3 on Windows (enable SQLite extensions in Python)
121+
if: runner.os == 'Windows'
122+
shell: powershell
123+
run: |
124+
pip install pysqlite3-binary
125+
python - <<'PY'
126+
import textwrap, pathlib
127+
pathlib.Path('sitecustomize.py').write_text(textwrap.dedent('''
128+
import pysqlite3 as sqlite3
129+
import sys
130+
sys.modules['sqlite3'] = sqlite3
131+
sys.modules['sqlite3.dbapi2'] = sqlite3
132+
''').lstrip())
133+
print('Wrote sitecustomize.py override for Windows')
134+
PY
135+
"$env:PYTHONPATH=$pwd;${env:PYTHONPATH}" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
136+
88137
- name: Lint with ruff
89138
run: ruff check .
90139

0 commit comments

Comments
 (0)