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

WIP new JSON for queries #2053

Closed
wants to merge 29 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
7b41521
WIP new JSON for queries, refs #2049
simonw Apr 5, 2023
40dc5f5
WIP
simonw Apr 13, 2023
026429f
Work in progress on query view, refs #2049
simonw Apr 27, 2023
a706f34
Remove debug lines
simonw Apr 27, 2023
8b86fb7
Better debugging
simonw May 9, 2023
3304fd4
refresh_schemas() on database view
simonw May 9, 2023
6f903d5
Fixed a test
simonw May 9, 2023
fdb141f
shape_arrayfirst for query view
simonw May 9, 2023
6ae5312
?sql=... now displays HTML
simonw May 23, 2023
bbbfdb0
Add setuptools to dependencies
simonw Apr 27, 2023
3a7be0c
Hopeful fix for Python 3.7 httpx failure, refs #2066
simonw Apr 27, 2023
305655c
Add pip as a dependency too, for Rye - refs #2065
simonw Apr 27, 2023
01353c7
Build docs with 3.11 on ReadTheDocs
simonw May 7, 2023
59c52b5
Action: Deploy a Datasette branch preview to Vercel
simonw May 9, 2023
3f39fba
datasette.utils.check_callable(obj) - refs #2078
simonw May 25, 2023
0805771
Rename callable.py to check_callable.py, refs #2078
simonw May 25, 2023
94882aa
--cors Access-Control-Max-Age: 3600, closes #2079
simonw May 25, 2023
8ea00e0
New View base class (#2080)
simonw May 26, 2023
0072940
Merge branch 'main' into json-extras-query
simonw May 26, 2023
ba7bc2a
Better docs for startup() hook
simonw Jun 23, 2023
a88cd45
Bump blacken-docs from 1.13.0 to 1.14.0 (#2083)
dependabot[bot] Jun 29, 2023
7149155
codespell>=2.5.5, also spellcheck README - refs #2089
simonw Jun 29, 2023
c0c7647
Justfile I use for local development
simonw Jun 29, 2023
737a1a7
Fixed spelling error, refs #2089
simonw Jun 29, 2023
b5647eb
Fix all E741 Ambiguous variable name warnings, refs #2090
simonw Jun 29, 2023
d7aa14b
Homepage test now just asserts isinstance(x, int) - closes #2092
simonw Jun 29, 2023
e8ac498
Work in progress on query view, refs #2049
simonw Apr 27, 2023
e17a137
Add setuptools to dependencies
simonw Apr 27, 2023
ee24ea9
Add pip as a dependency too, for Rye - refs #2065
simonw Apr 27, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/spellcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ jobs:
pip install -e '.[docs]'
- name: Check spelling
run: |
codespell README.md --ignore-words docs/codespell-ignore-words.txt
codespell docs/*.rst --ignore-words docs/codespell-ignore-words.txt
codespell datasette -S datasette/static --ignore-words docs/codespell-ignore-words.txt
41 changes: 41 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
export DATASETTE_SECRET := "not_a_secret"

# Run tests and linters
@default: test lint

# Setup project
@init:
pipenv run pip install -e '.[test,docs]'

# Run pytest with supplied options
@test *options:
pipenv run pytest {{options}}

@codespell:
pipenv run codespell README.md --ignore-words docs/codespell-ignore-words.txt
pipenv run codespell docs/*.rst --ignore-words docs/codespell-ignore-words.txt
pipenv run codespell datasette -S datasette/static --ignore-words docs/codespell-ignore-words.txt

# Run linters: black, flake8, mypy, cog
@lint: codespell
pipenv run black . --check
pipenv run flake8
pipenv run cog --check README.md docs/*.rst

# Rebuild docs with cog
@cog:
pipenv run cog -r README.md docs/*.rst

# Serve live docs on localhost:8000
@docs: cog
pipenv run blacken-docs -l 60 docs/*.rst
cd docs && pipenv run make livehtml

# Apply Black
@black:
pipenv run black .

@serve:
pipenv run sqlite-utils create-database data.db
pipenv run sqlite-utils create-table data.db docs id integer title text --pk id --ignore
pipenv run python -m datasette data.db --root --reload
13 changes: 11 additions & 2 deletions datasette/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,12 @@
from jinja2.exceptions import TemplateNotFound

from .views.base import ureg
from .views.database import DatabaseDownload, DatabaseView, TableCreateView
from .views.database import (
DatabaseDownload,
DatabaseView,
TableCreateView,
database_view,
)
from .views.index import IndexView
from .views.special import (
JsonDataView,
Expand Down Expand Up @@ -1366,8 +1371,12 @@ def add_route(view, regex):
r"/-/patterns$",
)
add_route(DatabaseDownload.as_view(self), r"/(?P<database>[^\/\.]+)\.db$")
# add_route(
# DatabaseView.as_view(self), r"/(?P<database>[^\/\.]+)(\.(?P<format>\w+))?$"
# )
add_route(
DatabaseView.as_view(self), r"/(?P<database>[^\/\.]+)(\.(?P<format>\w+))?$"
wrap_view(database_view, self),
r"/(?P<database>[^\/\.]+)(\.(?P<format>\w+))?$",
)
add_route(TableCreateView.as_view(self), r"/(?P<database>[^\/\.]+)/-/create$")
add_route(
Expand Down
3 changes: 3 additions & 0 deletions datasette/utils/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ def __init__(self, httpx_response):
def status(self):
return self.httpx_response.status_code

def __repr__(self):
return "<TestResponse {} [{}]>".format(self.httpx_response.url, self.status)

# Supports both for test-writing convenience
@property
def status_code(self):
Expand Down
Loading
Loading