Skip to content

Commit 3a16407

Browse files
committed
add sqlite-utils plugin
1 parent 3e6a099 commit 3a16407

File tree

9 files changed

+250
-5
lines changed

9 files changed

+250
-5
lines changed

.github/workflows/release.yaml

+17-4
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ jobs:
3434
- uses: actions/setup-python@v3
3535
- run: pip install wheel
3636
- run: make python
37-
- run: make datasette
3837
- uses: actions/upload-artifact@v3
3938
with:
4039
name: sqlite-http-linux_x86-wheels
@@ -68,7 +67,6 @@ jobs:
6867
- uses: actions/setup-python@v3
6968
- run: pip install wheel
7069
- run: make python
71-
- run: make datasette
7270
- uses: actions/upload-artifact@v3
7371
with:
7472
name: sqlite-http-macos-wheels
@@ -134,11 +132,21 @@ jobs:
134132
- uses: actions/setup-python@v3
135133
- run: pip install wheel
136134
- run: make python
137-
- run: make datasette
138135
- uses: actions/upload-artifact@v3
139136
with:
140137
name: sqlite-http-windows-wheels
141138
path: dist/wheels/*.whl
139+
build-datasette-sqlite-utils:
140+
runs-on: ubuntu-20.04
141+
steps:
142+
- uses: actions/checkout@v3
143+
- uses: actions/setup-python@v3
144+
- run: pip install wheel build
145+
- run: make datasette sqlite-utils
146+
- uses: actions/upload-artifact@v3
147+
with:
148+
name: sqlite-http-datasette-sqlite-utils-wheels
149+
path: dist/wheels/*.whl
142150
upload-extensions:
143151
name: Upload release assets
144152
needs:
@@ -233,13 +241,14 @@ jobs:
233241
run: npm publish --access public
234242
env:
235243
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
236-
upload_pypi:
244+
upload-pypi:
237245
needs:
238246
[
239247
build-linux_x86-python,
240248
build-macos-python,
241249
build-macos-arm-python,
242250
build-windows-python,
251+
build-datasette-sqlite-utils,
243252
]
244253
runs-on: ubuntu-latest
245254
steps:
@@ -259,6 +268,10 @@ jobs:
259268
with:
260269
name: sqlite-http-macos-arm-wheels
261270
path: dist
271+
- uses: actions/download-artifact@v3
272+
with:
273+
name: sqlite-http-datasette-sqlite-utils-wheels
274+
path: dist
262275
- uses: pypa/gh-action-pypi-publish@release/v1
263276
with:
264277
password: ${{ secrets.PYPI_API_TOKEN }}

Makefile

+13-1
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,17 @@ datasette: $(TARGET_WHEELS) $(shell find python/datasette_sqlite_http -type f -n
8888
rm $(TARGET_WHEELS)/datasette* || true
8989
pip3 wheel python/datasette_sqlite_http/ --no-deps -w $(TARGET_WHEELS)
9090

91+
bindings/sqlite-utils/pyproject.toml: bindings/sqlite-utils/pyproject.toml.tmpl VERSION
92+
VERSION=$(VERSION) envsubst < $< > $@
93+
echo "✅ generated $@"
94+
95+
bindings/sqlite-utils/sqlite_utils_sqlite_http/version.py: bindings/sqlite-utils/sqlite_utils_sqlite_http/version.py.tmpl VERSION
96+
VERSION=$(VERSION) envsubst < $< > $@
97+
echo "✅ generated $@"
98+
99+
sqlite-utils: $(TARGET_WHEELS) bindings/sqlite-utils/pyproject.toml bindings/sqlite-utils/sqlite_utils_sqlite_http/version.py
100+
python3 -m build bindings/sqlite-utils -w -o $(TARGET_WHEELS)
101+
91102
npm: VERSION npm/platform-package.README.md.tmpl npm/platform-package.package.json.tmpl npm/sqlite-http/package.json.tmpl scripts/npm_generate_platform_packages.sh
92103
scripts/npm_generate_platform_packages.sh
93104

@@ -102,6 +113,7 @@ ruby: bindings/ruby/lib/version.rb
102113
version:
103114
make python
104115
make python-versions
116+
make bindings/sqlite-utils/pyproject.toml bindings/sqlite-utils/sqlite_utils_sqlite_http/version.py
105117
make npm
106118
make deno
107119
make ruby
@@ -148,6 +160,6 @@ publish-release:
148160
./scripts/publish_release.sh
149161

150162
.PHONY: all format clean publish-release \
151-
python python-versions datasette npm deno ruby version \
163+
python python-versions datasette sqlite-utils npm deno ruby version \
152164
test test-loadable test-watch httpbin \
153165
loadable

bindings/sqlite-utils/.gitignore

+160
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
share/python-wheels/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
MANIFEST
28+
29+
# PyInstaller
30+
# Usually these files are written by a python script from a template
31+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32+
*.manifest
33+
*.spec
34+
35+
# Installer logs
36+
pip-log.txt
37+
pip-delete-this-directory.txt
38+
39+
# Unit test / coverage reports
40+
htmlcov/
41+
.tox/
42+
.nox/
43+
.coverage
44+
.coverage.*
45+
.cache
46+
nosetests.xml
47+
coverage.xml
48+
*.cover
49+
*.py,cover
50+
.hypothesis/
51+
.pytest_cache/
52+
cover/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Django stuff:
59+
*.log
60+
local_settings.py
61+
db.sqlite3
62+
db.sqlite3-journal
63+
64+
# Flask stuff:
65+
instance/
66+
.webassets-cache
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
.pybuilder/
76+
target/
77+
78+
# Jupyter Notebook
79+
.ipynb_checkpoints
80+
81+
# IPython
82+
profile_default/
83+
ipython_config.py
84+
85+
# pyenv
86+
# For a library or package, you might want to ignore these files since the code is
87+
# intended to run in multiple environments; otherwise, check them in:
88+
# .python-version
89+
90+
# pipenv
91+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
93+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
94+
# install all needed dependencies.
95+
#Pipfile.lock
96+
97+
# poetry
98+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99+
# This is especially recommended for binary packages to ensure reproducibility, and is more
100+
# commonly ignored for libraries.
101+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102+
#poetry.lock
103+
104+
# pdm
105+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106+
#pdm.lock
107+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108+
# in version control.
109+
# https://pdm.fming.dev/#use-with-ide
110+
.pdm.toml
111+
112+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
113+
__pypackages__/
114+
115+
# Celery stuff
116+
celerybeat-schedule
117+
celerybeat.pid
118+
119+
# SageMath parsed files
120+
*.sage.py
121+
122+
# Environments
123+
.env
124+
.venv
125+
env/
126+
venv/
127+
ENV/
128+
env.bak/
129+
venv.bak/
130+
131+
# Spyder project settings
132+
.spyderproject
133+
.spyproject
134+
135+
# Rope project settings
136+
.ropeproject
137+
138+
# mkdocs documentation
139+
/site
140+
141+
# mypy
142+
.mypy_cache/
143+
.dmypy.json
144+
dmypy.json
145+
146+
# Pyre type checker
147+
.pyre/
148+
149+
# pytype static type analyzer
150+
.pytype/
151+
152+
# Cython debug symbols
153+
cython_debug/
154+
155+
# PyCharm
156+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
157+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
158+
# and can be added to the global gitignore or merged into this file. For a more nuclear
159+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
160+
#.idea/

bindings/sqlite-utils/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# `sqlite-utils-sqlite-http`
2+
3+
A `sqlite-utils` plugin that registers the `sqlite-http` extension.

bindings/sqlite-utils/pyproject.toml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[project]
2+
name = "sqlite-utils-sqlite-http"
3+
version = "0.1.0"
4+
description = "TODO"
5+
readme = "README.md"
6+
authors = [{name = "Alex Garcia"}]
7+
license = {text = "Apache-2.0"}
8+
classifiers = []
9+
10+
dependencies = [
11+
"sqlite-utils",
12+
"sqlite-http"
13+
]
14+
15+
[project.urls]
16+
Homepage = "https://github.com/asg017/sqlite-http"
17+
Changelog = "https://github.com/asg017/sqlite-http/releases"
18+
Issues = "https://github.com/asg017/sqlite-http/issues"
19+
20+
[project.entry-points.sqlite_utils]
21+
sqlite_http = "sqlite_utils_sqlite_http"
+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[project]
2+
name = "sqlite-utils-sqlite-http"
3+
version = "${VERSION}"
4+
description = "TODO"
5+
readme = "README.md"
6+
authors = [{name = "Alex Garcia"}]
7+
license = {text = "Apache-2.0"}
8+
classifiers = []
9+
10+
dependencies = [
11+
"sqlite-utils",
12+
"sqlite-http"
13+
]
14+
15+
[project.urls]
16+
Homepage = "https://github.com/asg017/sqlite-http"
17+
Changelog = "https://github.com/asg017/sqlite-http/releases"
18+
Issues = "https://github.com/asg017/sqlite-http/issues"
19+
20+
[project.entry-points.sqlite_utils]
21+
sqlite_http = "sqlite_utils_sqlite_http"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from sqlite_utils import hookimpl
2+
import sqlite_http
3+
4+
from sqlite_utils_sqlite_http.version import __version_info__, __version__
5+
6+
7+
@hookimpl
8+
def prepare_connection(conn):
9+
conn.enable_load_extension(True)
10+
sqlite_http.load(conn)
11+
conn.enable_load_extension(False)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
__version__ = "0.2.1"
2+
__version_info__ = tuple(__version__.split("."))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
__version__ = "${VERSION}"
2+
__version_info__ = tuple(__version__.split("."))

0 commit comments

Comments
 (0)