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

core: Add various ruff rules #26836

Merged
merged 4 commits into from
Oct 7, 2024
Merged

Conversation

cbornet
Copy link
Collaborator

@cbornet cbornet commented Sep 24, 2024

Adds

  • ASYNC
  • COM
  • DJ
  • EXE
  • FLY
  • FURB
  • ICN
  • INT
  • LOG
  • NPY
  • PD
  • Q
  • RSE
  • SLOT
  • T10
  • TID
  • YTT

Copy link

vercel bot commented Sep 24, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
langchain ⬜️ Ignored (Inspect) Visit Preview Oct 7, 2024 10:27pm

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. Ɑ: core Related to langchain-core labels Sep 24, 2024
@cbornet cbornet force-pushed the ruff-rules-multi branch 4 times, most recently from 30b57a4 to 540635a Compare September 26, 2024 09:56
@@ -291,9 +292,14 @@ async def _render_mermaid_using_pyppeteer(
img_bytes = await page.screenshot({"fullPage": False})
await browser.close()

def write_to_file(path: str, bytes: bytes) -> None:
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this from a ruff rule?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes because we are in an async context so we can’t use blocking open() and write() directly (ruff rule ASYNC)

@eyurtsev
Copy link
Collaborator

@cbornet looks good -- what fraction of these have corresponding auto-formatting if any?

@cbornet
Copy link
Collaborator Author

cbornet commented Sep 26, 2024

Auto-fix is mostly raise SomeError() -> raise SomeError.
The rest (only 6 fixes) is manual.

@cbornet cbornet force-pushed the ruff-rules-multi branch 5 times, most recently from f04a6af to 44566c4 Compare September 30, 2024 16:16
@efriis efriis self-assigned this Sep 30, 2024
@efriis
Copy link
Member

efriis commented Oct 7, 2024

DJ - why do we need django lint rules?

TID - nice! looks like we can enforce some of the import greps with this instead of the scripts

@efriis efriis enabled auto-merge (squash) October 7, 2024 22:22
@efriis efriis merged commit 16f5fdb into langchain-ai:master Oct 7, 2024
85 checks passed
@cbornet cbornet deleted the ruff-rules-multi branch October 8, 2024 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ɑ: core Related to langchain-core size:L This PR changes 100-499 lines, ignoring generated files.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants