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 ruff rules for TYPE_CHECKING (TCH) #3999

Merged
merged 1 commit into from
Oct 4, 2024

Conversation

cbornet
Copy link
Collaborator

@cbornet cbornet commented Oct 3, 2024

No description provided.

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. python Pull requests that update Python code labels Oct 3, 2024
@cbornet cbornet requested a review from ogabrielluiz October 3, 2024 09:38
Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-3999.dmtpw4p5recq1.amplifyapp.com

Copy link
Contributor

@ogabrielluiz ogabrielluiz left a comment

Choose a reason for hiding this comment

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

Wow, I didn't know this existed. This is nice.

LGTM

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Oct 3, 2024
@cbornet cbornet marked this pull request as draft October 4, 2024 09:23
@cbornet
Copy link
Collaborator Author

cbornet commented Oct 4, 2024

Putting this on hold as FastAPI annotations need runtime evaluation and I couldn't make flake8-type-checking.runtime-evaluated-decorators to work.

@cbornet cbornet marked this pull request as ready for review October 4, 2024 13:09
@@ -198,6 +204,11 @@ ignore = [
"ISC001", # Messes with the formatter
]

[tool.ruff.lint.per-file-ignores]
"langflow/api/v1/*" = [
"TCH", # FastAPI needs to evaluate types at runtime
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I had to ignore here. Ideally we would use flake8-type-checking.runtime-evaluated-decorators but I couldn't make it work with fastapi's APIRouter annotations without importing the router from a separate file. This looks like a bug in ruff.

@cbornet cbornet merged commit e2d907f into langflow-ai:main Oct 4, 2024
28 checks passed
@cbornet cbornet deleted the ruff-rules-tch branch October 4, 2024 14:00
diogocabral pushed a commit to headlinevc/langflow that referenced this pull request Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm This PR has been approved by a maintainer python Pull requests that update Python code size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants