Repository navigation
Refactor/package structure - #1
Merged
Merged
Conversation
…ated energy model
Restructure the flat scripts into a proper, open-source-ready Python package with a clean separation between pure numerical functions and the few pieces that hold genuine state. Structure (light-touch OOP per CLAUDE.md — classes only for state/interfaces): - config.py Config dataclass — every tunable in one place, secrets via env - models.py dataclasses: Building, RoofPlane, SystemResult, ScoredHome - geometry/roof/solar/grading — pure functions (trivially testable) - sources/ tiles, buildings, irradiance, regions (all free sources) - storage.py ResultStore — owns the single DuckDB connection + resume ledgers - pipeline.py streaming, parallel, resumable orchestration - cli.py `solargrader run|enrich|map|regrade` subcommands Key improvements: - test_pipeline.py was the de-facto core library; its scoring math moves into the package and its main() becomes examples/validate_single_tile.py. - Removes the setup_db/score_building duplication across files. - Config is passed explicitly into worker processes (picklable), fixing the spawn-time global-override gap. - Heavy optional deps (PDAL, Open3D, pvlib) imported lazily, so the pure modules and tests run with only numpy/shapely/pyproj. Packaging: pyproject.toml (+ setup.py shim for old pip), console entry point, pytest suite for the pure functions, ruff config, GitHub Actions CI, README. Backward-compatible shims keep `python pipeline.py …` etc. working.
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.
No description provided.