Rename to rainlog, use XDG default DB location, add migrate command #7

Closed
opened 2026-07-01 04:44:08 +00:00 by coding-agent-marvin8 · 1 comment
coding-agent-marvin8 commented 2026-07-01 04:44:08 +00:00 (Migrated from codeberg.org)

The package has three problems with its current identity and storage defaults:

  1. The name weather-tools is generic and already taken on PyPI under a different project. The new name rainlog is available and accurately describes what the tool does.

  2. The default DB location is the current working directory (./MyWeather.sqlite). This is fragile — running rainlog from different directories silently creates separate databases.

  3. The DB filename MyWeather.sqlite reflects the project's old identity.

This issue tracks three related changes:

  • Rename: weather-toolsrainlog, src/weather_tools/src/rainlog/, CLI command rainrainlog, bump requires-python to >=3.11
  • XDG default: change default DB to ~/.local/share/rainlog/rainlog.sqlite via platformdirs; Database.__init__ creates the directory on first use
  • Migration: add rainlog migrate [--db-dir PATH] to copy MyWeather.sqlite from an old location to the new default atomically
The package has three problems with its current identity and storage defaults: 1. The name `weather-tools` is generic and already taken on PyPI under a different project. The new name `rainlog` is available and accurately describes what the tool does. 2. The default DB location is the current working directory (`./MyWeather.sqlite`). This is fragile — running `rainlog` from different directories silently creates separate databases. 3. The DB filename `MyWeather.sqlite` reflects the project's old identity. This issue tracks three related changes: - Rename: `weather-tools` → `rainlog`, `src/weather_tools/` → `src/rainlog/`, CLI command `rain` → `rainlog`, bump `requires-python` to `>=3.11` - XDG default: change default DB to `~/.local/share/rainlog/rainlog.sqlite` via `platformdirs`; `Database.__init__` creates the directory on first use - Migration: add `rainlog migrate [--db-dir PATH]` to copy `MyWeather.sqlite` from an old location to the new default atomically
coding-agent-marvin8 commented 2026-07-01 04:44:26 +00:00 (Migrated from codeberg.org)

Findings

  • noxfile.py already tests Python 3.11–3.14 only — bumping requires-python to >=3.11 aligns the metadata with the existing test matrix.
  • platformdirs 4.5.1 is already a transient dependency via Textual; making it direct pins it explicitly.
  • migrate uses LEGACY_DB_FILE_NAME = "MyWeather.sqlite" as the hard-coded source name and DEFAULT_DB_DIR / DEFAULT_DB_FILE_NAME as the destination — no ambiguity on either end.
  • The atomic copy strategy: write to a NamedTemporaryFile in the destination directory, then Path.rename() — atomic on the same filesystem, safe on interrupt.

Plan of attack

Task 1 — Package rename (no behaviour change)
Rename src/weather_tools/src/rainlog/, update all imports in source and tests, update pyproject.toml (name, entry point, requires-python), mkdocs.yml, noxfile.py, CLAUDE.md, README.md, and all docs markdown files. Verified by the existing 56-test suite.

Task 2 — XDG defaults + DB filename
Add platformdirs~=4.5.1 as a direct dep. Update __init__.py: DEFAULT_DB_FILE_NAME = "rainlog.sqlite", add LEGACY_DB_FILE_NAME, add DEFAULT_DB_DIR. Wire db_dir.mkdir() into Database.__init__. Update Common.db_dir default. Update remaining docs (MyWeather.sqliterainlog.sqlite). 5 new tests in tests/test_defaults.py.

Task 3 — rainlog migrate command
Implement _migrate_db(source, destination) helper and migrate(db_dir=Path(".")) Cyclopts subcommand. Source-missing and destination-exists both abort with SystemExit. 7 new tests in tests/test_migrate.py (including monkeypatch of DEFAULT_DB_DIR for controllable destination).

## Findings - `noxfile.py` already tests Python 3.11–3.14 only — bumping `requires-python` to `>=3.11` aligns the metadata with the existing test matrix. - `platformdirs` 4.5.1 is already a transient dependency via Textual; making it direct pins it explicitly. - `migrate` uses `LEGACY_DB_FILE_NAME = "MyWeather.sqlite"` as the hard-coded source name and `DEFAULT_DB_DIR / DEFAULT_DB_FILE_NAME` as the destination — no ambiguity on either end. - The atomic copy strategy: write to a `NamedTemporaryFile` in the destination directory, then `Path.rename()` — atomic on the same filesystem, safe on interrupt. ## Plan of attack **Task 1 — Package rename (no behaviour change)** Rename `src/weather_tools/` → `src/rainlog/`, update all imports in source and tests, update `pyproject.toml` (name, entry point, `requires-python`), `mkdocs.yml`, `noxfile.py`, `CLAUDE.md`, `README.md`, and all docs markdown files. Verified by the existing 56-test suite. **Task 2 — XDG defaults + DB filename** Add `platformdirs~=4.5.1` as a direct dep. Update `__init__.py`: `DEFAULT_DB_FILE_NAME = "rainlog.sqlite"`, add `LEGACY_DB_FILE_NAME`, add `DEFAULT_DB_DIR`. Wire `db_dir.mkdir()` into `Database.__init__`. Update `Common.db_dir` default. Update remaining docs (`MyWeather.sqlite` → `rainlog.sqlite`). 5 new tests in `tests/test_defaults.py`. **Task 3 — `rainlog migrate` command** Implement `_migrate_db(source, destination)` helper and `migrate(db_dir=Path("."))` Cyclopts subcommand. Source-missing and destination-exists both abort with `SystemExit`. 7 new tests in `tests/test_migrate.py` (including `monkeypatch` of `DEFAULT_DB_DIR` for controllable destination).
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
marvin8/rainlog#7
No description provided.