Skip to content

Conversation

ntBre
Copy link
Contributor

@ntBre ntBre commented Jun 28, 2025

Summary

Closes #19014 by identifying more field functions from attrs. We already detected these when imported from attrs but not the attr module from the same package. These functions are identical to the attrs versions:

>>> import attrs, attr
>>> attrs.field is attr.field
True
>>> attrs.Factory is attr.Factory
True
>>>

Test Plan

Regression tests based on the issue

@ntBre ntBre added bug Something isn't working rule Implementing or modifying a lint rule labels Jun 28, 2025
Copy link
Contributor

github-actions bot commented Jun 28, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@ntBre ntBre requested a review from dylwil3 June 29, 2025 00:56
@alex-700
Copy link
Contributor

Hi @ntBre !

I think the fix should also include attr.attr and attr.attrib.
https://github.com/python-attrs/attrs/blob/main/src/attr/__init__.py#L33

Also attr.attributes is missing here (see aliases).

ntBre added 2 commits July 3, 2025 09:26
Summary
--

Closes #19014 by identifying more `field` functions from `attrs`. We already
detected these when imported from `attrs` but not the `attr` module from the
same package. These functions are identical to the `attrs` versions:

```pycon
>>> import attrs, attr
>>> attrs.field is attr.field
True
>>> attrs.Factory is attr.Factory
True
>>>
```

Test Plan
--

Regression tests based on the issue
@ntBre ntBre force-pushed the brent/fix-ruf009 branch from 8ab9cbf to bdbeab8 Compare July 3, 2025 13:27
@ntBre
Copy link
Contributor Author

ntBre commented Jul 3, 2025

@alex-700 Thank you very much for catching those and for the links! I think I've covered all of them now!

@ntBre ntBre requested a review from AlexWaygood July 3, 2025 13:29
Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

nice!

@ntBre ntBre merged commit b00f68a into main Jul 3, 2025
35 checks passed
@ntBre ntBre deleted the brent/fix-ruf009 branch July 3, 2025 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working rule Implementing or modifying a lint rule
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RUF009 should allow attr.field(...) call
3 participants