Repository navigation
fix: fail tests when srfit calls its own deprecated API #216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
sbillinge
merged 2 commits into
diffpy:main
from
cadenmyers13:fail-on-internal-deprecations
Oct 8, 2026
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| **Added:** | ||
|
|
||
| * The test suite now fails if srfit's own source code calls one of srfit's | ||
| deprecated names, so an internal caller missed during a deprecation is | ||
| caught in CI. | ||
|
|
||
| **Changed:** | ||
|
|
||
| * <news item> | ||
|
|
||
| **Deprecated:** | ||
|
|
||
| * <news item> | ||
|
|
||
| **Removed:** | ||
|
|
||
| * <news item> | ||
|
|
||
| **Fixed:** | ||
|
|
||
| * Creating a ``FitRecipe`` no longer emits a ``DeprecationWarning`` about | ||
| ``pushFitHook``. | ||
| * ``initializeRecipe`` now emits only its own ``DeprecationWarning`` instead of | ||
| also warning about ``resultsDictionary``. | ||
|
|
||
| **Security:** | ||
|
|
||
| * <news item> |
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -849,8 +849,13 @@ def resultsDictionary(results): | |
| dict | ||
| The mapping of result names to their string values. | ||
| """ | ||
| resstr = inputToString(results) | ||
| return _parse_results_dictionary(results) | ||
|
|
||
|
|
||
| def _parse_results_dictionary(results): | ||
| """Remove this function when when resultsDictionary and | ||
| initializeRecipe are removed in 4.0.0.""" | ||
| resstr = inputToString(results) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had to add this function so the new deprecation catcher passed |
||
| rx = { | ||
| "f": r"[+-]? *(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?", | ||
| "n": r"[a-zA-Z_]\w*", | ||
|
|
@@ -892,7 +897,7 @@ def initializeRecipe(recipe, results): | |
| AttributeError | ||
| If no results can be found in ``results``. | ||
| """ | ||
| mpairs = resultsDictionary(results) | ||
| mpairs = _parse_results_dictionary(results) | ||
| if not mpairs: | ||
| raise AttributeError("Cannot find results") | ||
|
|
||
|
|
||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This approach seems like technical debt. The kind of tihng Claude loves but us less so. Are we baking code into our core codebase that will be there forever, just to catch stuff that we did to remove old technical debt? Can't we wjust write scripts that do this, run them, catch all the things, fix the, then delete those scripts? Or rather, have Claude do that...?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sbillinge I actually requested this from claude because this was/is a problem in
diffpy.structure(I think I fixed it but is hasnt been released). An internal call is made to a deprecated function so it emits a deprecation warning that we should've changed which looks bad. I dont view this as technical debt because once all the deprecation work is done and we remove all deprecation markers this can still live here harmlessly. I view this as a safety net to make sure we've changed all internal calls to deprecated functionsThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As for your concern about baking code in, I think we are okay because when the deprecated
resultsDictionaryis removed, the_parse_results_dictionary()won't be used by anything and should also be removed. I see what you're saying about the technical debt here, but I think its worth it. I'd like to think that the person removing this (likely me) will notice this and remove it. I can also add a note to remove that private function whenresultsDictionaryis removed. If more complex changes are required later we can remove it, but I think the safety net is nice for now.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I am ok with it. Shall we make an issue to remove the private function explicitly? I will merge this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I can do that