Rename to rainlog, use XDG default DB location, add migrate command #7
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The package has three problems with its current identity and storage defaults:
The name
weather-toolsis generic and already taken on PyPI under a different project. The new namerainlogis available and accurately describes what the tool does.The default DB location is the current working directory (
./MyWeather.sqlite). This is fragile — runningrainlogfrom different directories silently creates separate databases.The DB filename
MyWeather.sqlitereflects the project's old identity.This issue tracks three related changes:
weather-tools→rainlog,src/weather_tools/→src/rainlog/, CLI commandrain→rainlog, bumprequires-pythonto>=3.11~/.local/share/rainlog/rainlog.sqliteviaplatformdirs;Database.__init__creates the directory on first userainlog migrate [--db-dir PATH]to copyMyWeather.sqlitefrom an old location to the new default atomicallyFindings
noxfile.pyalready tests Python 3.11–3.14 only — bumpingrequires-pythonto>=3.11aligns the metadata with the existing test matrix.platformdirs4.5.1 is already a transient dependency via Textual; making it direct pins it explicitly.migrateusesLEGACY_DB_FILE_NAME = "MyWeather.sqlite"as the hard-coded source name andDEFAULT_DB_DIR / DEFAULT_DB_FILE_NAMEas the destination — no ambiguity on either end.NamedTemporaryFilein the destination directory, thenPath.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, updatepyproject.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.1as a direct dep. Update__init__.py:DEFAULT_DB_FILE_NAME = "rainlog.sqlite", addLEGACY_DB_FILE_NAME, addDEFAULT_DB_DIR. Wiredb_dir.mkdir()intoDatabase.__init__. UpdateCommon.db_dirdefault. Update remaining docs (MyWeather.sqlite→rainlog.sqlite). 5 new tests intests/test_defaults.py.Task 3 —
rainlog migratecommandImplement
_migrate_db(source, destination)helper andmigrate(db_dir=Path("."))Cyclopts subcommand. Source-missing and destination-exists both abort withSystemExit. 7 new tests intests/test_migrate.py(includingmonkeypatchofDEFAULT_DB_DIRfor controllable destination).