mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-09-27 12:24:11 +02:00
dependency-groups.dev and uv in docs (#691)
* dependency-groups.dev and switch to uv in docs * Separate dependency group for docs
This commit is contained in:
parent
5a7f522980
commit
29d84bc95d
10 changed files with 59 additions and 85 deletions
2
.github/workflows/publish.yml
vendored
2
.github/workflows/publish.yml
vendored
|
|
@ -21,7 +21,7 @@ jobs:
|
||||||
cache-dependency-path: pyproject.toml
|
cache-dependency-path: pyproject.toml
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
pip install -e '.[test]'
|
pip install --group dev
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: |
|
run: |
|
||||||
pytest
|
pytest
|
||||||
|
|
|
||||||
2
.github/workflows/spellcheck.yml
vendored
2
.github/workflows/spellcheck.yml
vendored
|
|
@ -15,7 +15,7 @@ jobs:
|
||||||
cache-dependency-path: pyproject.toml
|
cache-dependency-path: pyproject.toml
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
pip install -e '.[docs]'
|
pip install . --group docs
|
||||||
- name: Check spelling
|
- name: Check spelling
|
||||||
run: |
|
run: |
|
||||||
codespell docs/*.rst --ignore-words docs/codespell-ignore-words.txt
|
codespell docs/*.rst --ignore-words docs/codespell-ignore-words.txt
|
||||||
|
|
|
||||||
2
.github/workflows/test-coverage.yml
vendored
2
.github/workflows/test-coverage.yml
vendored
|
|
@ -24,7 +24,7 @@ jobs:
|
||||||
- name: Install Python dependencies
|
- name: Install Python dependencies
|
||||||
run: |
|
run: |
|
||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
python -m pip install -e .[test]
|
python -m pip install . --group dev
|
||||||
python -m pip install pytest-cov
|
python -m pip install pytest-cov
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: |-
|
run: |-
|
||||||
|
|
|
||||||
2
.github/workflows/test-sqlite-support.yml
vendored
2
.github/workflows/test-sqlite-support.yml
vendored
|
|
@ -34,7 +34,7 @@ jobs:
|
||||||
- run: python3 -c "import sqlite3; print(sqlite3.sqlite_version)"
|
- run: python3 -c "import sqlite3; print(sqlite3.sqlite_version)"
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
pip install -e '.[test]'
|
pip install . --group dev
|
||||||
pip freeze
|
pip freeze
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: |
|
run: |
|
||||||
|
|
|
||||||
4
.github/workflows/test.yml
vendored
4
.github/workflows/test.yml
vendored
|
|
@ -24,9 +24,7 @@ jobs:
|
||||||
cache-dependency-path: pyproject.toml
|
cache-dependency-path: pyproject.toml
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
pip install -e '.[test,mypy,flake8]'
|
pip install . --group dev
|
||||||
- name: Optionally install tui dependencies
|
|
||||||
run: pip install -e '.[tui]'
|
|
||||||
- name: Optionally install numpy
|
- name: Optionally install numpy
|
||||||
if: matrix.numpy == 1
|
if: matrix.numpy == 1
|
||||||
run: pip install numpy
|
run: pip install numpy
|
||||||
|
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
tasks:
|
|
||||||
- init: pip install '.[test]'
|
|
||||||
|
|
@ -4,16 +4,13 @@ sphinx:
|
||||||
configuration: docs/conf.py
|
configuration: docs/conf.py
|
||||||
|
|
||||||
build:
|
build:
|
||||||
os: ubuntu-22.04
|
os: ubuntu-24.04
|
||||||
tools:
|
tools:
|
||||||
python: "3.11"
|
python: "3.13"
|
||||||
|
jobs:
|
||||||
python:
|
install:
|
||||||
install:
|
- pip install --upgrade pip
|
||||||
- method: pip
|
- pip install . --group docs
|
||||||
path: .
|
|
||||||
extra_requirements:
|
|
||||||
- docs
|
|
||||||
|
|
||||||
formats:
|
formats:
|
||||||
- pdf
|
- pdf
|
||||||
|
|
|
||||||
18
Justfile
18
Justfile
|
|
@ -3,30 +3,30 @@
|
||||||
|
|
||||||
# Run pytest with supplied options
|
# Run pytest with supplied options
|
||||||
@test *options:
|
@test *options:
|
||||||
just run pytest {{options}}
|
uv run pytest {{options}}
|
||||||
|
|
||||||
@run *options:
|
@run *options:
|
||||||
uv run --isolated --with-editable '.[test,mypy,flake8,docs]' -- {{options}}
|
uv run -- {{options}}
|
||||||
|
|
||||||
# Run linters: black, flake8, mypy, cog
|
# Run linters: black, flake8, mypy, cog
|
||||||
@lint:
|
@lint:
|
||||||
just run black . --check
|
just run black . --check
|
||||||
just run flake8
|
uv run flake8
|
||||||
just run mypy sqlite_utils tests
|
uv run mypy sqlite_utils tests
|
||||||
just run cog --check README.md docs/*.rst
|
uv run cog --check README.md docs/*.rst
|
||||||
just run codespell docs/*.rst --ignore-words docs/codespell-ignore-words.txt
|
uv run --group docs codespell docs/*.rst --ignore-words docs/codespell-ignore-words.txt
|
||||||
|
|
||||||
# Rebuild docs with cog
|
# Rebuild docs with cog
|
||||||
@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
|
# Serve live docs on localhost:8000
|
||||||
@docs: cog
|
@docs: cog
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
cd docs
|
cd docs
|
||||||
uv run --isolated --with-editable '../.[test,docs]' make livehtml
|
uv run --group docs make livehtml
|
||||||
|
|
||||||
|
|
||||||
# Apply Black
|
# Apply Black
|
||||||
@black:
|
@black:
|
||||||
just run black .
|
uv run black .
|
||||||
|
|
|
||||||
|
|
@ -13,78 +13,61 @@ All improvements to the software should start with an issue. Read `How I build a
|
||||||
Obtaining the code
|
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
|
git clone git@github.com:simonw/sqlite-utils
|
||||||
cd 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
|
uv run sqlite-utils --help
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
.. _contributing_tests:
|
.. _contributing_tests:
|
||||||
|
|
||||||
Running the tests
|
Running the tests
|
||||||
=================
|
=================
|
||||||
|
|
||||||
To install the dependencies and test dependencies::
|
Use ``uv run`` to run the tests::
|
||||||
|
|
||||||
pip install -e '.[test]'
|
uv run pytest
|
||||||
|
|
||||||
To run the tests::
|
|
||||||
|
|
||||||
pytest
|
|
||||||
|
|
||||||
.. _contributing_docs:
|
.. _contributing_docs:
|
||||||
|
|
||||||
Building the documentation
|
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 <https://github.com/nedbat/cog>`__ tool is used to maintain portions of the documentation. You can run it like so::
|
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:
|
.. _contributing_linting:
|
||||||
|
|
||||||
Linting and formatting
|
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::
|
uv run flake8
|
||||||
|
uv run mypy sqlite_utils
|
||||||
pip install -e '.[flake8,mypy]'
|
|
||||||
|
|
||||||
Both commands can then be run in the root of the project like this::
|
|
||||||
|
|
||||||
flake8
|
|
||||||
mypy sqlite_utils
|
|
||||||
|
|
||||||
All three of these tools are run by our CI mechanism against every commit and pull request.
|
All three of these tools are run by our CI mechanism against every commit and pull request.
|
||||||
|
|
||||||
.. _contributing_just:
|
.. _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::
|
To run all of the tests and linters::
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,22 +31,22 @@ dependencies = [
|
||||||
"pip",
|
"pip",
|
||||||
]
|
]
|
||||||
|
|
||||||
[project.urls]
|
[dependency-groups]
|
||||||
Homepage = "https://github.com/simonw/sqlite-utils"
|
dev = [
|
||||||
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 = [
|
|
||||||
"black>=24.1.1",
|
"black>=24.1.1",
|
||||||
"cogapp",
|
"cogapp",
|
||||||
"hypothesis",
|
"hypothesis",
|
||||||
"pytest",
|
"pytest",
|
||||||
|
# mypy
|
||||||
|
"data-science-types",
|
||||||
|
"mypy",
|
||||||
|
"types-click",
|
||||||
|
"types-pluggy",
|
||||||
|
"types-python-dateutil",
|
||||||
|
"types-tabulate",
|
||||||
|
# flake8
|
||||||
|
"flake8",
|
||||||
|
"flake8-pyproject",
|
||||||
]
|
]
|
||||||
docs = [
|
docs = [
|
||||||
"beanbag-docutils>=2.0",
|
"beanbag-docutils>=2.0",
|
||||||
|
|
@ -56,18 +56,16 @@ docs = [
|
||||||
"sphinx-autobuild",
|
"sphinx-autobuild",
|
||||||
"sphinx-copybutton",
|
"sphinx-copybutton",
|
||||||
]
|
]
|
||||||
mypy = [
|
|
||||||
"data-science-types",
|
[project.urls]
|
||||||
"mypy",
|
Homepage = "https://github.com/simonw/sqlite-utils"
|
||||||
"types-click",
|
Documentation = "https://sqlite-utils.datasette.io/en/stable/"
|
||||||
"types-pluggy",
|
Changelog = "https://sqlite-utils.datasette.io/en/stable/changelog.html"
|
||||||
"types-python-dateutil",
|
Issues = "https://github.com/simonw/sqlite-utils/issues"
|
||||||
"types-tabulate",
|
CI = "https://github.com/simonw/sqlite-utils/actions"
|
||||||
]
|
|
||||||
flake8 = [
|
[project.scripts]
|
||||||
"flake8",
|
sqlite-utils = "sqlite_utils.cli:cli"
|
||||||
"flake8-pyproject",
|
|
||||||
]
|
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["setuptools"]
|
requires = ["setuptools"]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue