Skip to content

Remove pinned python version from black precommit hook #575

@olivialynn

Description

@olivialynn

@camposandro and I have run into this with a couple incubees.

In the precommit template (https://github.com/lincc-frameworks/python-project-template/blob/main/python-project-template/.pre-commit-config.yaml.jinja), we set up the black hook with the following (note the last line, with language_version):

{%- if 'black' in enforce_style %}
    # Analyze the code style and report code that doesn't adhere.
  - repo: https://github.com/psf/black
    rev: 23.7.0
    hooks:
      - id: black-jupyter
        name: Format code using black
        types_or: [python, pyi, jupyter]
        # It is recommended to specify the latest version of Python
        # supported by your project here, or alternatively use
        # pre-commit's default_language_version, see
        # https://pre-commit.com/#top_level-default_language_version
        language_version: python{{ py.pref(python_versions) }}
{%- endif %}

And two users have ended up with some version of language_version: 3.11, which caused errors for them.

We should either remove this line, or make it not do this kind of behavior

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions