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

Remove language_version for pre-commit #2430

Merged
merged 2 commits into from Aug 18, 2021

Commits on Aug 16, 2021

  1. Remove language_version for pre-commit

    At my company, we set the Python version in `default_language_version`
    in each repo's `.pre-commit-config.yaml`,
    so that all hooks are running with the same Python version.
    
    However, this currently doesn't work for black,
    as the `language_version` specified here
    in the upstream `.pre-commit-hooks.yaml` takes precedence.
    Currently, this requires us to manually set `language_version`
    specifically for black,
    duplicating the value from `default_language_version`.
    The failure mode otherwise is subtle -
    black works most of the time,
    but try to add a walrus operator and it suddenly breaks!
    
    Given that black's `setup.py` already has `python_requires>=3.6.2`,
    specifying that `python3` must be used here isn't needed
    as folks inadvertently using Python 2 will get hook-install-time failures anyways.
    Remove the `language_version` from these upstream hook configs
    so that users of black are able to use `default_language_version`
    and have it apply to all their hooks, black included.
    
    Example `.pre-commit-config.yaml` before:
    ```
    default_language_version:
      python: python3.8
    repos:
    -   repo: https://github.com/psf/black
        rev: 21.7b0
        hooks:
        -   id: black
            language_version: python3.8
    ```
    
    After:
    ```
    default_language_version:
      python: python3.8
    repos:
    -   repo: https://github.com/psf/black
        rev: 21.7b0
        hooks:
        -   id: black
    ```
    aneeshusa committed Aug 16, 2021
    Copy the full SHA
    2135def View commit details
    Browse the repository at this point in the history

Commits on Aug 18, 2021

  1. Add changelog entry

    aneeshusa committed Aug 18, 2021
    Copy the full SHA
    88ca794 View commit details
    Browse the repository at this point in the history