Repository navigation
Deprecates the best-of-half-year-mid-quarter VDB convention - #57
Merged
Merged
Conversation
Wraps existing best-of convention tests in pytest.warns and adds tests that the convention emits one DeprecationWarning attributed to the caller, and that other conventions do not warn. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Emits a DeprecationWarning, attributed to the user's call, from vdb_schedule and EnergyProject.depreciation_vdb. The compiler silences the vdb_schedule warning so one user action warns once. Results are unchanged; removal is planned for 1.0. Co-Authored-By: Claude Opus 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.
Closes #19
Deprecation pattern
This is DCAF's first deprecation, so it also sets the pattern for later ones.
convention="best-of-half-year-mid-quarter"now emits aDeprecationWarningthrough an inlinewarnings.warn(msg, DeprecationWarning, stacklevel=2). There is no helper and no@warnings.deprecateddecorator, which keeps Python 3.11 support.stacklevelpoints at the user's own call line, so Python's default filters show the warning to script users. Those filters only showDeprecationWarningwhen it is attributed to__main__.vdb_scheduleandEnergyProject.depreciation_vdb, with one shared message. It says:"half-year"or"mid-quarter", after applying the 40% rule yourself;conventiondocstrings carry a.. deprecated:: 0.3.0directive. Thevaluation_rateandvaluation_datedocstrings say they go away with it.vdb_scheduleinsidewarnings.catch_warnings()withDeprecationWarningignored.VDBConventionkeeps the value, so type checking doesn't break.Tests
vdb_scheduleand through the builder. Throughanalyze()it warns exactly once, attributed to the caller's file."none","half-year"and"mid-quarter"don't warn.pytest.warnsand their assertions are unchanged.Release notes
Deprecated:
convention="best-of-half-year-mid-quarter"invdb_scheduleandEnergyProject.depreciation_vdbnow emits aDeprecationWarningand will be removed in 1.0. Apply the IRS 40% rule yourself and pass"half-year"or"mid-quarter". Thevaluation_rateandvaluation_dateparameters exist only for this convention and will be removed with it.Result changes
None.
🤖 Generated with Claude Code