tmt icon indicating copy to clipboard operation
tmt copied to clipboard

Add `warnings.deprecated`

Open LecrisUT opened this issue 1 year ago • 1 comments

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

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

Depends-on #3059, #3117, ~~BGZ#2295924~~

LecrisUT avatar Jun 29 '24 19:06 LecrisUT

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)

LecrisUT avatar Jun 29 '24 19:06 LecrisUT

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?

LecrisUT avatar Aug 21 '24 12:08 LecrisUT

/packit build

martinhoyer avatar Aug 21 '24 17:08 martinhoyer

/packit test

martinhoyer avatar Aug 22 '24 11:08 martinhoyer

/packit build

happz avatar Aug 27 '24 12:08 happz

Unrelated failures, merging.

happz avatar Aug 27 '24 13:08 happz