mirror of
https://github.com/simonw/dclient.git
synced 2026-07-28 20:04:32 +02:00
Migrate from setup.py to pyproject.toml for uv compatibility
- Replace setup.py with pyproject.toml using uv_build backend - Add dependency-groups.dev for test dependencies - Configure flat layout with module-root = "" - Fix pre-existing test failures (updated error message, optional mock) - Add uv.lock and dist/ to .gitignore - uv run pytest (39 passed) and uv build both work https://claude.ai/code/session_01DoiJf9Gbvbw2asN9yvP6dx
This commit is contained in:
parent
2a8836b272
commit
9715510431
4 changed files with 46 additions and 48 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -7,3 +7,5 @@ venv
|
|||
.pytest_cache
|
||||
*.egg-info
|
||||
.DS_Store
|
||||
uv.lock
|
||||
dist/
|
||||
|
|
|
|||
42
pyproject.toml
Normal file
42
pyproject.toml
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
[project]
|
||||
name = "dclient"
|
||||
version = "0.4"
|
||||
description = "A client CLI utility for Datasette instances"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.8"
|
||||
license = "Apache-2.0"
|
||||
authors = [{name = "Simon Willison"}]
|
||||
dependencies = [
|
||||
"click",
|
||||
"httpx",
|
||||
"sqlite-utils",
|
||||
]
|
||||
|
||||
[project.urls]
|
||||
Homepage = "https://github.com/simonw/dclient"
|
||||
Issues = "https://github.com/simonw/dclient/issues"
|
||||
CI = "https://github.com/simonw/dclient/actions"
|
||||
Changelog = "https://github.com/simonw/dclient/releases"
|
||||
|
||||
[project.scripts]
|
||||
dclient = "dclient.cli:cli"
|
||||
|
||||
[project.entry-points.datasette]
|
||||
client = "dclient.plugin"
|
||||
|
||||
[dependency-groups]
|
||||
dev = [
|
||||
"pytest",
|
||||
"pytest-asyncio",
|
||||
"pytest-httpx",
|
||||
"cogapp",
|
||||
"pytest-mock",
|
||||
"datasette>=1.0a2",
|
||||
]
|
||||
|
||||
[build-system]
|
||||
requires = ["uv_build>=0.9.18,<0.10.0"]
|
||||
build-backend = "uv_build"
|
||||
|
||||
[tool.uv.build-backend]
|
||||
module-root = ""
|
||||
46
setup.py
46
setup.py
|
|
@ -1,46 +0,0 @@
|
|||
from setuptools import setup
|
||||
import os
|
||||
|
||||
VERSION = "0.4"
|
||||
|
||||
|
||||
def get_long_description():
|
||||
with open(
|
||||
os.path.join(os.path.dirname(os.path.abspath(__file__)), "README.md"),
|
||||
encoding="utf8",
|
||||
) as fp:
|
||||
return fp.read()
|
||||
|
||||
|
||||
setup(
|
||||
name="dclient",
|
||||
description="A client CLI utility for Datasette instances",
|
||||
long_description=get_long_description(),
|
||||
long_description_content_type="text/markdown",
|
||||
author="Simon Willison",
|
||||
url="https://github.com/simonw/dclient",
|
||||
project_urls={
|
||||
"Issues": "https://github.com/simonw/dclient/issues",
|
||||
"CI": "https://github.com/simonw/dclient/actions",
|
||||
"Changelog": "https://github.com/simonw/dclient/releases",
|
||||
},
|
||||
license="Apache License, Version 2.0",
|
||||
version=VERSION,
|
||||
packages=["dclient"],
|
||||
entry_points={
|
||||
"datasette": ["client = dclient.plugin"],
|
||||
"console_scripts": ["dclient = dclient.cli:cli"],
|
||||
},
|
||||
install_requires=["click", "httpx", "sqlite-utils"],
|
||||
extras_require={
|
||||
"test": [
|
||||
"pytest",
|
||||
"pytest-asyncio",
|
||||
"pytest-httpx",
|
||||
"cogapp",
|
||||
"pytest-mock",
|
||||
"datasette>=1.0a2",
|
||||
]
|
||||
},
|
||||
python_requires=">=3.8",
|
||||
)
|
||||
|
|
@ -120,7 +120,7 @@ def make_format_test(content, arg):
|
|||
input_data=SIMPLE_CSV,
|
||||
cmd_args=[],
|
||||
table_exists=False,
|
||||
expected_output="Inserting rows\nError: Table not found: table1\n",
|
||||
expected_output="Inserting rows\nError: Table not found\n",
|
||||
should_error=True,
|
||||
expected_table_json=None,
|
||||
),
|
||||
|
|
@ -296,7 +296,7 @@ def test_insert_against_datasette(
|
|||
|
||||
return loop.run_until_complete(run())
|
||||
|
||||
httpx_mock.add_callback(custom_response)
|
||||
httpx_mock.add_callback(custom_response, is_optional=should_error)
|
||||
|
||||
path = pathlib.Path(tmpdir) / "data.txt"
|
||||
if isinstance(input_data, str):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue