Rename to sigcal-bot

- package src/sigcal_bot, distribution and CLI sigcal-bot
- environment variables SIGCAL_BOT_*
- database file, container names, user agents, logs and QR device name
- docs and changelog updated
This commit is contained in:
2026-11-18 17:06:40 +00:00
parent f6d0db664e
commit add77f6cb8
23 changed files with 56 additions and 56 deletions
+5 -5
View File
@@ -13,7 +13,7 @@ Read `README.md` for the user-facing behaviour and setup.
## Layout
```
src/signal_cal_bot/
src/sigcal_bot/
config.py TOML loading, defaults, duration/time parsers
feed.py conditional GET; validators committed only after parse
expand.py iCalendar -> Event; series-ID heuristics; recurrence expansion
@@ -34,9 +34,9 @@ python -m venv .venv && . .venv/bin/activate
pip install -e '.[dev]'
pytest # must pass, no network
signal-cal-bot --config config.toml --dump # render the feed without sending
signal-cal-bot --config config.toml --check # config + Signal account check
signal-cal-bot --config config.toml --once # one tick
sigcal-bot --config config.toml --dump # render the feed without sending
sigcal-bot --config config.toml --check # config + Signal account check
sigcal-bot --config config.toml --once # one tick
```
`--dump` uses a throwaway database and never sends; keep it that way.
@@ -97,7 +97,7 @@ signal-cal-bot --config config.toml --once # one tick
default, parse it in `load_config`, document it in `config.example.toml` and
the README table.
- **Schema change**: append to `SCHEMA` in `store.py`. There is no migration
framework; deleting `data/signal-cal-bot.sqlite3` re-seeds silently.
framework; deleting `data/sigcal-bot.sqlite3` re-seeds silently.
## Changelog
+3 -3
View File
@@ -36,9 +36,9 @@ Unreleased. To make the first release, rename that section to
### Changed
- Renamed from `calbot` to `signal-cal-bot`: Python package
`signal_cal_bot`, CLI `signal-cal-bot`, environment variables
`SIGNAL_CAL_BOT_*`, database `data/signal-cal-bot.sqlite3`.
- Renamed from `calbot` to `sigcal-bot`: Python package
`sigcal_bot`, CLI `sigcal-bot`, environment variables
`SIGCAL_BOT_*`, database `data/sigcal-bot.sqlite3`.
### Fixed
+1 -1
View File
@@ -13,4 +13,4 @@ RUN pip install .
# The compose file runs the bot as uid/gid 1000; these must be writable.
RUN mkdir -p /app/data /app/cache && chown -R 1000:1000 /app/data /app/cache
CMD ["python", "-m", "signal_cal_bot", "--config", "/app/config.toml"]
CMD ["python", "-m", "sigcal_bot", "--config", "/app/config.toml"]
+9 -9
View File
@@ -111,14 +111,14 @@ the phone must scan, and the server has no browser. Either:
ssh -L 8080:localhost:8080 you@server
```
Then open <http://localhost:8080/v1/qrcodelink?device_name=signal-cal-bot>
Then open <http://localhost:8080/v1/qrcodelink?device_name=sigcal-bot>
in your local browser and scan it from
**Signal → Settings → Linked devices → +**.
- **Fetch the QR as a file.** On the server:
```bash
curl -s "http://localhost:8080/v1/qrcodelink?device_name=signal-cal-bot" \
curl -s "http://localhost:8080/v1/qrcodelink?device_name=sigcal-bot" \
-o /tmp/link-qr.png
```
@@ -199,8 +199,8 @@ https.
### 3. Verify, preview, run
```bash
docker compose run --rm bot python -m signal_cal_bot --check # config + account
docker compose run --rm bot python -m signal_cal_bot --dump # rendered posts, no sending
docker compose run --rm bot python -m sigcal_bot --check # config + account
docker compose run --rm bot python -m sigcal_bot --dump # rendered posts, no sending
docker compose up -d bot
docker compose logs -f bot
```
@@ -209,10 +209,10 @@ docker compose logs -f bot
| Command | Purpose |
|---|---|
| `signal-cal-bot --config config.toml` | Run the loop |
| `signal-cal-bot --once` | Run a single tick and exit |
| `signal-cal-bot --dump` | Print rendered posts for the feed; uses a temporary DB, sends nothing |
| `signal-cal-bot --check` | Validate config and confirm the Signal account is linked |
| `sigcal-bot --config config.toml` | Run the loop |
| `sigcal-bot --once` | Run a single tick and exit |
| `sigcal-bot --dump` | Print rendered posts for the feed; uses a temporary DB, sends nothing |
| `sigcal-bot --check` | Validate config and confirm the Signal account is linked |
All commands accept `--log-level` (or `LOG_LEVEL`).
@@ -258,7 +258,7 @@ All commands accept `--log-level` (or `LOG_LEVEL`).
| Follow logs | `docker compose logs -f bot` |
| Apply config changes | edit `config.toml`, then `docker compose restart bot` |
| Update code | `git pull && docker compose up -d --build` |
| Reset duplicate/seen state | stop bot, delete `data/signal-cal-bot.sqlite3`, start (re-seeds silently) |
| Reset duplicate/seen state | stop bot, delete `data/sigcal-bot.sqlite3`, start (re-seeds silently) |
| Clear image cache | `rm -rf cache/images` |
| Back up | `signal-data/` (linked-device keys) and `config.toml` |
+1 -1
View File
@@ -59,5 +59,5 @@ alert_cooldown_hours = 6
daily_heartbeat = false
[storage]
db = "data/signal-cal-bot.sqlite3"
db = "data/sigcal-bot.sqlite3"
cache = "cache"
+3 -3
View File
@@ -2,7 +2,7 @@
services:
signal-api:
image: bbernhard/signal-cli-rest-api:latest
container_name: signal-cal-bot-signal
container_name: sigcal-bot-signal
restart: unless-stopped
environment:
- MODE=json-rpc-native
@@ -17,13 +17,13 @@ services:
bot:
build: .
container_name: signal-cal-bot
container_name: sigcal-bot
restart: unless-stopped
depends_on:
- signal-api
user: "1000:1000"
environment:
- SIGNAL_CAL_BOT_CONFIG=/app/config.toml
- SIGCAL_BOT_CONFIG=/app/config.toml
- LOG_LEVEL=info
- TZ=Europe/London
volumes:
+2 -2
View File
@@ -1,5 +1,5 @@
[project]
name = "signal-cal-bot"
name = "sigcal-bot"
version = "0.1.0"
description = "Announce iCalendar events to a Signal group"
requires-python = ">=3.11"
@@ -18,7 +18,7 @@ dependencies = [
dev = ["pytest>=8.0", "ruff>=0.6"]
[project.scripts]
signal-cal-bot = "signal_cal_bot.__main__:main"
sigcal-bot = "sigcal_bot.__main__:main"
[build-system]
requires = ["setuptools>=77"]
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Copyright (C) 2026 kawaiipunk
"""signal-cal-bot: announce iCalendar events to a Signal group."""
"""sigcal-bot: announce iCalendar events to a Signal group."""
__version__ = "0.1.0"
@@ -28,7 +28,7 @@ from .signal_client import SignalClient
from .store import Store
from .watchdog import Watchdog
log = logging.getLogger("signal_cal_bot")
log = logging.getLogger("sigcal_bot")
TICK_SECONDS = 30
@@ -43,7 +43,7 @@ def _logging(level: str) -> None:
def _http_client() -> httpx.Client:
return httpx.Client(
follow_redirects=True,
headers={"User-Agent": "signal-cal-bot/0.1 (iCalendar to Signal bridge)"},
headers={"User-Agent": "sigcal-bot/0.1 (iCalendar to Signal bridge)"},
limits=httpx.Limits(max_connections=8, max_keepalive_connections=4),
)
@@ -102,11 +102,11 @@ def dump(config: Config) -> int:
def main(argv: list[str] | None = None) -> int:
parser = argparse.ArgumentParser(prog="signal-cal-bot", description=__doc__)
parser = argparse.ArgumentParser(prog="sigcal-bot", description=__doc__)
parser.add_argument(
"--config",
default=os.environ.get("SIGNAL_CAL_BOT_CONFIG", "config.toml"),
help="path to config.toml (default: $SIGNAL_CAL_BOT_CONFIG or ./config.toml)",
default=os.environ.get("SIGCAL_BOT_CONFIG", "config.toml"),
help="path to config.toml (default: $SIGCAL_BOT_CONFIG or ./config.toml)",
)
parser.add_argument("--once", action="store_true", help="run a single tick and exit")
parser.add_argument("--dump", action="store_true", help="print posts for upcoming events")
@@ -142,7 +142,7 @@ def main(argv: list[str] | None = None) -> int:
else:
log.error(
"Signal account %s not found at %s. Link it first: "
"open %s/v1/qrcodelink?device_name=signal-cal-bot and scan the QR code.",
"open %s/v1/qrcodelink?device_name=sigcal-bot and scan the QR code.",
config.signal.number,
config.signal.api_url,
config.signal.api_url,
@@ -175,10 +175,10 @@ def main(argv: list[str] | None = None) -> int:
signal.signal(signal.SIGTERM, stop)
signal.signal(signal.SIGINT, stop)
log.info("signal-cal-bot started (feed=%s, group=%s)", config.calendar.url, config.signal.group_id)
log.info("sigcal-bot started (feed=%s, group=%s)", config.calendar.url, config.signal.group_id)
if not sender.account_exists():
log.warning(
"Signal account not linked yet. Open %s/v1/qrcodelink?device_name=signal-cal-bot",
"Signal account not linked yet. Open %s/v1/qrcodelink?device_name=sigcal-bot",
config.signal.api_url,
)
@@ -191,7 +191,7 @@ def main(argv: list[str] | None = None) -> int:
while not stopping and time.monotonic() < deadline:
time.sleep(0.5)
log.info("signal-cal-bot stopped")
log.info("sigcal-bot stopped")
store.close()
http.close()
sender.close()
@@ -142,7 +142,7 @@ class Config:
images: ImagesConfig = field(default_factory=ImagesConfig)
format: FormatConfig = field(default_factory=FormatConfig)
watchdog: WatchdogConfig = field(default_factory=WatchdogConfig)
db_path: Path = Path("data/signal-cal-bot.sqlite3")
db_path: Path = Path("data/sigcal-bot.sqlite3")
cache_dir: Path = Path("cache")
config_path: Path | None = None
base_dir: Path = Path(".")
@@ -194,8 +194,8 @@ def load_config(path: str | Path) -> Config:
for lead in lead_times:
parse_duration(lead)
db_path = Path(os.environ.get("SIGNAL_CAL_BOT_DB", storage.get("db", "data/signal-cal-bot.sqlite3")))
cache_dir = Path(os.environ.get("SIGNAL_CAL_BOT_CACHE", storage.get("cache", "cache")))
db_path = Path(os.environ.get("SIGCAL_BOT_DB", storage.get("db", "data/sigcal-bot.sqlite3")))
cache_dir = Path(os.environ.get("SIGCAL_BOT_CACHE", storage.get("cache", "cache")))
if not db_path.is_absolute():
db_path = base_dir / db_path
if not cache_dir.is_absolute():
@@ -15,7 +15,7 @@ from .store import Store, from_iso, iso
log = logging.getLogger(__name__)
USER_AGENT = "signal-cal-bot/0.1 (iCalendar to Signal bridge)"
USER_AGENT = "sigcal-bot/0.1 (iCalendar to Signal bridge)"
def normalize_feed_url(url: str) -> str:
@@ -28,7 +28,7 @@ Image.MAX_IMAGE_PIXELS = 50_000_000
MAX_DOWNLOAD_BYTES = 20 * 1024 * 1024
DOWNLOAD_TIMEOUT = 20.0
USER_AGENT = "signal-cal-bot/0.1 (iCalendar to Signal bridge)"
USER_AGENT = "sigcal-bot/0.1 (iCalendar to Signal bridge)"
@dataclass(frozen=True)
@@ -451,7 +451,7 @@ class Bot:
"https://tinyurl.com/api-create.php",
params={"url": url},
timeout=8,
headers={"User-Agent": "signal-cal-bot/0.1"},
headers={"User-Agent": "sigcal-bot/0.1"},
)
if response.status_code == 200 and response.text.strip().startswith("http"):
short = response.text.strip()
@@ -472,7 +472,7 @@ class Bot:
return
try:
self.sender.send(
f"signal-cal-bot alive \u2014 {self.store.count_events()} events in the window",
f"sigcal-bot alive \u2014 {self.store.count_events()} events in the window",
[self.watchdog.recipient],
text_mode=self.config.signal.text_mode,
)
@@ -63,7 +63,7 @@ class Watchdog:
self._last_alert[key] = now
try:
self.sender.send(
f"\u26a0\ufe0f signal-cal-bot\n{text}",
f"\u26a0\ufe0f sigcal-bot\n{text}",
[self.recipient],
text_mode=self.text_mode,
)
+1 -1
View File
@@ -6,7 +6,7 @@ from __future__ import annotations
from datetime import datetime, timezone
from pathlib import Path
from signal_cal_bot.expand import parse_events
from sigcal_bot.expand import parse_events
FIXTURE = Path(__file__).parent / "fixtures" / "tec-like.ics.txt"
+2 -2
View File
@@ -8,8 +8,8 @@ from pathlib import Path
import httpx
from signal_cal_bot.feed import Feed, FeedResponse, normalize_feed_url
from signal_cal_bot.store import Store
from sigcal_bot.feed import Feed, FeedResponse, normalize_feed_url
from sigcal_bot.store import Store
NOW = datetime(2026, 11, 18, 12, 0, tzinfo=timezone.utc)
EMPTY_FEED = b"BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:-//test//EN\r\nEND:VCALENDAR\r\n"
+3 -3
View File
@@ -6,9 +6,9 @@ from __future__ import annotations
from datetime import datetime, timezone
from zoneinfo import ZoneInfo
from signal_cal_bot.config import FormatConfig
from signal_cal_bot.expand import Event
from signal_cal_bot.format import (
from sigcal_bot.config import FormatConfig
from sigcal_bot.expand import Event
from sigcal_bot.format import (
find_postcode,
format_hashtags,
format_time_range,
+2 -2
View File
@@ -8,8 +8,8 @@ import io
import httpx
from PIL import Image
from signal_cal_bot.config import ImagesConfig
from signal_cal_bot.images import ImageService
from sigcal_bot.config import ImagesConfig
from sigcal_bot.images import ImageService
def make_service(tmp_path, **overrides) -> ImageService:
+6 -6
View File
@@ -9,7 +9,7 @@ from zoneinfo import ZoneInfo
import httpx
from signal_cal_bot.config import (
from sigcal_bot.config import (
AnnounceConfig,
CalendarConfig,
Config,
@@ -20,17 +20,17 @@ from signal_cal_bot.config import (
SignalConfig,
WatchdogConfig,
)
from signal_cal_bot.expand import Event
from signal_cal_bot.feed import Feed, FeedResponse, normalize_feed_url
from signal_cal_bot.scheduler import (
from sigcal_bot.expand import Event
from sigcal_bot.feed import Feed, FeedResponse, normalize_feed_url
from sigcal_bot.scheduler import (
Bot,
clamp_send_at,
in_window,
next_window_start,
reminder_time,
)
from signal_cal_bot.store import PageInfo, Store
from signal_cal_bot.watchdog import Watchdog
from sigcal_bot.store import PageInfo, Store
from sigcal_bot.watchdog import Watchdog
LONDON = ZoneInfo("Europe/London")
UTC = timezone.utc