-
Notifications
You must be signed in to change notification settings - Fork 16k
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
all: Add pre-commit hook #26993
all: Add pre-commit hook #26993
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
38fa568
to
5445261
Compare
5445261
to
80f0687
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm lightly against this and open to being convinced. In general, I feel like encouraging small commits (even with lint/format errors) is good, even if it means running make format
at the end.
Should we instead document how to add it for people who want it?
Using the pre commit hook is opt-in. |
in that case could you
|
OK but that makes it less discoverable. People used to pre-commit that would see the file in the root directly know they can use it. Otherwise they have to read the setup doc which I believe most of the time they won't do (I didn't do it when starting contributing to LangChain, I saw a |
given the lack of engagement from folks here or in issues/discussions on precommit hooks I'm going to close this - it increases maintenance surface area (e.g. devcontainers and docker stuff that is stale now) happy to look into it again as part of a broader contributor experience sprint. agreed figuring out linting/formatting could be easier. don't think hardcoding some of the libraries like this is the way. |
have seen enough engagement here in the last few weeks that it's probably worth it. Some interesting learnings though
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a way we can include the partners/ directories as well? Ideally in an auto-detected manner - ideally would extend to the main libs too. Not sure if this is possible in precommit / how much additional scripting would be needed. If helpful I could try to make the script at check_diff.py
work for checking for directory changes in the same way we do in CI
.pre-commit-config.yaml
Outdated
name: format standard-tests | ||
language: system | ||
entry: make -C libs/standard-tests format | ||
files: ^libs/standard-tests/(langchain_standard_tests|tests)/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might be worth adding the whole directory because changes to pyproject.toml/poetry.lock/makefile could make changes too, and this is what we detect in CI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. I'll update
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Yes, I'll add them. |
Done |
This calls
make format
on projects that have modified files.So
poetry install --with lint
must have been done for those projects.