github
html_url | issue_url | id | node_id | user | created_at | updated_at | author_association | body | reactions | issue | performed_via_github_app |
---|---|---|---|---|---|---|---|---|---|---|---|
https://github.com/simonw/datasette/issues/14#issuecomment-381446392 | https://api.github.com/repos/simonw/datasette/issues/14 | 381446392 | MDEyOklzc3VlQ29tbWVudDM4MTQ0NjM5Mg== | 9599 | 2018-04-15T23:22:40Z | 2018-04-16T05:25:57Z | OWNER | OK, from that prototype in f2720b0c6b7172ebe8820 it looks like pluggy provides a solid path forward. Next steps: - [x] Build a demo plugin that uses setuptools entrypoints to register with the `datasette` plugin manager via pluggy - [x] Figure out a mechanism for registering plugins without first needing to publish them to PyPI. Can I load plugins from a special `plugins/` directory similar to the `--template-dir=templates/` option already supported by Datasette? #211 | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
267707940 | |
https://github.com/simonw/datasette/issues/14#issuecomment-381450394 | https://api.github.com/repos/simonw/datasette/issues/14 | 381450394 | MDEyOklzc3VlQ29tbWVudDM4MTQ1MDM5NA== | 9599 | 2018-04-16T00:27:23Z | 2018-04-16T00:27:23Z | OWNER | I created https://github.com/simonw/datasette-plugin-demos which is now published to PyPI and can be installed with `pip install datasette-plugin-demos` - I've confirmed that if you DO install it my Datasette `plugins` branch picks up the plugins, and `select random_integer(1, 4)` works as it should. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
267707940 | |
https://github.com/simonw/datasette/issues/14#issuecomment-381450591 | https://api.github.com/repos/simonw/datasette/issues/14 | 381450591 | MDEyOklzc3VlQ29tbWVudDM4MTQ1MDU5MQ== | 9599 | 2018-04-16T00:30:22Z | 2018-04-16T00:34:42Z | OWNER | Slight code design problem... when I tried installing my branch in a fresh virtual environment I got this error, because `setup.py` now depends on `pluggy` (from importing `__version__`): ``` File "/private/var/folders/jj/fngnv0810tn2lt_kd3911pdc0000gp/T/pip-req-build-dftqdezt/setup.py", line 2, in <module> from datasette import __version__ File "/private/var/folders/jj/fngnv0810tn2lt_kd3911pdc0000gp/T/pip-req-build-dftqdezt/datasette/__init__.py", line 2, in <module> from .hookspecs import hookimpl # noqa File "/private/var/folders/jj/fngnv0810tn2lt_kd3911pdc0000gp/T/pip-req-build-dftqdezt/datasette/hookspecs.py", line 1, in <module> from pluggy import HookimplMarker ModuleNotFoundError: No module named 'pluggy' ``` Looks like I've run into point 6 on https://packaging.python.org/guides/single-sourcing-package-version/ : ![2018-04-15 at 5 34 pm](https://user-images.githubusercontent.com/9599/38785314-403ce86a-40d3-11e8-8542-ba426eddf4ac.png) | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
267707940 | |
https://github.com/simonw/datasette/issues/139#issuecomment-381455054 | https://api.github.com/repos/simonw/datasette/issues/139 | 381455054 | MDEyOklzc3VlQ29tbWVudDM4MTQ1NTA1NA== | 9599 | 2018-04-16T01:24:13Z | 2018-04-16T01:24:13Z | OWNER | I think Vega-Lite is the way to go here: https://vega.github.io/vega-lite/ I've been playing around with it and Datasette with some really positive initial results: https://vega.github.io/editor/#/gist/vega-lite/simonw/89100ce80573d062d70f780d10e5e609/decada131575825875c0a076e418c661c2adb014/vice-shootings-gender-race-by-department.vl.json https://vega.github.io/editor/#/gist/vega-lite/simonw/5f69fbe29380b0d5d95f31a385f49ee4/7087b64df03cf9dba44a5258a606f29182cb8619/trees-san-francisco.vl.json | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
275493851 | |
https://github.com/simonw/datasette/issues/211#issuecomment-381456434 | https://api.github.com/repos/simonw/datasette/issues/211 | 381456434 | MDEyOklzc3VlQ29tbWVudDM4MTQ1NjQzNA== | 9599 | 2018-04-16T01:36:16Z | 2018-04-16T01:37:44Z | OWNER | The easiest way to implement this in Python 2 would be `execfile(...)` - but that was removed in Python 3. According to https://stackoverflow.com/a/437857/6083 `2to3` replaces that with this, which ensures the filename is associated with the code for debugging purposes: ``` with open("somefile.py") as f: code = compile(f.read(), "somefile.py", 'exec') exec(code, global_vars, local_vars) ``` Implementing it this way would force this kind of plugin to be self-contained in a single file. I think that's OK: if you want a more complex plugin you can use the standard pluggy-powered setuptools mechanism to build it. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
314471743 | |
https://github.com/simonw/datasette/issues/211#issuecomment-381462005 | https://api.github.com/repos/simonw/datasette/issues/211 | 381462005 | MDEyOklzc3VlQ29tbWVudDM4MTQ2MjAwNQ== | 9599 | 2018-04-16T02:23:07Z | 2018-04-16T02:23:07Z | OWNER | This needs unit tests. I also need to manually test the `datasette package` and `datesette publish` commands. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
314471743 | |
https://github.com/simonw/datasette/issues/211#issuecomment-381478217 | https://api.github.com/repos/simonw/datasette/issues/211 | 381478217 | MDEyOklzc3VlQ29tbWVudDM4MTQ3ODIxNw== | 9599 | 2018-04-16T04:41:38Z | 2018-04-16T04:41:38Z | OWNER | Here's the result of running: datasette publish now fivethirtyeight.db \ --plugins-dir=plugins/ --title="FiveThirtyEight" --branch=plugins-dir https://datasette-phjtvzwwzl.now.sh/fivethirtyeight-2628db9?sql=select+convert_units%28100%2C+%27m%27%2C+%27ft%27%29 Where `plugins/pint_plugin.py` contains the following: ``` from datasette import hookimpl import pint ureg = pint.UnitRegistry() @hookimpl def prepare_connection(conn): def convert_units(amount, from_, to_): "select convert_units(100, 'm', 'ft');" return (amount * ureg(from_)).to(to_).to_tuple()[0] conn.create_function('convert_units', 3, convert_units) ``` | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
314471743 | |
https://github.com/simonw/datasette/issues/211#issuecomment-381478253 | https://api.github.com/repos/simonw/datasette/issues/211 | 381478253 | MDEyOklzc3VlQ29tbWVudDM4MTQ3ODI1Mw== | 9599 | 2018-04-16T04:42:02Z | 2018-04-16T04:42:02Z | OWNER | This worked as well: datasette package fivethirtyeight.db \ --plugins-dir=plugins/ --title="FiveThirtyEight" --branch=plugins-dir | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
314471743 | |
https://github.com/simonw/datasette/issues/211#issuecomment-381481990 | https://api.github.com/repos/simonw/datasette/issues/211 | 381481990 | MDEyOklzc3VlQ29tbWVudDM4MTQ4MTk5MA== | 9599 | 2018-04-16T05:14:57Z | 2018-04-16T05:14:57Z | OWNER | Added unit tests in 33c6bcadb962457be6b0c7f369826b404e2bcef5 | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
314471743 | |
https://github.com/simonw/datasette/issues/211#issuecomment-381482407 | https://api.github.com/repos/simonw/datasette/issues/211 | 381482407 | MDEyOklzc3VlQ29tbWVudDM4MTQ4MjQwNw== | 9599 | 2018-04-16T05:18:29Z | 2018-04-16T05:18:29Z | OWNER | Here's the result of running this: datasette publish heroku fivethirtyeight.db \ --plugins-dir=plugins/ --title="FiveThirtyEight" --branch=plugins-dir https://intense-river-24599.herokuapp.com/fivethirtyeight-2628db9?sql=select+convert_units%28100%2C+%27m%27%2C+%27ft%27%29 | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
314471743 | |
https://github.com/simonw/datasette/pull/209#issuecomment-381483301 | https://api.github.com/repos/simonw/datasette/issues/209 | 381483301 | MDEyOklzc3VlQ29tbWVudDM4MTQ4MzMwMQ== | 9599 | 2018-04-16T05:25:08Z | 2018-04-16T05:25:08Z | OWNER | I think this is a good improvement. If you fix the tests I'll merge it. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
314455877 | |
https://github.com/simonw/datasette/issues/191#issuecomment-381488049 | https://api.github.com/repos/simonw/datasette/issues/191 | 381488049 | MDEyOklzc3VlQ29tbWVudDM4MTQ4ODA0OQ== | 9599 | 2018-04-16T05:58:15Z | 2018-04-16T05:58:15Z | OWNER | I think this is pretty hard. @coleifer has done some work in this direction, including https://github.com/coleifer/pysqlite3 which ports the standalone pysqlite module to Python 3. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
310533258 | |
https://github.com/simonw/datasette/issues/214#issuecomment-381490361 | https://api.github.com/repos/simonw/datasette/issues/214 | 381490361 | MDEyOklzc3VlQ29tbWVudDM4MTQ5MDM2MQ== | 9599 | 2018-04-16T06:13:02Z | 2018-04-16T06:13:02Z | OWNER | Packaging JS and CSS in a pip installable wheel is fiddly but possible. http://peak.telecommunity.com/DevCenter/PythonEggs#accessing-package-resources from pkg_resources import resource_string foo_config = resource_string(__name__, 'foo.conf') | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
314506446 | |
https://github.com/simonw/datasette/issues/214#issuecomment-381491707 | https://api.github.com/repos/simonw/datasette/issues/214 | 381491707 | MDEyOklzc3VlQ29tbWVudDM4MTQ5MTcwNw== | 9599 | 2018-04-16T06:21:23Z | 2018-04-16T06:21:23Z | OWNER | This looks like a good example: https://github.com/funkey/nyroglancer/commit/d4438ab42171360b2b8e9020f672846dd70c8d80 | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
314506446 | |
https://github.com/simonw/datasette/issues/191#issuecomment-381602005 | https://api.github.com/repos/simonw/datasette/issues/191 | 381602005 | MDEyOklzc3VlQ29tbWVudDM4MTYwMjAwNQ== | 119974 | 2018-04-16T13:37:32Z | 2018-04-16T13:37:32Z | NONE | I don't think it should be too difficult... you can look at what @ghaering did with pysqlite (and similarly what I copied for pysqlite3). You would theoretically take an amalgamation build of Sqlite (all code in a single .c and .h file). The `AmalgamationLibSqliteBuilder` class detects the presence of this amalgamated source file and builds a statically-linked pysqlite. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
310533258 | |
https://github.com/simonw/datasette/issues/14#issuecomment-381611738 | https://api.github.com/repos/simonw/datasette/issues/14 | 381611738 | MDEyOklzc3VlQ29tbWVudDM4MTYxMTczOA== | 9599 | 2018-04-16T14:07:30Z | 2018-04-16T14:07:30Z | OWNER | I should check if it's possible to have two template registration function plugins in a single plugin module. If it isn't maybe I should use class plugins instead of module plugins. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
267707940 | |
https://github.com/simonw/datasette/issues/214#issuecomment-381612585 | https://api.github.com/repos/simonw/datasette/issues/214 | 381612585 | MDEyOklzc3VlQ29tbWVudDM4MTYxMjU4NQ== | 9599 | 2018-04-16T14:10:16Z | 2018-04-16T14:10:16Z | OWNER | `resource_stream` returns a file-like object which may be better for serving from Sanic. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
314506446 | |
https://github.com/simonw/datasette/issues/14#issuecomment-381621338 | https://api.github.com/repos/simonw/datasette/issues/14 | 381621338 | MDEyOklzc3VlQ29tbWVudDM4MTYyMTMzOA== | 9599 | 2018-04-16T14:36:27Z | 2018-04-16T14:36:27Z | OWNER | Annoyingly, the following only results in the last of the two `prepare_connection` hooks being registered: ``` from datasette import hookimpl import pint import random ureg = pint.UnitRegistry() @hookimpl def prepare_connection(conn): def convert_units(amount, from_, to_): "select convert_units(100, 'm', 'ft');" return (amount * ureg(from_)).to(to_).to_tuple()[0] conn.create_function('convert_units', 3, convert_units) @hookimpl def prepare_connection(conn): conn.create_function('random_integer', 2, random.randint) ``` | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
267707940 | |
https://github.com/simonw/datasette/issues/216#issuecomment-381643173 | https://api.github.com/repos/simonw/datasette/issues/216 | 381643173 | MDEyOklzc3VlQ29tbWVudDM4MTY0MzE3Mw== | 9599 | 2018-04-16T15:21:17Z | 2018-04-16T15:21:17Z | OWNER | Yikes, definitely a bug. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
314665147 | |
https://github.com/simonw/datasette/issues/216#issuecomment-381644355 | https://api.github.com/repos/simonw/datasette/issues/216 | 381644355 | MDEyOklzc3VlQ29tbWVudDM4MTY0NDM1NQ== | 9599 | 2018-04-16T15:24:38Z | 2018-04-16T15:24:38Z | OWNER | So there are two tricky problems to solve here: * I need a way of encoding `null` into that `_next=` that is unambiguous from the string `None` or `null`. This means introducing some kind of escaping mechanism in those strings. I already use URL encoding as part of the construction of those components here, maybe that can help here? * I need to figure out what the SQL should be for the "next" set of results if the previous value was null. Thankfully we use the primary key as a tie-breaker so this shouldn't be impossible. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
314665147 | |
https://github.com/simonw/datasette/issues/216#issuecomment-381645274 | https://api.github.com/repos/simonw/datasette/issues/216 | 381645274 | MDEyOklzc3VlQ29tbWVudDM4MTY0NTI3NA== | 9599 | 2018-04-16T15:27:16Z | 2018-04-16T15:27:16Z | OWNER | Relevant code: https://github.com/simonw/datasette/blob/904f1c75a3c17671d25c53b91e177c249d14ab3b/datasette/app.py#L828-L832 | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
314665147 | |
https://github.com/simonw/datasette/issues/216#issuecomment-381645973 | https://api.github.com/repos/simonw/datasette/issues/216 | 381645973 | MDEyOklzc3VlQ29tbWVudDM4MTY0NTk3Mw== | 9599 | 2018-04-16T15:29:11Z | 2018-04-16T15:29:11Z | OWNER | I could use `$null` as a magic value that means None. Since I'm applying `quote_plus()` to actual values, any legit strings that look like this will be encoded as `%24null`: ``` >>> urllib.parse.quote_plus('$null') '%24null' ``` | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
314665147 | |
https://github.com/simonw/datasette/issues/216#issuecomment-381648053 | https://api.github.com/repos/simonw/datasette/issues/216 | 381648053 | MDEyOklzc3VlQ29tbWVudDM4MTY0ODA1Mw== | 9599 | 2018-04-16T15:35:17Z | 2018-04-16T15:35:17Z | OWNER | I think the correct SQL is this: https://datasette-issue-189-demo-3.now.sh/salaries-7859114-7859114?sql=select+rowid%2C+*+from+%5B2017+Maryland+state+salaries%5D%0D%0Awhere+%28middle_initial+is+not+null+or+%28middle_initial+is+null+and+rowid+%3E+%3Ap0%29%29%0D%0Aorder+by+middle_initial+limit+101&p0=391 ``` select rowid, * from [2017 Maryland state salaries] where (middle_initial is not null or (middle_initial is null and rowid > :p0)) order by middle_initial limit 101 ``` Though this will also need to be taken into account for #198 | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
314665147 | |
https://github.com/simonw/datasette/issues/216#issuecomment-381649140 | https://api.github.com/repos/simonw/datasette/issues/216 | 381649140 | MDEyOklzc3VlQ29tbWVudDM4MTY0OTE0MA== | 9599 | 2018-04-16T15:38:29Z | 2018-04-16T15:38:29Z | OWNER | But what would that SQL look like for `_sort_desc`? | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
314665147 | |
https://github.com/simonw/datasette/issues/216#issuecomment-381649437 | https://api.github.com/repos/simonw/datasette/issues/216 | 381649437 | MDEyOklzc3VlQ29tbWVudDM4MTY0OTQzNw== | 9599 | 2018-04-16T15:39:21Z | 2018-04-16T15:39:21Z | OWNER | Here's where that SQL gets constructed at the moment: https://github.com/simonw/datasette/blob/10a34f995c70daa37a8a2aa02c3135a4b023a24c/datasette/app.py#L761-L771 | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
314665147 | |
https://github.com/simonw/datasette/pull/209#issuecomment-381738137 | https://api.github.com/repos/simonw/datasette/issues/209 | 381738137 | MDEyOklzc3VlQ29tbWVudDM4MTczODEzNw== | 45057 | 2018-04-16T20:27:43Z | 2018-04-16T20:27:43Z | CONTRIBUTOR | Tests now fixed, honest. The failing test on Travis looks like an intermittent sqlite failure which should resolve itself on a retry... | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
314455877 | |
https://github.com/simonw/datasette/issues/203#issuecomment-381763651 | https://api.github.com/repos/simonw/datasette/issues/203 | 381763651 | MDEyOklzc3VlQ29tbWVudDM4MTc2MzY1MQ== | 45057 | 2018-04-16T21:59:17Z | 2018-04-16T21:59:17Z | CONTRIBUTOR | Ah, I had no idea you could bind python functions into sqlite! I think the primary purpose of this issue has been served now - I'm going to close this and create a new issue for the only bit of this that hasn't been touched yet, which is (optionally) exposing units in the JSON API. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
313837303 | |
https://github.com/simonw/datasette/issues/220#issuecomment-381777108 | https://api.github.com/repos/simonw/datasette/issues/220 | 381777108 | MDEyOklzc3VlQ29tbWVudDM4MTc3NzEwOA== | 9599 | 2018-04-16T23:04:04Z | 2018-04-16T23:04:04Z | OWNER | This could also help workaround the current predicament that a single plugin can only define one prepare_connection hook. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
314847571 | |
https://github.com/simonw/datasette/issues/216#issuecomment-381786522 | https://api.github.com/repos/simonw/datasette/issues/216 | 381786522 | MDEyOklzc3VlQ29tbWVudDM4MTc4NjUyMg== | 9599 | 2018-04-16T23:58:45Z | 2018-04-16T23:59:13Z | OWNER | Weird... tests are failing in Travis, despite passing on my local machine. https://travis-ci.org/simonw/datasette/builds/367423706 | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
314665147 |