Skip to content

Commit ede24f0

Browse files
Follow ~/.python_search/theme in ps_ui; remove the Python terminal UI (#64)
* Follow ~/.python_search/theme in ps_ui; remove the Python terminal UI ps_ui now picks dark/light from ~/.python_search/theme (after PS_UI_THEME, before the time-of-day fallback), re-read every frame so a running daemon switches live when a system-wide theme switch writes the file. The Kitty-based term_ui and its supporting modules (QueryLogic, BM25 search, search actions, Python themes) are removed; `python_search search` / `pys` now open ps_ui. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * CI: install Python 3.12 before poetry install The ubuntu-22.04 runner ships Python 3.10, which the project's python = ">=3.12,<=3.14" constraint rejects, so the Tests workflow has failed at poetry install on every run since September. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Regenerate poetry.lock CI's poetry install refused the stale lock file (pyproject.toml changed significantly since poetry.lock was last generated). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Drop getch and refresh poetry.lock getch 1.0 is a Python 2 C extension that no longer builds on 3.12, and only the removed terminal UI used it. poetry.lock was also out of sync with pyproject.toml (missing pysimplegui), which made `poetry install` abort in CI. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * CI: write python_search config before running tests Tests import SystemPaths, which requires PYTHON_SEARCH_PATH in ~/.config/python_search/config. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * CI: configure PYTHON_SEARCH_PATH and an entries project before pytest SystemPaths and the entries loader raise when ~/.config/python_search/config or current_project are missing, so test collection errored on the runner. Point them at the checkout and at a project made from the bundled template. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * CI: install ripgrep for the entry editor tests Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * CI: run tests on ubuntu-24.04 ubuntu-22.04's apt ripgrep (13.0) fails to find the entry key declaration in test_entries_editor_finds_key_declaration_not_other_mentions; 24.04 ships 14.1. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Escape entry keys for ripgrep, not Python re re.escape also escapes spaces, and ripgrep < 14 (Ubuntu 22.04's 13.x) rejects "\ " as an unrecognized escape, so edit_key found nothing for any key with a space and fell back to the default file. Escape only Rust regex metacharacters. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent a70a2b3 commit ede24f0

23 files changed

Lines changed: 88 additions & 1350 deletions

‎.github/workflows/test.yml‎

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,39 @@ on:
1616
jobs:
1717
test:
1818
# The type of runner that the job will run on
19-
runs-on: ubuntu-22.04
19+
runs-on: ubuntu-24.04
2020

2121
# Steps represent a sequence of tasks that will be executed as part of the job
2222
steps:
2323
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
2424
- uses: actions/checkout@v3
2525

26+
# pin the Python the project requires (>=3.12)
27+
- uses: actions/setup-python@v5
28+
with:
29+
python-version: "3.12"
30+
2631
# Runs a single command using the runners shell
2732
- name: Install dependencies
2833
run: |
2934
sudo apt update -y
30-
sudo apt install gnome-keyring curl
35+
sudo apt install -y gnome-keyring curl ripgrep
3136
curl -sSL https://install.python-poetry.org | python3 -
3237
poetry --version
3338
poetry config --local virtualenvs.create true
3439
poetry install
3540
3641
3742
43+
# SystemPaths and the entries loader fail fast without these, so point them at this checkout
44+
# and at a fresh project made from the bundled entries_main.py template
45+
- name: Configure PythonSearch
46+
run: |
47+
mkdir -p ~/.config/python_search ~/python_search_entries
48+
echo "PYTHON_SEARCH_PATH=$GITHUB_WORKSPACE" > ~/.config/python_search/config
49+
cp python_search/init/entries_main.py ~/python_search_entries/
50+
echo "$HOME/python_search_entries" > ~/.config/python_search/current_project
51+
3852
# Runs a set of commands using the runners shell
3953
- name: Run a multi-line script
4054
run: |

‎DESIGN.md‎

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,8 @@ graph LR
1919
E --> F[InterpreterMatcher]
2020
```
2121

22-
## Terminal UI (fallback)
23-
24-
`python_search search` opens a Kitty window running `term_ui`, a hand rolled ANSI UI that loads
25-
entries by shelling out to the Python entries loader and ranks them with BM25.
26-
27-
```mermaid
28-
graph LR
29-
A[User] -- python_search search --> B[Kitty window]
30-
B --> C[term_ui: BM25 over entries]
31-
C -- Enter --> D[run_key]
32-
```
33-
3422
## Entries
3523

36-
Both front ends read the same database: `entries_main.py` in the entries project, which is
24+
The launcher reads the database: `entries_main.py` in the entries project, which is
3725
executable Python. The native launcher consumes a JSON dump of it
3826
(`python_search _entries_loader dump_entries`) rather than importing Python on every launch.

‎README.md‎

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,10 @@ On Linux (X11 or Wayland) build it with `cargo build --release -p ps-ui` in `rus
9090
`ps_ui daemon` at login, and bind `ps_ui show` to a key through an entry shortcut. See
9191
[`rust/README.md`](rust/README.md#linux).
9292

93-
| | terminal UI (`term_ui`) | native launcher (`ps_ui`) |
94-
|---|---|---|
95-
| Startup | two Python interpreters per launch | resident, ~10 ms to show |
96-
| Search | BM25 in Python over the full corpus | in-memory fuzzy match, 0.1–2 ms |
97-
| Rendering | full ANSI repaint per keystroke | GPU (a macOS panel, or a window on Linux) |
98-
| Host | a Kitty window | its own borderless window |
99-
100-
Both read the same entries and run the same executor; `term_ui` is untouched and remains available
101-
via `python_search search`. See [`rust/README.md`](rust/README.md) for the source layout, key
102-
bindings, ranking, and platform notes.
93+
`ps_ui` is resident (~10 ms to show), fuzzy matches in memory (0.1–2 ms) and renders on the GPU.
94+
`python_search search` (and `pys`) open it too. It follows `~/.python_search/theme` (`dark` or
95+
`light`) when present, otherwise the time of day. See [`rust/README.md`](rust/README.md) for the
96+
source layout, key bindings, ranking, and platform notes.
10397

10498
## Documentation
10599

@@ -144,8 +138,7 @@ puts these console scripts on your `PATH`. They are defined in `pyproject.toml`
144138
| Binary | What it does |
145139
|---|---|
146140
| `python_search` | Main CLI: `search`, `shortcuts`, `register_new`, `new_project`, and more. Run it with no arguments for the full list |
147-
| `pys` | Shortcut for `python_search search` |
148-
| `term_ui` | The terminal search UI on its own |
141+
| `pys` | Shortcut for `python_search search` (opens `ps_ui`) |
149142
| `run_key` | Run one entry by key, e.g. `run_key 'open mail'` |
150143
| `run_shortcut` | Run the entry that owns a shortcut, e.g. `run_shortcut '⌘⇧E'` |
151144
| `entries_editor` | Open an entry's definition in the editor (`edit_key`) or delete it (`delete_key`) |

‎poetry.lock‎

Lines changed: 22 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎pyproject.toml‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ tiny-data-warehouse = ">=0.1.5"
3232
datadog = "*"
3333
rank-bm25 = "^0.2.2"
3434
nltk = "^3.9.1"
35-
getch = "^1.0"
3635
PySimpleGUI = "*"
3736
[tool.poetry.dev-dependencies]
3837
pytest = "^7.1.2"
@@ -68,7 +67,6 @@ notify_send = 'python_search.apps.notification_ui:main'
6867
browser = 'python_search.apps.browser:main'
6968
run_key = 'python_search.entry_runner:main'
7069
run_shortcut = 'python_search.shortcut.runner:main'
71-
term_ui = 'python_search.search.search_ui.terminal_ui:main'
7270
register_new_launch_ui = 'python_search.entry_capture.entry_inserter_gui.register_new_gui:launch_ui'
7371
google_it = 'python_search.apps.google_it:main'
7472
share_entry = 'python_search.share_entry:main'

‎python_search/apps/terminal.py‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from python_search.configuration.loader import ConfigurationLoader
22
from python_search.environment import is_mac
3+
from python_search.host_system.system_paths import SystemPaths
34

45

56
def get_terminal():
@@ -74,6 +75,4 @@ def wrap_cmd_into_terminal(self, cmd, title=None, hold_terminal_open_on_end=True
7475
return final_cmd
7576

7677
def get_kitty_cmd(self):
77-
from python_search.search.search_ui.kitty_for_search_ui import get_kitty_cmd
78-
79-
return get_kitty_cmd()
78+
return SystemPaths.KITTY_BINNARY

‎python_search/apps/theme/BaseTheme.py‎

Lines changed: 0 additions & 15 deletions
This file was deleted.

‎python_search/apps/theme/ThemeSelector.py‎

Lines changed: 0 additions & 40 deletions
This file was deleted.

‎python_search/apps/theme/__init__.py‎

Whitespace-only changes.

‎python_search/apps/theme/theme.py‎

Lines changed: 0 additions & 68 deletions
This file was deleted.

0 commit comments

Comments
 (0)