[ty] Assign lower completions ranking to deprecated functions and classes by Glyphack · Pull Request #23089 · astral-sh/ruff (original) (raw)

@ntBre added the ty

Multi-file analysis & type inference

label

Feb 5, 2026

@AlexWaygood AlexWaygood changed the title[ty] Assign lower rank to deprecated functions and classes [ty] Assign lower completions ranking to deprecated functions and classes

Feb 5, 2026

@Glyphack Glyphack marked this pull request as ready for review

February 5, 2026 16:06

BurntSushi

@Glyphack

This makes the completion rank deprecated functions and classes lower than non deprecated ones. It relies on the @deprecated decorator on the definition.

Fixes astral-sh/ty#2654

@Glyphack

carljm added a commit to Hugo-Polloli/ruff that referenced this pull request

Feb 9, 2026

@carljm

BurntSushi pushed a commit that referenced this pull request

Feb 11, 2026

@Glyphack

…23188)

Summary

Follow up to #23089 this PR assigns lower completion ranking to deprecated names in auto import suggestions. The implementation relies on finding a decorator named deprecated in the source code ton consider that name deprecated.

Fixes astral-sh/ty#2654 for real :)

Test Plan

Added another test case for this.

I could not find an

Here's how the behavior changed:

Before:

abstractc

AbstractAsyncContextManager (module: contextlib)
AbstractBasicAuthHandler (module: urllib.request)
AbstractChildWatcher (module: asyncio)
AbstractContextManager (module: contextlib)
AbstractEventLoopPolicy (module: asyncio)
abstractclassmethod (module: abc)
abstractstaticmethod (module: abc)

After:

AbstractAsyncContextManager (module: contextlib)
AbstractBasicAuthHandler (module: urllib.request)
AbstractContextManager (module: contextlib) (*, 3/7)
AbstractEventLoopPolicy (module: asyncio)
AbstractChildWatcher (module: asyncio)
abstractclassmethod (module: abc)
abstractstaticmethod (module: abc)

KotlinIsland pushed a commit to KotlinIsland/basedpython that referenced this pull request

May 1, 2026

@Glyphack

…23188)

Summary

Follow up to astral-sh/ruff#23089 this PR assigns lower completion ranking to deprecated names in auto import suggestions. The implementation relies on finding a decorator named deprecated in the source code ton consider that name deprecated.

Fixes astral-sh/ty#2654 for real :)

Test Plan

Added another test case for this.

I could not find an

Here's how the behavior changed:

Before:

abstractc

AbstractAsyncContextManager (module: contextlib)
AbstractBasicAuthHandler (module: urllib.request)
AbstractChildWatcher (module: asyncio)
AbstractContextManager (module: contextlib)
AbstractEventLoopPolicy (module: asyncio)
abstractclassmethod (module: abc)
abstractstaticmethod (module: abc)

After:

AbstractAsyncContextManager (module: contextlib)
AbstractBasicAuthHandler (module: urllib.request)
AbstractContextManager (module: contextlib) (*, 3/7)
AbstractEventLoopPolicy (module: asyncio)
AbstractChildWatcher (module: asyncio)
abstractclassmethod (module: abc)
abstractstaticmethod (module: abc)

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

[ Show hidden characters]({{ revealButtonHref }})