Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set --enable-loadable-sqlite-extensions in configure? #488

Closed
wsxiaoys opened this issue Dec 3, 2017 · 10 comments · Fixed by #1246
Closed

set --enable-loadable-sqlite-extensions in configure? #488

wsxiaoys opened this issue Dec 3, 2017 · 10 comments · Fixed by #1246

Comments

@wsxiaoys
Copy link

wsxiaoys commented Dec 3, 2017

It'll be nice if heroku could enable sqlite extension by default

@edmorley
Copy link
Member

edmorley commented Dec 3, 2017

Hi! To pre-empt what I imagine will be Kenneth's question... what's the use case for using sqlite extensions (or sqlite at all) on Heroku dynos? (Since the filesystem is ephemeral)

@wsxiaoys
Copy link
Author

wsxiaoys commented Dec 3, 2017

Sqlite:
We have a few readonly sqlite database stored in S3, they'll be fetched to dyno to be served as API.

Sqlite-extension:
Many mathematical functions, e.g log, expt are not available in sqlite, we'd like to load extension-functions.c

@kennethreitz
Copy link
Contributor

sqlite is very useful to have, as it’s a very fast database that can be used despite our ephemeral filesystem — it just can’t be used persistiently.

In addition to that, some tools/libraries, e.g. iPython, import sqlite, expecting it to be available as part of the stdlib, and will not function if it is not compiled at build time.

I don’t forsee changing our level of support here, though.

@obfusk
Copy link

obfusk commented Jul 16, 2020

I just ran into the missing support for loadable extensions myself (I have a read-only sqlite DB and an extension for PCRE support).

I understand that this is not a common use case, but the change is trivial and I can't really think of any downsides (there's no extra dependency or anything). Would you be willing to reconsider?

My workaround for now is using a post_compile hook to re-build python with --enable-loadable-sqlite-extensions:

# rebuild python if it's missing loadable sqlite extensions
if  ! python3 -msysconfig | grep enable-loadable-sqlite-extensions \
    > /dev/null; then
  PYTHON_VERSION="$(< runtime.txt)"
  export WORKSPACE_DIR="$(cd "$BIN_DIR"/.. || exit; pwd)/builds"
  rm -f .heroku/python/bin/python   # prevent failing ln after build
  sed -i 's!figure --pre!figure --enable-loadable-sqlite-extensions --pre!' \
    "$WORKSPACE_DIR"/runtimes/python3
  "$WORKSPACE_DIR/runtimes/$PYTHON_VERSION" /app/.heroku/python/
fi

@edmorley edmorley reopened this Aug 12, 2020
@edmorley
Copy link
Member

@obfusk Hi! I've reopened this issue to remind me to take a look when I get a chance to triage the issues in this repo (have been catching up with urgent fixes/tech debt first; hope to get to triage soon).

@edmorley
Copy link
Member

The official Python docker images use --enable-loadable-sqlite-extensions so I'd be inclined to copy them:
docker-library/python#125

@obfusk
Copy link

obfusk commented Aug 12, 2020

The official Python docker images use --enable-loadable-sqlite-extensions

So do Debian & Ubuntu and AFAIK most other Linux distros. Also Termux.

@edmorley
Copy link
Member

Tracking internally at W-8060029.

@buncis
Copy link

buncis commented Jul 29, 2021

@obfusk hello I have same problem with you but what I want to add is --enable-shared

can you tell me how and where to add that post_compile hook scripts of yours?

thanks

edit:

Ok seems I just need to add post_compile file to the bin folder

@obfusk
Copy link

obfusk commented Jul 29, 2021

@buncis https://github.com/obfusk/jiten/blob/master/bin/post_compile

edmorley added a commit that referenced this issue Oct 4, 2021
Release announcement:
https://www.python.org/downloads/release/python-3100/
https://blog.python.org/2021/10/python-3100-is-available.html

More detailsed "What's new":
https://docs.python.org/3.10/whatsnew/3.10.html

For this release, a new version of the buildpack's Python build script has been
added, which includes some long-overdue improvements:
- enables PGO (`--enable-optimizations`)
- enables loadable SQLite extensions (`--enable-loadable-sqlite-extensions`)
- enables strict configure option checking (`--enable-option-checking=fatal`)
- the make invocation now uses concurrency (!!)
- the test module cleanup step now also removes the `idle_test` directory

These bring our Python builds closer in-line with those used elsewhere, for example:
https://github.com/docker-library/python/blob/d65295b73bc2c711de96caeba17501d1a81b6a5c/3.9/buster/Dockerfile#L43-L45

For docs on the configure options, see:
https://docs.python.org/3.10/using/configure.html

Fixes #488.
GUS-W-8060029.
GUS-W-9093281.
edmorley added a commit that referenced this issue Oct 4, 2021
Release announcement:
https://www.python.org/downloads/release/python-3100/
https://blog.python.org/2021/10/python-3100-is-available.html

More detailsed "What's new":
https://docs.python.org/3.10/whatsnew/3.10.html

For this release, a new version of the buildpack's Python build script has been
added, which includes some long-overdue improvements:
- enables PGO (`--enable-optimizations`)
- enables loadable SQLite extensions (`--enable-loadable-sqlite-extensions`)
- enables strict configure option checking (`--enable-option-checking=fatal`)
- the make invocation now uses concurrency (!!)
- the test module cleanup step now also removes the `idle_test` directory

These bring our Python builds closer in-line with those used elsewhere, for example:
https://github.com/docker-library/python/blob/d65295b73bc2c711de96caeba17501d1a81b6a5c/3.9/buster/Dockerfile#L43-L45

For docs on the configure options, see:
https://docs.python.org/3.10/using/configure.html

Fixes #488.
GUS-W-8060029.
GUS-W-9093281.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants