Skip to content

Make the dashboard pip-installable#133

Merged
skyelaird merged 4 commits into
mainfrom
claude/dashboard-pip-installable-5n9LJ
May 1, 2026
Merged

Make the dashboard pip-installable#133
skyelaird merged 4 commits into
mainfrom
claude/dashboard-pip-installable-5n9LJ

Conversation

@skyelaird

Copy link
Copy Markdown
Owner

Summary

Make the Dashboard installable via pip so users can run dvoacap-dashboard after pip install dvoacap[dashboard] without cloning the repo.

  • Move Dashboard/ into src/dvoacap/dashboard/ so it ships in the wheel.
  • Add a paths.py module that splits packaged static assets (HTML) from a runtime data directory (resolved from --data-dir / $DVOACAP_DATA_DIR / cwd).
  • Add a dvoacap-dashboard console script (cli.py) that wires the --data-dir flag into the environment before launching the Flask server.
  • Convert the moved Dashboard files from src.dvoacap.* / sys.path hacks to proper dvoacap.* and relative imports.
  • Register HTML/JSON/MD/sh assets as package-data in pyproject.toml.
  • Keep Dashboard/server.py, Dashboard/generate_predictions.py, and Dashboard/transform_data.py as deprecation-warning shims that forward to the new package, so existing python Dashboard/server.py workflows keep working.

Acceptance criteria

A user on a clean machine who runs:

pip install -e ".[dashboard]"
dvoacap-dashboard

…from inside a clone of the repo gets a working dashboard at localhost:8000.

A user on a clean machine who runs:

pip install "dvoacap[dashboard] @ git+https://github.com/skyelaird/dvoacap-python.git"
dvoacap-dashboard --data-dir ~/dvoacap-data

…also gets a working dashboard, with all generated files written to ~/dvoacap-data/ instead of the install location.

The existing Dashboard/ invocation pattern (e.g. python Dashboard/server.py from the repo root) continues to work.

Test plan

  • pip install -e ".[dashboard]" in a fresh venv succeeds.
  • dvoacap-dashboard --help resolves and prints argparse help.
  • dvoacap-dashboard --data-dir /tmp/dash-data --skip-auto-gen --port 8765 starts; GET / returns the bundled dashboard.html (200, ~162 kB) and /api/health returns healthy JSON.
  • python Dashboard/server.py --skip-auto-gen --port 8766 still starts the server and emits the expected DeprecationWarning.
  • from dvoacap.dashboard import server, generate_predictions, transform_data, generate_propagation_maps, mode_presets, paths, cli succeeds in the installed venv; bundled dashboard.html is found via get_static_file.
  • End-to-end --skip-auto-gen=False prediction generation against live solar data sources (not run; requires network and ~minutes).

Out of scope

  • Phase 2 work: ~/.dvoacap/ user dirs, config file scaffolding, externalising dvoacap_wrapper.py station config (a TODO note flags this).
  • PyPI publishing; version stays at 1.0.1.
  • Docker/docker-compose.yml updates (still reference Dashboard/server.py but work via the shim).

https://claude.ai/code/session_01PLeFRjjJUKnUAjA5imhsZz


Generated by Claude Code

claude added 4 commits May 1, 2026 17:02
- Move all Dashboard files (Python modules, HTML, JSON, docs, shell)
  into src/dvoacap/dashboard/, making the dashboard part of the pip
  package rather than a clone-only artefact.
- Add __init__.py turning it into a proper subpackage.
- Add paths.py module that centralises:
    - PACKAGE_DIR for shipped static assets (HTML).
    - get_data_dir() for generated/user data, resolved from
      $DVOACAP_DATA_DIR or the current working directory.
    - get_user_antenna_config() that copies the bundled
      antenna_config.json template into the data dir on first access.
- Convert intra-package imports to relative form (mode_presets,
  paths) and switch dvoacap-engine imports from the old
  src.dvoacap.* / sys.path hack to plain dvoacap.* imports.
- Refactor server.py / generate_predictions.py / transform_data.py /
  generate_propagation_maps.py to look up generated files via the
  data dir rather than Path(__file__).parent. HTML/static files are
  still located via the package dir.
- Server static-file route now serves from the data dir when a file
  exists there, falling back to packaged files.
- Replace subprocess invocations of sibling .py paths with
  python -m dvoacap.dashboard.<module>, run with cwd=data_dir.
- Add a TODO(phase 2) note to dvoacap_wrapper.py flagging that
  station/QTH config will move out of the package.
- Mark the package-local requirements.txt as deprecated; deps now
  come from pyproject.toml's [dashboard] extra.
- Update update_predictions.sh to use the installed module.
- New src/dvoacap/dashboard/cli.py provides an argparse-based shim
  that exports DVOACAP_DATA_DIR before importing the server, so the
  data directory is honoured for the rest of the process.
- Wire it up as a console script in pyproject.toml:
    dvoacap-dashboard = "dvoacap.dashboard.cli:main"
- Register the dashboard's static assets (HTML/JSON/MD/sh/requirements)
  as package-data so they ship in the wheel.
Keep the old python Dashboard/server.py invocation working for users
who haven't updated their workflows. Each shim emits a
DeprecationWarning and forwards to the new package.
- Replace the Dashboard/-folder install recipe with the new pip
  install + dvoacap-dashboard CLI flow.
- Document the --data-dir flag and DVOACAP_DATA_DIR env var.
- Update repo-tree section to reflect that the dashboard now lives
  inside src/dvoacap/, with Dashboard/ kept only as compat shims.
@skyelaird skyelaird marked this pull request as ready for review May 1, 2026 17:16
@skyelaird skyelaird merged commit e2dfa0e into main May 1, 2026
14 checks passed
@skyelaird skyelaird deleted the claude/dashboard-pip-installable-5n9LJ branch May 1, 2026 17:16
@skyelaird skyelaird mentioned this pull request May 1, 2026
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants