Compare commits

...

7 commits

Author SHA1 Message Date
Simon Willison
5619069968 Use de-dupe idiom that works with Python 3.6, refs #1632 2022-02-07 15:42:59 -08:00
Simon Willison
0b1aa9d1a3 Release 0.60.2
Refs #1632
2022-02-07 15:32:54 -08:00
Simon Willison
a0ff62aac1 De-duplicate 'datasette db.db db.db', closes #1632
Refs https://github.com/simonw/datasette-publish-fly/pull/12
2022-02-07 15:28:46 -08:00
Simon Willison
8da5208561 Release 0.60.1
Refs #1609
2022-01-20 18:08:20 -08:00
Simon Willison
265c62344a Output pip freeze to show installed packages, refs #1609 2022-01-20 18:01:47 -08:00
Simon Willison
6b459c8732 Use environment markers for Python 3.6, refs #1609 2022-01-20 17:55:57 -08:00
Simon Willison
41060e7e7c Pin all versions to work with Python 3.6, refs #1609 2022-01-20 17:18:29 -08:00
6 changed files with 57 additions and 8 deletions

View file

@ -24,6 +24,7 @@ jobs:
- name: Install dependencies
run: |
pip install -e '.[test]'
pip freeze
- name: Run tests
run: |
pytest -n auto -m "not serial"

View file

@ -549,6 +549,11 @@ def serve(
)
)
# De-duplicate files so 'datasette db.db db.db' only attaches one /db
files_seen = set()
deduped_files = [f for f in files if f not in files_seen and not files_seen.add(f)]
files = deduped_files
try:
ds = Datasette(files, **kwargs)
except SpatialiteNotFound:

View file

@ -1,2 +1,2 @@
__version__ = "0.60"
__version__ = "0.60.2"
__version_info__ = tuple(__version__.split("."))

View file

@ -4,6 +4,20 @@
Changelog
=========
.. _v0_60.2:
0.60.2 (2022-02-07)
-------------------
- Fixed a bug where Datasette would open the same file twice with two different database names if you ran ``datasette file.db file.db``. (:issue:`1632`)
.. _v0_60.1:
0.60.1 (2022-01-20)
-------------------
- Fixed a bug where installation on Python 3.6 stopped working due to a change to an underlying dependency. This release can now be installed on Python 3.6, but is the last release of Datasette that will support anything less than Python 3.7. (:issue:`1609`)
.. _v0_60:
0.60 (2022-01-13)

View file

@ -58,6 +58,23 @@ setup(
"mergedeep>=1.1.1,<1.4.0",
"itsdangerous>=1.1,<3.0",
"python-baseconv==1.2.2",
# The following are known to work with 3.6
'asgiref<=3.4.1;python_version<="3.6"',
'click<=8.0.3;python_version<="3.6"',
'click-default-group<=1.2.2;python_version<="3.6"',
'Jinja2<=3.0.3;python_version<="3.6"',
'hupper<=1.10.3;python_version<="3.6"',
'httpx<=0.21.3;python_version<="3.6"',
'pint<=0.17;python_version<="3.6"',
'pluggy<=1.0.0;python_version<="3.6"',
'uvicorn<=0.16.0;python_version<="3.6"',
'aiofiles<=0.8.0;python_version<="3.6"',
'janus<=0.7.0;python_version<="3.6"',
'asgi-csrf<=0.9;python_version<="3.6"',
'PyYAML<=6.0;python_version<="3.6"',
'mergedeep<=1.3.4;python_version<="3.6"',
'itsdangerous<=2.0.1;python_version<="3.6"',
'python-baseconv<=1.2.2;python_version<="3.6"',
],
entry_points="""
[console_scripts]
@ -67,14 +84,14 @@ setup(
extras_require={
"docs": ["sphinx_rtd_theme", "sphinx-autobuild", "codespell"],
"test": [
"pytest>=5.2.2,<6.3.0",
"pytest-xdist>=2.2.1,<2.6",
"pytest-asyncio>=0.10,<0.17",
"beautifulsoup4>=4.8.1,<4.11.0",
"pytest==6.2.5",
"pytest-xdist==2.5.0",
"pytest-asyncio==0.16.0",
"beautifulsoup4==4.10.0",
"black==21.12b0",
"pytest-timeout>=1.4.2,<2.1",
"trustme>=0.7,<0.10",
"cogapp>=3.3.0",
"pytest-timeout==2.0.2",
"trustme==0.9.0",
"cogapp==3.3.0",
],
"rich": ["rich"],
},

View file

@ -259,6 +259,7 @@ def test_serve_create(ensure_eventloop, tmpdir):
def test_serve_duplicate_database_names(ensure_eventloop, tmpdir):
"'datasette db.db nested/db.db' should attach two databases, /db and /db_2"
runner = CliRunner()
db_1_path = str(tmpdir / "db.db")
nested = tmpdir / "nested"
@ -272,6 +273,17 @@ def test_serve_duplicate_database_names(ensure_eventloop, tmpdir):
assert {db["name"] for db in databases} == {"db", "db_2"}
def test_serve_deduplicate_same_database_path(ensure_eventloop, tmpdir):
"'datasette db.db db.db' should only attach one database, /db"
runner = CliRunner()
db_path = str(tmpdir / "db.db")
sqlite3.connect(db_path).execute("vacuum")
result = runner.invoke(cli, [db_path, db_path, "--get", "/-/databases.json"])
assert result.exit_code == 0, result.output
databases = json.loads(result.output)
assert {db["name"] for db in databases} == {"db"}
@pytest.mark.parametrize(
"filename", ["test-database (1).sqlite", "database (1).sqlite"]
)