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

Add warnings.deprecated #3062

Merged
merged 2 commits into from
Aug 27, 2024
Merged

Add warnings.deprecated #3062

merged 2 commits into from
Aug 27, 2024

Conversation

LecrisUT
Copy link
Contributor

@LecrisUT LecrisUT commented Jun 29, 2024

This is used to add both static type-checking deprecations and run-time as well. For now it requires upgrading typing-extensions to a required conditional dependency, otherwise the dynamic deprecation would not apply (and would require some trickery to make it no-op on non TYPE_CHECKING)

Pull Request Checklist

  • implement the feature
  • write the documentation
  • mention the version
  • include a release note

Depends-on #3059, #3117 (managed without it), BGZ#2295924

@LecrisUT
Copy link
Contributor Author

Great, this is a nice issue with pre-commit running a versioned tmt-lint instead of the current one from source (dependencies are not being updated)

Copy link
Collaborator

@martinhoyer martinhoyer left a comment

Choose a reason for hiding this comment

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

Do you know if we're able to utilize this for informing users about pending/existing deprecations?

Few places with deprecating stuff:

#: Mark the option as deprecated. Instance of :py:class:`Deprecated`

class Deprecated:

def assert_feeling_safe(self, deprecated_in_version: str, subject: str) -> None:

I'm thinking, deprecated decorator, which would accept 'deprecated in' and 'text' args, which would be visible to end user. Like the --feeling-safe, but easily reusable.

.pre-commit-config.yaml Show resolved Hide resolved
@LecrisUT
Copy link
Contributor Author

LecrisUT commented Aug 21, 2024

Do you know if we're able to utilize this for informing users about pending/existing deprecations?

Hmm, would need to mull it over. Easily, no, there is none that I could find when navigating through the usage. The implementation seems to rely on native support for deprecation on click and dataclasses side, so would have to rely on them to figure out how to make a support for type-hinting these.

I'm thinking, deprecated decorator, which would accept 'deprecated in' and 'text' args, which would be visible to end user. Like the --feeling-safe, but easily reusable.

That would require decorators to work on attributes?

@martinhoyer
Copy link
Collaborator

/packit build

@martinhoyer
Copy link
Collaborator

/packit test

docs/releases.rst Outdated Show resolved Hide resolved
@happz happz added the code | style Code style changes not affecting functionality label Aug 22, 2024
@happz happz added this to the 1.36 milestone Aug 22, 2024
@happz happz added status | ready for merge The only missing piece is to do the rebase the current 'main' and let the CI finish. code | no functional change "No Functional Change" intended. Patch should not change tmt's behavior in any way. ci | full test Pull request is ready for the full test execution labels Aug 27, 2024
Signed-off-by: Cristian Le <[email protected]>
Signed-off-by: Cristian Le <[email protected]>
Signed-off-by: Cristian Le <[email protected]>
@happz
Copy link
Collaborator

happz commented Aug 27, 2024

/packit build

@happz
Copy link
Collaborator

happz commented Aug 27, 2024

Unrelated failures, merging.

@happz happz merged commit e402dee into teemtee:main Aug 27, 2024
20 of 22 checks passed
@LecrisUT LecrisUT deleted the feat/deprecated branch October 7, 2024 08:47
The-Mule pushed a commit to The-Mule/tmt that referenced this pull request Oct 14, 2024
Signed-off-by: Cristian Le <[email protected]>
Signed-off-by: Cristian Le <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci | full test Pull request is ready for the full test execution code | no functional change "No Functional Change" intended. Patch should not change tmt's behavior in any way. code | style Code style changes not affecting functionality status | ready for merge The only missing piece is to do the rebase the current 'main' and let the CI finish.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants