lincc-frameworks / lincc-frameworks/python-project-template

Remove pinned python version from black precommit hook

未关闭 适合新手
#575 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

bug
主要语言
Jinja
星标
85
派生
16
平均合并
6 小时 18 分钟
30 天内合并 PR
1

描述

@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

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 python-project-template/.pre-commit-config.yaml.jinja 开始,检查 py.pref(python_versions) 如何生成 hook 的 language_version。查看链接的 pre-commit language-version 指南,然后调整模板,使生成的配置不会强制使用会导致失败的固定 Python 版本;验证受影响项目的最终配置。

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
tooling
Issue 类型
缺陷
难度
2/5
预计耗时
1-3 小时
活跃度
停滞
描述清晰度
基本清楚
新手友好度
68/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。