Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/spellcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
cache-dependency-path: pyproject.toml
- name: Install dependencies
run: |
pip install -e '.[docs]'
pip install . --group docs
- name: Check spelling
run: |
codespell docs/*.rst --ignore-words docs/codespell-ignore-words.txt
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |-
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-sqlite-support.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions .gitpod.yml

This file was deleted.

15 changes: 6 additions & 9 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: .
extra_requirements:
- docs
python: "3.13"
jobs:
install:
- pip install --upgrade pip
- pip install . --group docs

formats:
- pdf
Expand Down
18 changes: 9 additions & 9 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
51 changes: 17 additions & 34 deletions docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,78 +13,61 @@ 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]'
Use ``uv run`` to run the tests::

To run the tests::

pytest
uv run pytest

.. _contributing_docs:

Building the documentation
==========================

To build the documentation, first install the documentation dependencies::

pip install -e '.[docs]'
To build the documentation run this command::

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::
uv run make livehtml --directory docs

cd docs
make livehtml
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.

The `cog <https://github.com/nedbat/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:

Linting and formatting
======================

``sqlite-utils`` uses `Black <https://black.readthedocs.io/>`__ for code formatting, and `flake8 <https://flake8.pycqa.org/>`__ and `mypy <https://mypy.readthedocs.io/>`__ for linting and type checking.
``sqlite-utils`` uses `Black <https://black.readthedocs.io/>`__ for code formatting, and `flake8 <https://flake8.pycqa.org/>`__ and `mypy <https://mypy.readthedocs.io/>`__ 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::
uv run black .

black .
Linting tools can be run like this::

To install ``mypy`` and ``flake8`` run the following::

pip install -e '.[flake8,mypy]'

Both commands can then be run in the root of the project 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.

.. _contributing_just:

Using Just and uv
=================
Using Just
==========

If you install `Just <https://github.com/casey/just>`__ and `uv <https://github.com/astral-sh/uv>`__ you can use them to manage your local development environment.
If you install `Just <https://github.com/casey/just>`__ you can use it to manage your local development environment.

To run all of the tests and linters::

Expand Down
46 changes: 22 additions & 24 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,43 +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 = [
"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",
]
docs = [
"beanbag-docutils>=2.0",
"codespell",
"furo",
"pygments-csv-lexer",
"sphinx-autobuild",
"sphinx-copybutton",
]

[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"]
Expand Down
Loading