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

[Docos] Add new FAQ entry documenting integration with Ruff. Q: "Why does Ruff hate @beartype?" A: "Dogs bark at bears." #326

Open
crypdick opened this issue Feb 15, 2024 · 1 comment

Comments

@crypdick
Copy link

When using Ruff, sometime there are false positives for F722 errors. The fix is to tell Ruff that the imports from beartype.typing should be treated as aliases for the typing module by adding a section in pyproject.toml:

[tool.ruff.lint]
typing-modules = ["beartype.typing"]
@leycec
Copy link
Member

leycec commented Feb 16, 2024

Gah!!! Thanks so much for the heads up, @crypdick. Phenomenal username, btw. Simply phenomenal.

Honestly, this is kinda terrible. I mean, it's great that there's a simple fix that we should now document with a new FAQ entry. But... it's terrible that literally everybody leveraging @beartype will now need to copy-paste the same boilerplate one-liner into their pyproject.toml just to avoid false positives from the fastest (and thus best) Python linter. That's terrible. In fact, that's so terrible it's almost terribad. </gasp>

There's gotta be a better way. It'd be amazing if @beartype could automate this away for everybody. Does Ruff support plugins? Probably not, huh. Would Ruff itself be willing to ship this alias within the main Ruff codebase? Probably not, huh.

Thus, we're stuck. I cry like a lost kitten in the rain. 😿

@leycec leycec changed the title Document integration with Ruff [Docos] Add new FAQ entry documenting integration with Ruff. Q: "Why does Ruff hate @beartype?" A: "Dogs bark at bears." Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants