sqlite-lines
sqlite-lines copied to clipboard
Bundle this as a Python package?
I love this project so much.
Since you're already being quite ambitious with how you handle deployment, here's an idea I've been bouncing around for a while but haven't committed to trying yet: how about building this as a Python wheel and distributing it via PyPI?
I'd love to be able to run pip install sqlite-lines-extension
and then do the following:
import sqlite3
import sqlite_lines_extention
con = sqlite3.connect(":memory:")
con.enable_load_extension(True)
con.load_extension(sqlite_lines_extention.path())
Ideally the wheel would have builds for various different architectures all magically bundled together. I've not done this myself but I believe part of the solution is https://github.com/pypa/manylinux
Having an example repo that can build this kind of thing using GitHub Actions would be really cool. I'd love to be able to pip install spatialite-extention
and suchlike too.
Hey, thanks for the issue!
I agree, a Python package would be great! (NPM would be slick too)
Tho my experience dealing with Python packages have been nightmarish, especially when C dependencies are involved. But it we can make it work, then hell ya
I love the proposed package name and API. I guess .path()
would be the only useful API, maybe with a disable_read=True
option?
Does anyone know if Python wheels have to be pre-built, or if they can be built when someone pip install
s? It's only a single C file with one SQLite dependency, so hopefully it's not too complex...
Some other cool package managers to include:
- [ ] Python / PyPi
- [ ] NPM
- [ ] Deno
- [ ] brew
- [ ] debian?
My understanding is that you can distribute a sdist
package with the C code in and that will get compiled when someone runs pip install sqlite-lines-extension
- but only if they have a fully working and configured C compiler. And possibly the SQLite header files available as well? I'm not sure about that.
If a .whl
is also available and is compatible with their system then that pre-compiled binary will be installed instead, and they won't need the C compiler.
To be completely honest: I've had "figure out how to bundle compiled C modules in a Python wheel" on my TODO list for a few years now. My C ecosystem knowledge is pretty weak though, so I'm expecting this to be quite a tough learning curve for me - which is why I haven't yet taken it on.
So this issue here is my cheeky way of trying to get you to figure it out instead, since you're clearly more comfortable with C tools than I am!
Another for your list of package managers: Homebrew. Though to my surprise it doesn't look like anyone else has packaged a standalone SQLite module for it before, at least based on searching for sqlite
on https://github.com/Homebrew/homebrew-core/find/master