Repository navigation
Move the source into a palmer/ package, tests into tests/, scripts into scripts/ - #13
Merged
Merged
Conversation
…ripts into scripts/
Pure relocation. No function changed; the suite is 1,430 tests before and
after. The repo root goes from ~100 entries to ten.
palmer/ every library module plus trusted_sources.json
scripts/ send_morning, send_reminders, preview_opening,
migrate_profile_prune — run as `python -m scripts.<name>`
tests/ the 51 test files, unchanged apart from imports
pyproject.toml pytest (testpaths, pythonpath=".") and ruff config;
replaces ruff.toml. Tool config only — Palmer is
deployed from requirements.txt and run from the repo
root, not built as a package.
send_reminders.py was both a library (main.py imports send_due_reminders)
and a script, so it becomes palmer/reminders.py with a three-line shim in
scripts/. tickers and wxaudit keep their __main__ blocks inside the package
(`python -m palmer.tickers --audit`, `python -m palmer.wxaudit`).
Imports are absolute (`from palmer import db`, `from palmer.weather import
x`) so import lines and patch strings share one spelling. The 318 patch
targets were rewritten by a pass anchored on `patch(`, `import_module(`
and `__import__(` plus an allow-list of first-party names — never on bare
quoted words, because "home", "weather", "opening" and "morning" are also
payload keys and DB columns.
Hand edits the mechanical pass could not make:
- db._DB_PATH now resolves to the repo root, not inside the package.
- test_sources reads trusted_sources.json beside sources.py rather than
beside itself; test_phantom_history reads the proactive senders' source
from palmer.__file__ instead of bare filenames against the CWD.
- test_scheduler_config's "alerts is gone" assertion imports
palmer.alerts, or it would have passed vacuously for the wrong reason.
- Three tests used __import__("x") to reach a module; with a dotted name
that returns the top-level package, so they use importlib.import_module.
- Procfile: uvicorn palmer.main:app. Commands in CLAUDE.md and README
updated to match.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018QpUhnYC3U7KxF8QCeenfQ
This was referenced Sep 14, 2026
Resolves the freshness-test import conflict and moves the new morning/page tests onto the palmer package paths. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stage 2 of 4 (hygiene → package layout → test consolidation → docs split). Pure relocation: no function changed, and the suite is 1,430 tests before and after. The repo root goes from ~100 entries to ten.
send_reminders.pywas both a library (main.pyimports it) and a script, so it becomespalmer/reminders.pywith a three-line shim inscripts/.from palmer import db) so import lines and patch strings share one spelling. The 318 patch targets were rewritten by a pass anchored onpatch(/import_module(/__import__(plus an allow-list of first-party names — never on bare quoted words, since"home","weather","opening"are also payload keys.db._DB_PATHresolves to the repo root;test_sourcesreads the JSON besidesources.py;test_phantom_historyreads sender source frompalmer.__file__; the "alerts is gone" assertion now importspalmer.alerts(it would otherwise pass vacuously); three__import__("x")sites becameimportlib.import_modulebecause a dotted name returns the top-level package.Procfile→uvicorn palmer.main:app. Commands in CLAUDE.md and README updated.After merging, deploy needs a push:
git pull origin main && git push heroku main, then watchheroku logs --tailfor the boot line and the nine job registrations. The Procfile change is the only production-visible difference.Test plan
ruff check .cleanpytest -q— 1,430 passed, same asmainPALMER_NO_SCHEDULER=1 python -c "import palmer.main, scripts.send_morning, scripts.send_reminders, scripts.preview_opening, scripts.migrate_profile_prune"imports, nothing sentuvicorn palmer.main:appboots locally and answers HTTPimport x/patch("x.…")left in the tree🤖 Generated with Claude Code
https://claude.ai/code/session_018QpUhnYC3U7KxF8QCeenfQ