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 hook for black should be local #909

Closed
imsahil007 opened this issue Sep 30, 2020 · 2 comments
Closed

pre-commit hook for black should be local #909

imsahil007 opened this issue Sep 30, 2020 · 2 comments

Comments

@imsahil007
Copy link
Contributor

While making changes for #908 #906 I noticed that we are using pre-commit hook for Black which is fetched from their Github repo.
If we want to stick to a single version of black we can use a local dependency instead in .pre-commit-config.yaml

-   repo: local
    hooks:
    -   id: black
        name: black
        description: 'Black: The uncompromising Python code formatter'
        entry: black
        language: python
        language_version: python3
        require_serial: true
        types: [python]
        additional_dependencies: ['black==19.3b0']

Though this requires running pip install black running before this.
A better option will be to create a fork for their current repo and use it for the future - which can be done by just changing the git remote to the new one .pre-commit-config.yaml.
They have not updated the documentation about this. But you can read more about this here

@terriko
Copy link
Contributor

terriko commented Oct 5, 2020

Thanks so much for digging in to this. It's kind of surprising that we haven't had more black compatibility questions before this!

@imsahil007
Copy link
Contributor Author

Thanks so much for digging in to this. It's kind of surprising that we haven't had more black compatibility questions before this!

You're welcome!
I think it will be much better if use a particular Python package from https://pypi.org/project/black/ or create a fork of their current repo. This way our black tests won't fail. We can timely update the pre-hook to the stable version by rebasing the fork. And if we just use pip install black we will always point to the stable version from Pypi

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

No branches or pull requests

2 participants