mirror of
https://github.com/kuhyx/utils.git
synced 2026-11-23 14:26:31 +01:00
Compare commits
3 Commits
0d86c41ee7
...
b00455722d
| Author | SHA1 | Date | |
|---|---|---|---|
| b00455722d | |||
| adeb40f68e | |||
| 73b3698421 |
@ -8,6 +8,8 @@ import datetime as dt
|
||||
import sys
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from kuhy_credit import credit_line
|
||||
|
||||
from app_errors import ingest, store
|
||||
from app_errors.rtdb import DEFAULT_SESSION, RtdbError, open_rtdb
|
||||
|
||||
@ -16,7 +18,11 @@ if TYPE_CHECKING:
|
||||
|
||||
|
||||
def _parser() -> argparse.ArgumentParser:
|
||||
parser = argparse.ArgumentParser(prog="app-errors", description=__doc__)
|
||||
parser = argparse.ArgumentParser(
|
||||
prog="app-errors",
|
||||
description=__doc__,
|
||||
epilog=credit_line(),
|
||||
)
|
||||
sub = parser.add_subparsers(dest="command", required=True)
|
||||
run = sub.add_parser("ingest", help="read RTDB and the spool, write the board reports")
|
||||
run.add_argument("--keep", action="store_true", help="leave RTDB entries in place")
|
||||
|
||||
@ -187,3 +187,13 @@ def test_default_paths_follow_xdg(monkeypatch: pytest.MonkeyPatch, tmp_path: Pat
|
||||
assert paths.reports == tmp_path / "app-errors"
|
||||
assert paths.spool == tmp_path / "app-errors-spool"
|
||||
assert paths.state == tmp_path / "app-errors-ingest" / "state.json"
|
||||
|
||||
|
||||
def test_help_ends_with_credit_line(capsys: pytest.CaptureFixture[str]) -> None:
|
||||
"""--help output ends with the kuhy credit line."""
|
||||
from kuhy_credit import credit_line
|
||||
|
||||
with pytest.raises(SystemExit):
|
||||
cli.main(["--help"])
|
||||
out = capsys.readouterr().out
|
||||
assert out.strip().endswith(credit_line())
|
||||
|
||||
@ -26,6 +26,7 @@ fail() { printf 'install: FAILED -- %s\n' "$1" >&2; exit 1; }
|
||||
build_venv() {
|
||||
[[ -x "$VENV_DIR/bin/python" ]] || /usr/bin/python3 -m venv "$VENV_DIR" || fail "venv"
|
||||
"$VENV_DIR/bin/pip" install --quiet "$UTILS_DIR/crdt-sync" || fail "crdt-sync"
|
||||
"$VENV_DIR/bin/pip" install --quiet --no-deps "$UTILS_DIR/kuhy_credit" || fail "kuhy_credit"
|
||||
"$VENV_DIR/bin/pip" install --quiet --no-deps -e "$REPO_DIR" || fail "app-errors"
|
||||
mkdir -p "$BIN_DIR"
|
||||
ln -sf "$VENV_DIR/bin/app-errors" "$BIN_DIR/app-errors"
|
||||
|
||||
@ -1,10 +1,11 @@
|
||||
[project]
|
||||
name = "app-errors"
|
||||
version = "0.1.2"
|
||||
version = "0.1.4"
|
||||
description = "Shared app error and slow-wait ingest: RTDB and local spool reports become todoImplementer error tickets"
|
||||
requires-python = ">=3.14"
|
||||
dependencies = [
|
||||
"crdt-sync @ git+https://github.com/kuhyx/utils@crdt-sync-v0.11.1#subdirectory=crdt-sync",
|
||||
"kuhy-credit @ git+https://github.com/kuhyx/utils@kuhy-credit-v0.3.1#subdirectory=kuhy_credit",
|
||||
]
|
||||
|
||||
[project.optional-dependencies]
|
||||
|
||||
@ -8,10 +8,11 @@ resolution-markers = [
|
||||
|
||||
[[package]]
|
||||
name = "app-errors"
|
||||
version = "0.1.2"
|
||||
version = "0.1.4"
|
||||
source = { virtual = "." }
|
||||
dependencies = [
|
||||
{ name = "crdt-sync" },
|
||||
{ name = "kuhy-credit" },
|
||||
]
|
||||
|
||||
[package.optional-dependencies]
|
||||
@ -25,6 +26,7 @@ test = [
|
||||
requires-dist = [
|
||||
{ name = "crdt-sync", git = "https://github.com/kuhyx/utils?subdirectory=crdt-sync&rev=crdt-sync-v0.11.1" },
|
||||
{ name = "jsonschema", marker = "extra == 'test'", specifier = "==4.26.0" },
|
||||
{ name = "kuhy-credit", git = "https://github.com/kuhyx/utils?subdirectory=kuhy_credit&rev=kuhy-credit-v0.3.1" },
|
||||
{ name = "pytest", marker = "extra == 'test'", specifier = "==9.2.0" },
|
||||
{ name = "pytest-cov", marker = "extra == 'test'", specifier = "==7.1.0" },
|
||||
]
|
||||
@ -396,6 +398,11 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/41/45/1a4ed80516f02155c51f51e8cedb3c1902296743db0bbc66608a0db2814f/jsonschema_specifications-2025.9.1-py3-none-any.whl", hash = "sha256:98802fee3a11ee76ecaca44429fda8a41bff98b00a0f2838151b113f210cc6fe", size = 18437, upload-time = "2025-09-08T01:34:57.871Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "kuhy-credit"
|
||||
version = "0.3.1"
|
||||
source = { git = "https://github.com/kuhyx/utils?subdirectory=kuhy_credit&rev=kuhy-credit-v0.3.1#2352c177232a4b4594573a3b1126697ef32851f7" }
|
||||
|
||||
[[package]]
|
||||
name = "packaging"
|
||||
version = "26.3"
|
||||
|
||||
@ -9,6 +9,8 @@ import logging
|
||||
import time
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from kuhy_credit import credit_line
|
||||
|
||||
from feedback_inbox._inbox import Importer, Outcome, Waiter, run_settled
|
||||
from feedback_inbox._paths import resolve_paths
|
||||
from feedback_inbox._todo import McpTodoClient
|
||||
@ -25,7 +27,10 @@ DEFAULT_WAIT = 15.0
|
||||
|
||||
|
||||
def _parser() -> argparse.ArgumentParser:
|
||||
parser = argparse.ArgumentParser(prog="feedback-inbox")
|
||||
parser = argparse.ArgumentParser(
|
||||
prog="feedback-inbox",
|
||||
epilog=credit_line(),
|
||||
)
|
||||
sub = parser.add_subparsers(dest="command", required=True)
|
||||
run = sub.add_parser("run", help="import new bundles as todo tasks")
|
||||
run.add_argument("--wait", type=float, default=DEFAULT_WAIT)
|
||||
|
||||
@ -101,3 +101,13 @@ def test_real_paths_are_under_home(
|
||||
def test_module_entry_point(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
monkeypatch.setattr("sys.argv", ["feedback-inbox", "run", "--wait", "0"])
|
||||
assert entry.run() == 0
|
||||
|
||||
|
||||
def test_help_ends_with_credit_line(capsys: pytest.CaptureFixture[str]) -> None:
|
||||
"""--help output ends with the kuhy credit line."""
|
||||
from kuhy_credit import credit_line
|
||||
|
||||
with pytest.raises(SystemExit):
|
||||
main(["--help"])
|
||||
out = capsys.readouterr().out
|
||||
assert out.strip().endswith(credit_line())
|
||||
|
||||
@ -7,7 +7,9 @@ name = "feedback-inbox"
|
||||
version = "0.1.0"
|
||||
description = "Turns every game dev-feedback bundle into one todo-app task"
|
||||
requires-python = ">=3.14"
|
||||
dependencies = []
|
||||
dependencies = [
|
||||
"kuhy-credit @ git+https://github.com/kuhyx/utils@kuhy-credit-v0.3.1#subdirectory=kuhy_credit",
|
||||
]
|
||||
|
||||
[project.scripts]
|
||||
feedback-inbox = "feedback_inbox._cli:main"
|
||||
|
||||
@ -18,6 +18,8 @@ import argparse
|
||||
import sys
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from kuhy_credit import credit_line
|
||||
|
||||
from freedays._api import is_free_day as _is_free_day
|
||||
from freedays._api import mark, release, status
|
||||
from freedays._cli_output import emit, emit_error
|
||||
@ -41,6 +43,7 @@ def _build_parser() -> argparse.ArgumentParser:
|
||||
"One shared pool of days on which every gate app stands down. "
|
||||
f"{DEFAULT_ANNUAL_BUDGET} per calendar year, resetting Jan 1."
|
||||
),
|
||||
epilog=credit_line(),
|
||||
)
|
||||
sub = parser.add_subparsers(dest="command", required=True)
|
||||
|
||||
|
||||
@ -153,3 +153,13 @@ def test_sync_quiet_exits_zero_when_there_is_no_remote(
|
||||
monkeypatch.setattr("freedays._sync.get_client", _refuse)
|
||||
assert main(["sync-quiet"]) == 0
|
||||
assert "no remote available" in capsys.readouterr().out
|
||||
|
||||
|
||||
def test_help_ends_with_credit_line(capsys: pytest.CaptureFixture[str]) -> None:
|
||||
"""--help output ends with the kuhy credit line."""
|
||||
from kuhy_credit import credit_line
|
||||
|
||||
with pytest.raises(SystemExit):
|
||||
main(["--help"])
|
||||
out = capsys.readouterr().out
|
||||
assert out.strip().endswith(credit_line())
|
||||
|
||||
@ -13,6 +13,7 @@ requires-python = ">=3.14"
|
||||
# ~15 lines of HMAC that were wanted live in freedays/_hmac.py instead.
|
||||
dependencies = [
|
||||
"crdt-sync @ git+https://github.com/kuhyx/utils@crdt-sync-v0.11.1#subdirectory=crdt-sync",
|
||||
"kuhy-credit @ git+https://github.com/kuhyx/utils@kuhy-credit-v0.3.1#subdirectory=kuhy_credit",
|
||||
]
|
||||
|
||||
[project.scripts]
|
||||
|
||||
@ -48,7 +48,7 @@ Nothing loads over the network and nothing opens without a click.
|
||||
|
||||
```jsonc
|
||||
// package.json
|
||||
"@kuhyx/kuhy-credit": "github:kuhyx/utils#kuhy-credit-v0.3.1&path:kuhy_credit/web"
|
||||
"@kuhyx/kuhy-credit": "github:kuhyx/utils#kuhy-credit-v0.3.2&path:kuhy_credit/web"
|
||||
```
|
||||
|
||||
```html
|
||||
@ -74,7 +74,7 @@ dependencies:
|
||||
kuhy_credit:
|
||||
git:
|
||||
url: https://github.com/kuhyx/utils
|
||||
ref: kuhy-credit-v0.3.1
|
||||
ref: kuhy-credit-v0.3.2
|
||||
path: kuhy_credit/flutter
|
||||
```
|
||||
|
||||
@ -91,7 +91,7 @@ app on Android). Back closes an open panel. Demo: `flutter/example`.
|
||||
|
||||
```bash
|
||||
cache="$(mktemp -d)"
|
||||
git clone --depth 1 --branch kuhy-credit-v0.3.1 https://github.com/kuhyx/utils "$cache"
|
||||
git clone --depth 1 --branch kuhy-credit-v0.3.2 https://github.com/kuhyx/utils "$cache"
|
||||
cp -r "$cache/kuhy_credit/godot/addons/kuhy_credit" addons/
|
||||
```
|
||||
|
||||
@ -107,7 +107,7 @@ The script opens the site with `OS.shell_open`. Demo:
|
||||
## Python / Tkinter
|
||||
|
||||
```bash
|
||||
pip install "kuhy-credit @ git+https://github.com/kuhyx/utils@kuhy-credit-v0.3.1#subdirectory=kuhy_credit"
|
||||
pip install "kuhy-credit @ git+https://github.com/kuhyx/utils@kuhy-credit-v0.3.2#subdirectory=kuhy_credit"
|
||||
```
|
||||
|
||||
```python
|
||||
@ -128,7 +128,7 @@ vector TikZ, no image file) and makes it a link to the site. No words appear.
|
||||
```bash
|
||||
# vendor the generated package from the tag, like the Godot addon
|
||||
cache="$(mktemp -d)"
|
||||
git clone --depth 1 --branch kuhy-credit-v0.3.1 https://github.com/kuhyx/utils "$cache"
|
||||
git clone --depth 1 --branch kuhy-credit-v0.3.2 https://github.com/kuhyx/utils "$cache"
|
||||
cp "$cache/kuhy_credit/latex/kuhy-credit.sty" kuhy-credit/
|
||||
TEXINPUTS="$PWD/kuhy-credit//:" pdflatex doc.tex
|
||||
```
|
||||
|
||||
@ -70,7 +70,7 @@ packages:
|
||||
path: ".."
|
||||
relative: true
|
||||
source: path
|
||||
version: "0.3.1"
|
||||
version: "0.3.2"
|
||||
leak_tracker:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@ -3,7 +3,7 @@ description: >-
|
||||
The shared "Created by kuhy" credit: an M1 logo button that opens a small
|
||||
panel, whose tap opens kuhy.duckdns.org. Android and Flutter web.
|
||||
publish_to: 'none'
|
||||
version: 0.3.1
|
||||
version: 0.3.2
|
||||
|
||||
environment:
|
||||
sdk: ^3.12.2
|
||||
|
||||
@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "kuhy-credit"
|
||||
version = "0.3.1"
|
||||
version = "0.3.2"
|
||||
description = "The shared 'Created by kuhy' logo credit: Tkinter widget and terminal line"
|
||||
requires-python = ">=3.14"
|
||||
dependencies = [] # pure stdlib: tkinter and webbrowser ship with Python
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@kuhyx/kuhy-credit",
|
||||
"version": "0.3.1",
|
||||
"version": "0.3.2",
|
||||
"private": false,
|
||||
"type": "module",
|
||||
"description": "<kuhy-credit>: the shared 'Created by kuhy' logo credit as a dependency-free custom element.",
|
||||
|
||||
@ -16,6 +16,8 @@ import urllib.request
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
from pathlib import Path
|
||||
|
||||
from kuhy_credit import credit_line
|
||||
|
||||
from omniroute_offload import _privacy as privacy
|
||||
|
||||
ENDPOINT = "http://127.0.0.1:20128/v1/chat/completions"
|
||||
@ -38,7 +40,9 @@ class GatewayError(RuntimeError):
|
||||
def parse(argv: list[str]) -> argparse.Namespace:
|
||||
"""Command-line options."""
|
||||
parser = argparse.ArgumentParser(
|
||||
prog="free-llm", description=__doc__.splitlines()[0]
|
||||
prog="free-llm",
|
||||
description=__doc__.splitlines()[0],
|
||||
epilog=credit_line(),
|
||||
)
|
||||
parser.add_argument("prompt", help="question or instruction")
|
||||
parser.add_argument(
|
||||
|
||||
@ -192,3 +192,13 @@ def test_tty_stdin_is_not_read(
|
||||
monkeypatch.setattr(sys, "stdin", Tty("must not be sent"))
|
||||
assert cli.main(["hi"]) == 0
|
||||
assert "must not be sent" not in sent[0]["messages"][-1]["content"]
|
||||
|
||||
|
||||
def test_help_ends_with_credit_line(capsys: pytest.CaptureFixture[str]) -> None:
|
||||
"""--help output ends with the kuhy credit line."""
|
||||
from kuhy_credit import credit_line
|
||||
|
||||
with pytest.raises(SystemExit):
|
||||
cli.main(["--help"])
|
||||
out = capsys.readouterr().out
|
||||
assert out.strip().endswith(credit_line())
|
||||
|
||||
@ -7,7 +7,9 @@ name = "omniroute_offload"
|
||||
version = "0.1.0"
|
||||
description = "Offload easy LLM work to free models behind the local OmniRoute gateway"
|
||||
requires-python = ">=3.14"
|
||||
dependencies = []
|
||||
dependencies = [
|
||||
"kuhy-credit @ git+https://github.com/kuhyx/utils@kuhy-credit-v0.3.1#subdirectory=kuhy_credit",
|
||||
]
|
||||
|
||||
[project.scripts]
|
||||
free-llm = "omniroute_offload._cli:main"
|
||||
|
||||
@ -46,6 +46,8 @@ build_venv() {
|
||||
"$VENV_DIR/bin/pip" install --quiet --upgrade pip || fail "pip self-upgrade"
|
||||
"$VENV_DIR/bin/pip" install --quiet "$UTILS_DIR/crdt-sync" \
|
||||
|| fail "the crdt-sync sibling package"
|
||||
"$VENV_DIR/bin/pip" install --quiet --no-deps "$UTILS_DIR/kuhy_credit" \
|
||||
|| fail "the kuhy_credit sibling package"
|
||||
"$VENV_DIR/bin/pip" install --quiet --no-deps "$UTILS_DIR/freedays" \
|
||||
|| fail "the freedays sibling package"
|
||||
"$VENV_DIR/bin/pip" install --quiet --no-deps -e "$REPO_DIR" \
|
||||
|
||||
@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "sickdays"
|
||||
version = "0.5.6"
|
||||
version = "0.5.8"
|
||||
description = "Shared sick-day pool: per-date, uncapped, synced; every gate respects it"
|
||||
requires-python = ">=3.14"
|
||||
# Deliberately NOT gatelock (its __init__ imports tkinter); the HMAC lives in
|
||||
@ -14,6 +14,7 @@ requires-python = ">=3.14"
|
||||
dependencies = [
|
||||
"crdt-sync @ git+https://github.com/kuhyx/utils@crdt-sync-v0.11.1#subdirectory=crdt-sync",
|
||||
"freedays @ git+https://github.com/kuhyx/utils@freedays-v0.4.3#subdirectory=freedays",
|
||||
"kuhy-credit @ git+https://github.com/kuhyx/utils@kuhy-credit-v0.3.1#subdirectory=kuhy_credit",
|
||||
]
|
||||
|
||||
[project.scripts]
|
||||
|
||||
@ -25,6 +25,8 @@ import importlib
|
||||
import sys
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from kuhy_credit import credit_line
|
||||
|
||||
from sickdays._api import add_sick_day, is_sick_day, load, remove_sick_day
|
||||
from sickdays._cli_output import emit, emit_error
|
||||
from sickdays._constants import LOCKERS
|
||||
@ -56,6 +58,7 @@ def _build_parser() -> argparse.ArgumentParser:
|
||||
"One shared pool of sick days every gate respects. No cap, no "
|
||||
"reason; today or later only."
|
||||
),
|
||||
epilog=credit_line(),
|
||||
)
|
||||
sub = parser.add_subparsers(dest="command", required=True)
|
||||
add = sub.add_parser("add", help="mark a day sick (today or later)")
|
||||
|
||||
@ -17,6 +17,8 @@ from __future__ import annotations
|
||||
import tkinter as tk
|
||||
from typing import TYPE_CHECKING, Final
|
||||
|
||||
from kuhy_credit.tk import KuhyCredit
|
||||
|
||||
from sickdays._api import is_sick_day, load
|
||||
from sickdays._day import to_iso, today
|
||||
from sickdays._keep_api import kept_lockers
|
||||
@ -84,6 +86,10 @@ class SickDaysApp:
|
||||
self._list = tk.Frame(left, name="upcoming", bg=tok.INK)
|
||||
self._list.pack(anchor="w", fill="x")
|
||||
self._draw_upcoming()
|
||||
# Credit in the bottom-right corner of the window
|
||||
KuhyCredit(root, theme="dark").place(
|
||||
relx=1, rely=1, x=-tok.LG, y=-tok.LG, anchor="se"
|
||||
)
|
||||
|
||||
def close(self, _event: object = None) -> None:
|
||||
"""Close the window (bound to ``Escape``)."""
|
||||
|
||||
@ -196,3 +196,13 @@ def test_importing_the_library_and_cli_never_imports_tkinter() -> None:
|
||||
)
|
||||
done = subprocess.run([sys.executable, "-c", probe], check=False)
|
||||
assert done.returncode == 0
|
||||
|
||||
|
||||
def test_help_ends_with_credit_line(capsys: pytest.CaptureFixture[str]) -> None:
|
||||
"""--help output ends with the kuhy credit line."""
|
||||
from kuhy_credit import credit_line
|
||||
|
||||
with pytest.raises(SystemExit):
|
||||
main(["--help"])
|
||||
out = capsys.readouterr().out
|
||||
assert out.strip().endswith(credit_line())
|
||||
|
||||
@ -27,9 +27,22 @@ LETTER = re.compile(r"[^\W\d_]")
|
||||
|
||||
|
||||
def _shown(widget: tk.Misc) -> list[str]:
|
||||
"""Every string ``widget`` and its descendants paint."""
|
||||
"""Every string ``widget`` and its descendants paint, except the credit."""
|
||||
found: list[str] = []
|
||||
# Find the credit panel frame in the toplevel so we can skip it
|
||||
credit_panel = None
|
||||
for child in widget.winfo_children():
|
||||
if child.__class__.__name__ == "KuhyCredit" and hasattr(child, "panel"):
|
||||
credit_panel = child.panel
|
||||
break
|
||||
|
||||
for child in widget.winfo_children():
|
||||
# Skip the KuhyCredit widget (Canvas)
|
||||
if child.__class__.__name__ == "KuhyCredit":
|
||||
continue
|
||||
# Skip the credit panel Frame (in toplevel) and its children
|
||||
if credit_panel is not None and child == credit_panel:
|
||||
continue
|
||||
if isinstance(child, tk.Canvas):
|
||||
# Raw Tcl: typeshed types Canvas.type()/itemcget() too loosely.
|
||||
path = str(child)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user