Make the dashboard pip-installable#133
Merged
Merged
Conversation
- 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.
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
Make the Dashboard installable via pip so users can run
dvoacap-dashboardafterpip install dvoacap[dashboard]without cloning the repo.Dashboard/intosrc/dvoacap/dashboard/so it ships in the wheel.paths.pymodule that splits packaged static assets (HTML) from a runtime data directory (resolved from--data-dir/$DVOACAP_DATA_DIR/ cwd).dvoacap-dashboardconsole script (cli.py) that wires the--data-dirflag into the environment before launching the Flask server.src.dvoacap.*/sys.pathhacks to properdvoacap.*and relative imports.package-datainpyproject.toml.Dashboard/server.py,Dashboard/generate_predictions.py, andDashboard/transform_data.pyas deprecation-warning shims that forward to the new package, so existingpython Dashboard/server.pyworkflows keep working.Acceptance criteria
A user on a clean machine who runs:
…from inside a clone of the repo gets a working dashboard at
localhost:8000.A user on a clean machine who runs:
…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.pyfrom the repo root) continues to work.Test plan
pip install -e ".[dashboard]"in a fresh venv succeeds.dvoacap-dashboard --helpresolves and prints argparse help.dvoacap-dashboard --data-dir /tmp/dash-data --skip-auto-gen --port 8765starts;GET /returns the bundleddashboard.html(200, ~162 kB) and/api/healthreturns healthy JSON.python Dashboard/server.py --skip-auto-gen --port 8766still starts the server and emits the expectedDeprecationWarning.from dvoacap.dashboard import server, generate_predictions, transform_data, generate_propagation_maps, mode_presets, paths, clisucceeds in the installed venv; bundleddashboard.htmlis found viaget_static_file.--skip-auto-gen=Falseprediction generation against live solar data sources (not run; requires network and ~minutes).Out of scope
~/.dvoacap/user dirs, config file scaffolding, externalisingdvoacap_wrapper.pystation config (a TODO note flags this).docker-compose.ymlupdates (still referenceDashboard/server.pybut work via the shim).https://claude.ai/code/session_01PLeFRjjJUKnUAjA5imhsZz
Generated by Claude Code