From a157065c3117020e415189f29c88b263c214dc79 Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Mon, 23 Feb 2026 16:50:33 -0800 Subject: [PATCH] setup.py to pyproject.toml plus upgraded actions --- .github/workflows/publish.yml | 20 +++++++-------- .github/workflows/test.yml | 10 ++++---- .gitignore | 1 + pyproject.toml | 42 ++++++++++++++++++++++++++++++++ setup.py | 46 ----------------------------------- 5 files changed, 58 insertions(+), 61 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.py diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index cac9700..967ae82 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -12,18 +12,18 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: ${{ matrix.python-version }} cache: pip - cache-dependency-path: setup.py + cache-dependency-path: pyproject.toml - name: Install dependencies run: | - pip install '.[test]' + pip install . --group dev - name: Run tests run: | pytest @@ -34,16 +34,16 @@ jobs: permissions: id-token: write steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: - python-version: "3.12" + python-version: "3.13" cache: pip - cache-dependency-path: setup.py + cache-dependency-path: pyproject.toml - name: Install dependencies run: | - pip install setuptools wheel build + pip install build - name: Build run: | python -m build diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bbd465f..ea123b5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,18 +10,18 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: ${{ matrix.python-version }} cache: pip - cache-dependency-path: setup.py + cache-dependency-path: pyproject.toml - name: Install dependencies run: | - pip install -e '.[test]' + pip install . --group dev - name: Run tests run: | pytest diff --git a/.gitignore b/.gitignore index 53605b7..d07256d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .venv +uv.lock __pycache__/ *.py[cod] *$py.class diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..15d9c56 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,42 @@ +[project] +name = "dclient" +version = "0.4" +description = "A client CLI utility for Datasette instances" +readme = "README.md" +authors = [{name = "Simon Willison"}] +license = "Apache-2.0" +requires-python = ">=3.10" +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", +] + +[tool.uv.build-backend] +module-root = "" + +[build-system] +requires = ["uv_build>=0.9.18,<0.10.0"] +build-backend = "uv_build" diff --git a/setup.py b/setup.py deleted file mode 100644 index e50775e..0000000 --- a/setup.py +++ /dev/null @@ -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", -)