-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Pre commit instructions #170
Conversation
README.md
Outdated
Merging to master in Prefect requires your code to pass [black](https://github.com/ambv/black). This can be easy to forget when developing, and for that reason some developers may choose to install a pre-push hook for black, as follows: | ||
``` | ||
pip install pre-commit # installs pre-commit package | ||
pre-commit install --hook-type pre-push # creates necessary git hook files |
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.
Does this require being in root directory?
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.
Ah, yes I think it might actually. Will update
README.md
Outdated
language_version: python3 | ||
types: [python] | ||
EOF | ||
``` |
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.
After doing this, git tracks this file (.pre-commit-hooks.yaml
) -- I suggest committing it to the repo, and just referencing it, or adding it to .gitignore
. Personally I vote for committing it.
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.
Good call; I was slightly concerned this wouldn't allow for further hook customization, but I think you can add a higher level config (outside the repo) for additional hooks.
README.md
Outdated
types: [python] | ||
EOF | ||
``` | ||
Now, you won't be allowed to `git push` without passing black. |
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 it too aggressive to run black and actually modify files, rather than just create an error with --check
?
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.
It's aggressive, but probably not too aggressive - it is required after all.
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.
Cool, I'm for this then. After all, users would be opting-in to this functionality by setting up pre-commit.
Commenting for posterity: a new version of cloudpickle introduced an issue (described in cloudpipe/cloudpickle#193) that necessitated pinning cloudpickle's version in this PR, which is where it was discovered. |
Adds instructions for installing
pre-commit pre-push
hooks.Closes #154