psf / psf/black

Is --target-version the minimum or should all be explicitly listed?

Open
#751 16 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C: configuration T: documentation
Dominant language
Python
Stars
41.8k
Forks
2.9k
Avg merge
5d 6h
Merged PRs (30d)
9

Description

With old Black 18.9b0, I had this in pyproject.toml:

[tool.black]
py36 = true

The new Black 19.3b0 warns:

--py36 is deprecated and will be removed in a future version. Use --target-version py36 instead.

The docs say:

  -t, --target-version [py27|py33|py34|py35|py36|py37|py38]
                                  Python versions that should be supported by
                                  Black's output. [default: per-file auto-
                                  detection]
  --py36                          Allow using Python 3.6-only syntax on all
                                  input files.  This will put trailing commas
                                  in function signatures and calls also after
                                  *args and **kwargs. Deprecated; use
                                  --target-version instead. [default: per-file
                                  auto-detection]

I see Black's own pyproject.toml includes:

[tool.black]
target_version = ['py36', 'py37', 'py38']

If I target just py36, does it treat that as a minimum?

Is that the same as ['py36', 'py37', 'py38']?

It recommended to explicitly list all the targetted versions?

Contributor guide

Open the contributing guide

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 by reviewing the target-version and deprecated --py36 documentation, along with Black's pyproject.toml example. Verify how a single target version differs from an explicit list, then update the relevant documentation so the supported behavior and recommendation are unambiguous.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.