From 7b0643fcd92606611825eae091ff929240c7c11e Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Thu, 11 Dec 2025 14:39:51 -0800 Subject: [PATCH 01/11] Remove .gitpod.yml --- .gitpod.yml | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 .gitpod.yml diff --git a/.gitpod.yml b/.gitpod.yml deleted file mode 100644 index fe8ba1e6e..000000000 --- a/.gitpod.yml +++ /dev/null @@ -1,2 +0,0 @@ -tasks: -- init: pip install '.[test]' \ No newline at end of file From 86290a1eac24926123ea352cb8afd5f948b1f66c Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Thu, 11 Dec 2025 14:49:21 -0800 Subject: [PATCH 02/11] dependency-groups.dev and switch to uv in docs --- .github/workflows/publish.yml | 2 +- .github/workflows/test-coverage.yml | 2 +- .github/workflows/test-sqlite-support.yml | 2 +- docs/contributing.rst | 40 ++++++++--------------- pyproject.toml | 33 +++++++++---------- 5 files changed, 31 insertions(+), 48 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index dc6ee54cc..396e2b81d 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -21,7 +21,7 @@ jobs: 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/.github/workflows/test-coverage.yml b/.github/workflows/test-coverage.yml index 410edafc8..1f55f4e6c 100644 --- a/.github/workflows/test-coverage.yml +++ b/.github/workflows/test-coverage.yml @@ -24,7 +24,7 @@ jobs: - name: Install Python dependencies run: | python -m pip install --upgrade pip - python -m pip install -e .[test] + python -m pip install . --group dev python -m pip install pytest-cov - name: Run tests run: |- diff --git a/.github/workflows/test-sqlite-support.yml b/.github/workflows/test-sqlite-support.yml index 83a8fd39b..aa2ab9bd4 100644 --- a/.github/workflows/test-sqlite-support.yml +++ b/.github/workflows/test-sqlite-support.yml @@ -34,7 +34,7 @@ jobs: - run: python3 -c "import sqlite3; print(sqlite3.sqlite_version)" - name: Install dependencies run: | - pip install -e '.[test]' + pip install . --group dev pip freeze - name: Run tests run: | diff --git a/docs/contributing.rst b/docs/contributing.rst index 297341fe8..6154f6ac7 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -13,49 +13,41 @@ All improvements to the software should start with an issue. Read `How I build a Obtaining the code ================== -To work on this library locally, first checkout the code. Then create a new virtual environment:: +To work on this library locally, first checkout the code. git clone git@github.com:simonw/sqlite-utils cd sqlite-utils - python3 -mvenv venv - source venv/bin/activate -Or if you are using ``pipenv``:: +Use `uv run` to run the development version of the tool: - pipenv shell - -Within the virtual environment running ``sqlite-utils`` should run your locally editable version of the tool. You can use ``which sqlite-utils`` to confirm that you are running the version that lives in your virtual environment. + uv run sqlite-utils --help .. _contributing_tests: Running the tests ================= -To install the dependencies and test dependencies:: - - pip install -e '.[test]' - -To run the tests:: +Use `uv run` to run the tests: - pytest + uv run pytest .. _contributing_docs: Building the documentation ========================== -To build the documentation, first install the documentation dependencies:: +To build the documentation run this command:: - pip install -e '.[docs]' + uv run make livehtml --directory docs -Then run ``make livehtml`` from the ``docs/`` directory to start a server on port 8000 that will serve the documentation and live-reload any time you make an edit to a ``.rst`` file:: +This will start a server on port 8000 that will serve the documentation and live-reload any time you make an edit to a ``.rst`` file. cd docs make livehtml The `cog `__ tool is used to maintain portions of the documentation. You can run it like so:: - cog -r docs/*.rst + uv run cog -r docs/*.rst .. _contributing_linting: @@ -64,18 +56,12 @@ Linting and formatting ``sqlite-utils`` uses `Black `__ for code formatting, and `flake8 `__ and `mypy `__ for linting and type checking. -Black is installed as part of ``pip install -e '.[test]'`` - you can then format your code by running it in the root of the project:: - - black . - -To install ``mypy`` and ``flake8`` run the following:: - - pip install -e '.[flake8,mypy]' + uv run black . -Both commands can then be run in the root of the project like this:: +Linting tools can be run like this:: - flake8 - mypy sqlite_utils + uv run flake8 + uv run mypy sqlite_utils All three of these tools are run by our CI mechanism against every commit and pull request. diff --git a/pyproject.toml b/pyproject.toml index cceb315b9..304bbcdd1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,44 +31,41 @@ dependencies = [ "pip", ] -[project.urls] -Homepage = "https://github.com/simonw/sqlite-utils" -Documentation = "https://sqlite-utils.datasette.io/en/stable/" -Changelog = "https://sqlite-utils.datasette.io/en/stable/changelog.html" -Issues = "https://github.com/simonw/sqlite-utils/issues" -CI = "https://github.com/simonw/sqlite-utils/actions" - -[project.scripts] -sqlite-utils = "sqlite_utils.cli:cli" - -[project.optional-dependencies] -test = [ +[dependency-groups] +dev = [ "black>=24.1.1", "cogapp", "hypothesis", "pytest", -] -docs = [ + # docs "beanbag-docutils>=2.0", "codespell", "furo", "pygments-csv-lexer", "sphinx-autobuild", "sphinx-copybutton", -] -mypy = [ + # mypy "data-science-types", "mypy", "types-click", "types-pluggy", "types-python-dateutil", "types-tabulate", -] -flake8 = [ + # flake8 "flake8", "flake8-pyproject", ] +[project.urls] +Homepage = "https://github.com/simonw/sqlite-utils" +Documentation = "https://sqlite-utils.datasette.io/en/stable/" +Changelog = "https://sqlite-utils.datasette.io/en/stable/changelog.html" +Issues = "https://github.com/simonw/sqlite-utils/issues" +CI = "https://github.com/simonw/sqlite-utils/actions" + +[project.scripts] +sqlite-utils = "sqlite_utils.cli:cli" + [build-system] requires = ["setuptools"] build-backend = "setuptools.build_meta" From ffb98cd80ca00b65961c55fe5a1f03d86190062b Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Thu, 11 Dec 2025 14:52:49 -0800 Subject: [PATCH 03/11] Fixes to RST in docs --- docs/contributing.rst | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/docs/contributing.rst b/docs/contributing.rst index 6154f6ac7..f10b02a9f 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -13,12 +13,12 @@ All improvements to the software should start with an issue. Read `How I build a Obtaining the code ================== -To work on this library locally, first checkout the code. +To work on this library locally, first checkout the code:: git clone git@github.com:simonw/sqlite-utils cd sqlite-utils -Use `uv run` to run the development version of the tool: +Use ``uv run`` to run the development version of the tool:: uv run sqlite-utils --help @@ -27,7 +27,7 @@ Use `uv run` to run the development version of the tool: Running the tests ================= -Use `uv run` to run the tests: +Use ``uv run`` to run the tests:: uv run pytest @@ -42,9 +42,6 @@ To build the documentation run this command:: This will start a server on port 8000 that will serve the documentation and live-reload any time you make an edit to a ``.rst`` file. - cd docs - make livehtml - The `cog `__ tool is used to maintain portions of the documentation. You can run it like so:: uv run cog -r docs/*.rst @@ -54,7 +51,7 @@ The `cog `__ tool is used to maintain portions of Linting and formatting ====================== -``sqlite-utils`` uses `Black `__ for code formatting, and `flake8 `__ and `mypy `__ for linting and type checking. +``sqlite-utils`` uses `Black `__ for code formatting, and `flake8 `__ and `mypy `__ for linting and type checking:: uv run black . @@ -67,10 +64,10 @@ All three of these tools are run by our CI mechanism against every commit and pu .. _contributing_just: -Using Just and uv -================= +Using Just +========== -If you install `Just `__ and `uv `__ you can use them to manage your local development environment. +If you install `Just `__ you can use it to manage your local development environment. To run all of the tests and linters:: From 163752ce7e2bb2aca53007dda48272a547405ac8 Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Thu, 11 Dec 2025 14:53:54 -0800 Subject: [PATCH 04/11] install codespell properly --- .github/workflows/spellcheck.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/spellcheck.yml b/.github/workflows/spellcheck.yml index 62d5746e9..155475a51 100644 --- a/.github/workflows/spellcheck.yml +++ b/.github/workflows/spellcheck.yml @@ -15,7 +15,7 @@ jobs: cache-dependency-path: pyproject.toml - name: Install dependencies run: | - pip install -e '.[docs]' + pip install . --group dev - name: Check spelling run: | codespell docs/*.rst --ignore-words docs/codespell-ignore-words.txt From 4892c7270193c71ca2134a2037e0cc58ddc14c26 Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Thu, 11 Dec 2025 14:55:34 -0800 Subject: [PATCH 05/11] dependengy-groups.dev for readthedocs --- .readthedocs.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.readthedocs.yaml b/.readthedocs.yaml index e2b32edee..8183e3ae6 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -12,8 +12,8 @@ python: install: - method: pip path: . - extra_requirements: - - docs + dependency-groups: + - dev formats: - pdf From af04768e73be8e7c376349b6fb083dbf62c62204 Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Thu, 11 Dec 2025 14:58:44 -0800 Subject: [PATCH 06/11] Upgraded readthedocs recipe Refs https://github.com/simonw/sqlite-utils/pull/691#issuecomment-3644136334 --- .readthedocs.yaml | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 8183e3ae6..d4ac714ae 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -4,16 +4,13 @@ sphinx: configuration: docs/conf.py build: - os: ubuntu-22.04 + os: ubuntu-24.04 tools: - python: "3.11" - -python: - install: - - method: pip - path: . - dependency-groups: - - dev + python: "3.13" + jobs: + install: + - pip install --upgrade pip + - pip install --group 'docs' formats: - pdf From 81c896f90cdd4b4457f388b45b8d9ea0ac2a2e1c Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Thu, 11 Dec 2025 14:59:48 -0800 Subject: [PATCH 07/11] pip install --group dev --- .readthedocs.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.readthedocs.yaml b/.readthedocs.yaml index d4ac714ae..0bb40d8ac 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -10,7 +10,7 @@ build: jobs: install: - pip install --upgrade pip - - pip install --group 'docs' + - pip install --group dev formats: - pdf From 6f9b7add05a9ed83c91bad62177912598a8312a7 Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Thu, 11 Dec 2025 15:01:31 -0800 Subject: [PATCH 08/11] Fix for test.yml install --- .github/workflows/publish.yml | 2 +- .github/workflows/test.yml | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 396e2b81d..1afa5eff3 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -21,7 +21,7 @@ jobs: cache-dependency-path: pyproject.toml - name: Install dependencies run: | - pip install . --group dev + pip install --group dev - name: Run tests run: | pytest diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 24123f86a..50abf2afc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,9 +24,7 @@ jobs: cache-dependency-path: pyproject.toml - name: Install dependencies run: | - pip install -e '.[test,mypy,flake8]' - - name: Optionally install tui dependencies - run: pip install -e '.[tui]' + pip install --group dev - name: Optionally install numpy if: matrix.numpy == 1 run: pip install numpy From 43c8edf0132e2b48e07111fc816dc9f232d91ece Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Thu, 11 Dec 2025 15:16:31 -0800 Subject: [PATCH 09/11] Separate dependency group for docs Refs https://github.com/simonw/sqlite-utils/pull/691#issuecomment-3644188372 --- .readthedocs.yaml | 2 +- pyproject.toml | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 0bb40d8ac..e60586f7c 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -10,7 +10,7 @@ build: jobs: install: - pip install --upgrade pip - - pip install --group dev + - pip install --group docs formats: - pdf diff --git a/pyproject.toml b/pyproject.toml index 304bbcdd1..30ceeb0e9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,13 +37,6 @@ dev = [ "cogapp", "hypothesis", "pytest", - # docs - "beanbag-docutils>=2.0", - "codespell", - "furo", - "pygments-csv-lexer", - "sphinx-autobuild", - "sphinx-copybutton", # mypy "data-science-types", "mypy", @@ -55,6 +48,14 @@ dev = [ "flake8", "flake8-pyproject", ] +docs = [ + "beanbag-docutils>=2.0", + "codespell", + "furo", + "pygments-csv-lexer", + "sphinx-autobuild", + "sphinx-copybutton", +] [project.urls] Homepage = "https://github.com/simonw/sqlite-utils" From 0fb2cf67144606a6271fce12cb49125f75d9b99a Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Thu, 11 Dec 2025 15:17:46 -0800 Subject: [PATCH 10/11] Codespell is in docs group now --- .github/workflows/spellcheck.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/spellcheck.yml b/.github/workflows/spellcheck.yml index 155475a51..2afa7b730 100644 --- a/.github/workflows/spellcheck.yml +++ b/.github/workflows/spellcheck.yml @@ -15,7 +15,7 @@ jobs: cache-dependency-path: pyproject.toml - name: Install dependencies run: | - pip install . --group dev + pip install . --group docs - name: Check spelling run: | codespell docs/*.rst --ignore-words docs/codespell-ignore-words.txt From 270335dda76909e53cafd805859661bfc1412d20 Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Thu, 11 Dec 2025 15:20:47 -0800 Subject: [PATCH 11/11] Try different pip install pattern --- .github/workflows/test.yml | 2 +- .readthedocs.yaml | 2 +- Justfile | 18 +++++++++--------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 50abf2afc..763c6ad94 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,7 +24,7 @@ jobs: cache-dependency-path: pyproject.toml - name: Install dependencies run: | - pip install --group dev + pip install . --group dev - name: Optionally install numpy if: matrix.numpy == 1 run: pip install numpy diff --git a/.readthedocs.yaml b/.readthedocs.yaml index e60586f7c..08c2f81a1 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -10,7 +10,7 @@ build: jobs: install: - pip install --upgrade pip - - pip install --group docs + - pip install . --group docs formats: - pdf diff --git a/Justfile b/Justfile index 1d3f6c974..f4f0e7f24 100644 --- a/Justfile +++ b/Justfile @@ -3,30 +3,30 @@ # Run pytest with supplied options @test *options: - just run pytest {{options}} + uv run pytest {{options}} @run *options: - uv run --isolated --with-editable '.[test,mypy,flake8,docs]' -- {{options}} + uv run -- {{options}} # Run linters: black, flake8, mypy, cog @lint: just run black . --check - just run flake8 - just run mypy sqlite_utils tests - just run cog --check README.md docs/*.rst - just run codespell docs/*.rst --ignore-words docs/codespell-ignore-words.txt + uv run flake8 + uv run mypy sqlite_utils tests + uv run cog --check README.md docs/*.rst + uv run --group docs codespell docs/*.rst --ignore-words docs/codespell-ignore-words.txt # Rebuild docs with cog @cog: - just run cog -r README.md docs/*.rst + uv run --group docs cog -r README.md docs/*.rst # Serve live docs on localhost:8000 @docs: cog #!/usr/bin/env bash cd docs - uv run --isolated --with-editable '../.[test,docs]' make livehtml + uv run --group docs make livehtml # Apply Black @black: - just run black . + uv run black .