- Access package resources via
wxvx.util.resource()orresource_path(). - Raise
WXVXErrorfor domain errors; log tracebacks at debug level; use descriptive error messages. - Keep module ownership aligned with the current layout:
wxvx.configowns config models and config validation helpers.wxvx.variablesownsVarMetaand dataset/variable manipulation logic.wxvx.workflowowns workflow-only protocols/enums such asNamedandSource.wxvx.utilowns shared enums/utilities such asDataFormat,ToGridVal,TruthType, resource helpers, and generic helpers.- Use Python's
loggingmodule; avoid print statements. - Use
snake_casenames for functions/variables,PascalCasefor classes,UPPER_CASEfor constants/Enums. - Use type hints in all Python code; run
make typecheckfor verification; useTYPE_CHECKINGfor circular imports. - Follow observed patterns in the codebase.
- Do not
git commitanything unless instructed to do so. - Always ask the developer questions if you have doubts.
- Treat assertions used after schema validation as internal invariants; user-facing validation errors should raise
WXVXErrorinstead.
- Use
make formatto enforce project rules for import order and general style. - Format
.jsonand.jsonschemadocuments by runningmake format(which callsjq). - Format code by running
make format(which callsruff) before running tests. - Format docstrings by running
make format(which callsdocformatter); use triple-quoted strings for module/class/function docs. - Use lexicographical ordering for functions in modules, methods in classes, keys in dictionaries, etc. Unless there's a good reason to do otherwise: alphabetize.
- Organize unit tests under
src/wxvx/tests/; mock withunittest.mock. - In general, iterate by 1. editing code, 2. running
make format && make test, and 3. fixing any reported errors. - If
make testreports errors, one of the more specific commandsmake lint,make typecheck, ormake unittestcan be run to validate fixes after linting, typechecking, or unit testing, respectively, have failed. - Feel free to consult
src/pyproject.toml, the top-levelMakefile, andrecipe/run_test.shto see how the project configures and calls code quality tools, and then make direct calls to those tools yourself using the same settings.