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

Remove pinned python version from black precommit hook

Open Beginner friendly
#575 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Jinja
Stars
85
Forks
16
Avg merge
6h 18m
Merged PRs (30d)
1

Description

@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**):
```jinja
{%- 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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with python-project-template/.pre-commit-config.yaml.jinja and inspect how py.pref(python_versions) produces the hook's language_version. Check the linked pre-commit language-version guidance, then adjust the template so generated configurations do not impose a failing pinned Python version; verify the resulting configuration for affected projects.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.