mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-25 10:24:32 +02:00
Compare commits
8 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5587da085d | ||
|
|
948692a94b | ||
|
|
e4cff2236b | ||
|
|
c4fec77eea | ||
|
|
0ac8ca972b | ||
|
|
f3120f06a3 | ||
|
|
b1a2bb1dbf | ||
|
|
ec12b780d5 |
9 changed files with 68 additions and 5 deletions
2
.github/workflows/publish.yml
vendored
2
.github/workflows/publish.yml
vendored
|
|
@ -26,7 +26,7 @@ jobs:
|
|||
${{ runner.os }}-pip-
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
pip install -e '.[test]'
|
||||
pip install -e '.[test,tui]'
|
||||
- name: Run tests
|
||||
run: |
|
||||
pytest
|
||||
|
|
|
|||
5
.github/workflows/test.yml
vendored
5
.github/workflows/test.yml
vendored
|
|
@ -28,7 +28,7 @@ jobs:
|
|||
${{ runner.os }}-pip-
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
pip install -e '.[test,mypy,flake8]'
|
||||
pip install -e '.[test,mypy,flake8,tui]'
|
||||
- name: Optionally install numpy
|
||||
if: matrix.numpy == 1
|
||||
run: pip install numpy
|
||||
|
|
@ -44,7 +44,8 @@ jobs:
|
|||
pytest -v
|
||||
- name: run mypy
|
||||
run: mypy sqlite_utils tests
|
||||
- name: run flake8
|
||||
- name: run flake8 if Python 3.8 or higher
|
||||
if: matrix.python-version >= 3.8
|
||||
run: flake8
|
||||
- name: Check formatting
|
||||
run: black . --check
|
||||
|
|
|
|||
BIN
docs/_static/img/tui.png
vendored
Normal file
BIN
docs/_static/img/tui.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 233 KiB |
|
|
@ -4,6 +4,18 @@
|
|||
Changelog
|
||||
===========
|
||||
|
||||
.. _v3_32:
|
||||
|
||||
3.32 (2023-05-21)
|
||||
-----------------
|
||||
|
||||
- New experimental ``sqlite-utils tui`` interface for interactively building command-line invocations, powered by `Trogon <https://github.com/Textualize/trogon>`__. This requires an optional dependency, installed using ``sqlite-utils install trogon``. There is a screenshot :ref:`in the documentation <cli_tui>`. (:issue:`545`)
|
||||
- ``sqlite-utils analyze-tables`` command (:ref:`documentation <cli_analyze_tables>`) now has a ``--common-limit 20`` option for changing the number of common/least-common values shown for each column. (:issue:`544`)
|
||||
- ``sqlite-utils analyze-tables --no-most`` and ``--no-least`` options for disabling calculation of most-common and least-common values.
|
||||
- If a column contains only ``null`` values, ``analyze-tables`` will no longer attempt to calculate the most common and least common values for that column. (:issue:`547`)
|
||||
- Calling ``sqlite-utils analyze-tables`` with non-existent columns in the ``-c/--column`` option now results in an error message. (:issue:`548`)
|
||||
- The ``table.analyze_column()`` method (:ref:`documented here <python_api_analyze_column>`) now accepts ``most_common=False`` and ``least_common=False`` options for disabling calculation of those values.
|
||||
|
||||
.. _v3_31:
|
||||
|
||||
3.31 (2023-05-08)
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ This page lists the ``--help`` for every ``sqlite-utils`` CLI sub-command.
|
|||
"create-spatial-index": "cli_spatialite_indexes",
|
||||
"install": "cli_install",
|
||||
"uninstall": "cli_uninstall",
|
||||
"tui": "cli_tui",
|
||||
}
|
||||
commands.sort(key = lambda command: go_first.index(command) if command in go_first else 999)
|
||||
cog.out("\n")
|
||||
|
|
@ -1022,6 +1023,23 @@ disable-fts
|
|||
-h, --help Show this message and exit.
|
||||
|
||||
|
||||
.. _cli_ref_tui:
|
||||
|
||||
tui
|
||||
===
|
||||
|
||||
See :ref:`cli_tui`.
|
||||
|
||||
::
|
||||
|
||||
Usage: sqlite-utils tui [OPTIONS]
|
||||
|
||||
Open Textual TUI.
|
||||
|
||||
Options:
|
||||
-h, --help Show this message and exit.
|
||||
|
||||
|
||||
.. _cli_ref_optimize:
|
||||
|
||||
optimize
|
||||
|
|
|
|||
22
docs/cli.rst
22
docs/cli.rst
|
|
@ -2159,3 +2159,25 @@ You can uninstall packages that were installed using ``sqlite-utils install`` wi
|
|||
$ sqlite-utils uninstall beautifulsoup4
|
||||
|
||||
Use ``-y`` to skip the request for confirmation.
|
||||
|
||||
.. _cli_tui:
|
||||
|
||||
Experimental TUI
|
||||
================
|
||||
|
||||
A TUI is a "text user interface" (or "terminal user interface") - a keyboard and mouse driven graphical interface running in your terminal.
|
||||
|
||||
``sqlite-utils`` has experimental support for a TUI for building command-line invocations, built on top of the `Trogon <https://github.com/Textualize/trogon/>`__ TUI library.
|
||||
|
||||
To enable this feature you will need to install the ``trogon`` dependency. You can do that like so::
|
||||
|
||||
sqite-utils install trogon
|
||||
|
||||
Once installed, running the ``sqlite-utils tui`` command will launch the TUI interface::
|
||||
|
||||
sqlite-utils tui
|
||||
|
||||
You can then construct a command by selecting options from the menus, and execute it using ``Ctrl+R``.
|
||||
|
||||
.. image:: _static/img/tui.png
|
||||
:alt: A TUI interface for sqlite-utils - the left column shows a list of commands, while the right panel has a form for constructing arguments to the add-column command.
|
||||
|
|
|
|||
3
setup.py
3
setup.py
|
|
@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|||
import io
|
||||
import os
|
||||
|
||||
VERSION = "3.31"
|
||||
VERSION = "3.32"
|
||||
|
||||
|
||||
def get_long_description():
|
||||
|
|
@ -47,6 +47,7 @@ setup(
|
|||
"data-science-types",
|
||||
],
|
||||
"flake8": ["flake8"],
|
||||
"tui": ["trogon"],
|
||||
},
|
||||
entry_points="""
|
||||
[console_scripts]
|
||||
|
|
|
|||
|
|
@ -33,6 +33,11 @@ from .utils import (
|
|||
TypeTracker,
|
||||
)
|
||||
|
||||
try:
|
||||
import trogon # type: ignore
|
||||
except ImportError:
|
||||
trogon = None
|
||||
|
||||
|
||||
CONTEXT_SETTINGS = dict(help_option_names=["-h", "--help"])
|
||||
|
||||
|
|
@ -112,6 +117,10 @@ def cli():
|
|||
pass
|
||||
|
||||
|
||||
if trogon is not None:
|
||||
cli = trogon.tui()(cli)
|
||||
|
||||
|
||||
@cli.command()
|
||||
@click.argument(
|
||||
"path",
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import pytest
|
|||
import re
|
||||
|
||||
docs_path = Path(__file__).parent.parent / "docs"
|
||||
commands_re = re.compile(r"(?:\$ | )sqlite-utils (\S+) ")
|
||||
commands_re = re.compile(r"(?:\$ | )sqlite-utils (\S+)")
|
||||
recipes_re = re.compile(r"r\.(\w+)\(")
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue