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

Pre commit instructions #170

Merged
merged 6 commits into from
Aug 27, 2018
Merged

Pre commit instructions #170

merged 6 commits into from
Aug 27, 2018

Conversation

cicdw
Copy link
Member

@cicdw cicdw commented Aug 23, 2018

Adds instructions for installing pre-commit pre-push hooks.

Closes #154

@cicdw cicdw requested a review from jlowin as a code owner August 23, 2018 20:03
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
Copy link
Member

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?

Copy link
Member Author

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
```
Copy link
Member

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.

Copy link
Member Author

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.
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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.

@jlowin
Copy link
Member

jlowin commented Aug 25, 2018

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.

@cicdw cicdw merged commit 785f6a8 into master Aug 27, 2018
@cicdw cicdw deleted the pre-commit branch August 27, 2018 13:48
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

Successfully merging this pull request may close these issues.

2 participants