Skip to content
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

chore: Deprecate legacy filter #8001

Closed
wants to merge 2 commits into from
Closed

Conversation

vblagoje
Copy link
Member

@vblagoje vblagoje commented Jul 9, 2024

Why:

This update aims to encourage users to transition to a new filter syntax by introducing a deprecation warning for the old syntax. This preemptive measure ensures a smoother transition before the old syntax is removed in an upcoming release, thereby maintaining code compatibility and reducing future technical debt.

What:

  • Added an import statement for the warnings module in filters.py.
  • Inserted a DeprecationWarning in the convert function indicating the use of deprecated filter syntax.

How can it be used:

  • Deprecation Warning: When the convert function is called with the old filter syntax, a warning message will inform users about the deprecation, encouraging them to update their code.

How did you test it:

  • Added a deprecation warning which inherently doesn't disrupt functionality.

Notes for the reviewer:

  • Verify that the deprecation warning appropriately triggers when old syntax is used.
  • Ensure the message is clear and directs users to the documentation for the new syntax.

@vblagoje vblagoje requested review from a team as code owners July 9, 2024 08:17
@vblagoje vblagoje requested review from dfokina and davidsbatista and removed request for a team July 9, 2024 08:17
@github-actions github-actions bot added the type:documentation Improvements on the docs label Jul 9, 2024
@vblagoje vblagoje requested a review from silvanocerza July 9, 2024 08:17
@vblagoje vblagoje added this to the 2.3.0 milestone Jul 9, 2024
@coveralls
Copy link
Collaborator

Pull Request Test Coverage Report for Build 9853471364

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.003%) to 90.019%

Files with Coverage Reduction New Missed Lines %
utils/filters.py 2 98.65%
Totals Coverage Status
Change from base Build 9853347868: 0.003%
Covered Lines: 6782
Relevant Lines: 7534

💛 - Coveralls

@@ -214,6 +215,12 @@ def convert(filters: Dict[str, Any]) -> Dict[str, Any]:
}
```
"""
warnings.warn(
Copy link
Contributor

@davidsbatista davidsbatista Jul 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: we could link to the doc/api with the new syntax

Copy link
Contributor

@davidsbatista davidsbatista left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - just a small suggestion

@vblagoje
Copy link
Member Author

vblagoje commented Jul 9, 2024

@dfokina do we have a page already where we describe the new filters?

@dfokina
Copy link
Contributor

dfokina commented Jul 9, 2024

@vblagoje Are these the old filters? https://docs.haystack.deepset.ai/docs/metadata-filtering and if so, what changed?

@vblagoje
Copy link
Member Author

vblagoje commented Jul 9, 2024

@vblagoje Are these the old filters? https://docs.haystack.deepset.ai/docs/metadata-filtering and if so, what changed?

No these are the new ones, thanks @dfokina 🙏

@vblagoje
Copy link
Member Author

vblagoje commented Jul 9, 2024

@dfokina while at it do we have a policy (practice) to link to docs page from warnings arising in source code? I'm not finding such instances in the code....

@davidsbatista
Copy link
Contributor

@vblagoje I also don't know if it's a policy, it was just a nit/suggestion

@vblagoje
Copy link
Member Author

vblagoje commented Jul 9, 2024

@vblagoje I also don't know if it's a policy, it was just a nit/suggestion

Right I agree, no problem, it is important to be consistent in these warnings, that's why I wanted to ask @dfokina so we know for the future.

@vblagoje
Copy link
Member Author

vblagoje commented Jul 9, 2024

Ah this PR is outdated now with #8004
@shadeMe I'll mark #8004 with 2.3.0 milestone, cool?

@vblagoje vblagoje closed this Jul 9, 2024
@dfokina
Copy link
Contributor

dfokina commented Jul 9, 2024

@vblagoje I personally think it's useful to link to current docs from these warnings, but let's see case-by-case where it makes sense, and then make it a policy, if it's useful everywhere :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:documentation Improvements on the docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants