Skip to content

Conversation

@ericsampson
Copy link
Contributor

@ericsampson ericsampson commented Sep 29, 2025

Description

The required-version configuration param supports two different "modes": exact version or major-version-only.
The GitHub Action workflow currently reads this parameter from pyproject.toml when configured with use_pyproject: true in order to determine what version of black to pip install. However, this fails when pyproject.toml is configured with the "major-version-only" format, because it tries to pip install ==MAJOR.

This PR adds code so that when pyproject.toml required-version is using the "major-version-only" format, it will pip install black using the compatibility operator.

Current behavior:

Installing black[colorama]==22...
ERROR: Ignored the following yanked versions: 21.11b0
ERROR: Could not find a version that satisfies the requirement black==22 (from versions: 18.3a0, 18.3a1, 18.3a2, 18.3a3, 18.3a4, 18.4a0, 18.4a1, 18.4a2, 18.4a3, 18.4a4, 18.5b0, 18.5b1, 18.6b0, 18.6b1, 18.6b2, 18.6b3, 18.6b4, 18.9b0, 19.3b0, 19.10b0, 20.8b0, 20.8b1, 21.4b0, 21.4b1, 21.4b2, 21.5b0, 21.5b1, 21.5b2, 21.6b0, 21.7b0, 21.8b0, 21.9b0, 21.10b0, 21.11b1, 21.12b0, 22.1.0, 22.3.0, 22.6.0, 22.8.0, 22.10.0, 22.12.0, 23.1a1, 23.1.0, 23.3.0, 23.7.0, 23.9.0, 23.9.1, 23.10.0, 23.10.1, 23.11.0, 23.12.0, 23.12.1, 24.1a1, 24.1.0, 24.1.1, 24.2.0, 24.3.0, 24.4.0, 24.4.1, 24.4.2, 24.8.0, 24.10.0, 25.1.0, 25.9.0)
ERROR: No matching distribution found for black==22

Checklist - did you ...

  • Implement any code style changes under the --preview style, following the
    stability policy?
  • Add an entry in CHANGES.md if necessary?
  • Add / update tests if necessary?
  • Add new / update outdated documentation?

Co-authored-by: GiGaGon <[email protected]>
@MeGaGiGaGon
Copy link
Collaborator

MeGaGiGaGon commented Sep 29, 2025

Wouldn't this still not work? Reading the docs on ~= it says:

This operator MUST NOT be used with a single segment version number such as ~=1.

I think the correct thing would instead be =={version}.*?

@ericsampson
Copy link
Contributor Author

@MeGaGiGaGon good catch, I always forget that detail. I've updated the code to the recommended pattern thanks.

@cobaltt7 cobaltt7 merged commit be62dea into psf:main Oct 4, 2025
43 checks passed
luketainton pushed a commit to luketainton/roboluke-tasks that referenced this pull request Nov 10, 2025
This PR contains the following updates:

| Package | Change | Age | Confidence |
|---|---|---|---|
| [black](https://github.com/psf/black) ([changelog](https://github.com/psf/black/blob/main/CHANGES.md)) | `<25.9.1,>=25.9.0` -> `<25.11.1,>=25.11.0` | [![age](https://developer.mend.io/api/mc/badges/age/pypi/black/25.11.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/black/25.9.0/25.11.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>psf/black (black)</summary>

### [`v25.11.0`](https://github.com/psf/black/blob/HEAD/CHANGES.md#25110)

[Compare Source](psf/black@25.9.0...25.11.0)

##### Highlights

- Enable base 3.14 support ([#&#8203;4804](psf/black#4804))
- Add support for the new Python 3.14 t-string syntax introduced by PEP 750 ([#&#8203;4805](psf/black#4805))

##### Stable style

- Fix bug where comments between `# fmt: off` and `# fmt: on` were reformatted ([#&#8203;4811](psf/black#4811))
- Comments containing fmt directives now preserve their exact formatting instead of
  being normalized ([#&#8203;4811](psf/black#4811))

##### Preview style

- Move `multiline_string_handling` from `--unstable` to `--preview` ([#&#8203;4760](psf/black#4760))
- Fix bug where module docstrings would be treated as normal strings if preceded by
  comments ([#&#8203;4764](psf/black#4764))
- Fix bug where python 3.12 generics syntax split line happens weirdly ([#&#8203;4777](psf/black#4777))
- Standardize type comments to form `# type: <value>` ([#&#8203;4645](psf/black#4645))
- Fix `fix_fmt_skip_in_one_liners` preview feature to respect `# fmt: skip` for compound
  statements with semicolon-separated bodies ([#&#8203;4800](psf/black#4800))

##### Configuration

- Add `no_cache` option to control caching behavior. ([#&#8203;4803](psf/black#4803))

##### Packaging

- Releases now include arm64 Linux binaries ([#&#8203;4773](psf/black#4773))

##### Output

- Write unchanged content to stdout when excluding formatting from stdin using pipes
  ([#&#8203;4610](psf/black#4610))

##### *Blackd*

- Implemented BlackDClient. This simple python client allows to easily send formatting
  requests to blackd ([#&#8203;4774](psf/black#4774))

##### Integrations

- Enable 3.14 base CI ([#&#8203;4804](psf/black#4804))
- Enhance GitHub Action `psf/black` to support the `required-version` major-version-only
  "stability" format when using pyproject.toml ([#&#8203;4770](psf/black#4770))
- Improve error message for vim plugin users. It now handles independently vim version
- Vim: Warn on unsupported Vim and Python versions independently ([#&#8203;4772](psf/black#4772))
- Vim: Print the import paths when importing black fails ([#&#8203;4675](psf/black#4675))
- Vim: Fix handling of virtualenvs that have a different Python version ([#&#8203;4675](psf/black#4675))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi4yLjAiLCJ1cGRhdGVkSW5WZXIiOiI0Mi4yLjAiLCJ0YXJnZXRCcmFuY2giOiJtYWluIiwibGFiZWxzIjpbInR5cGUvZGVwZW5kZW5jaWVzIl19-->

Reviewed-on: https://git.tainton.uk/repos/roboluke/pulls/393
Co-authored-by: renovate[bot] <[email protected]>
Co-committed-by: renovate[bot] <[email protected]>
luketainton pushed a commit to luketainton/epage that referenced this pull request Nov 10, 2025
This PR contains the following updates:

| Package | Change | Age | Confidence |
|---|---|---|---|
| [black](https://github.com/psf/black) ([changelog](https://github.com/psf/black/blob/main/CHANGES.md)) | `<25.9.1,>=25.9.0` -> `<25.11.1,>=25.11.0` | [![age](https://developer.mend.io/api/mc/badges/age/pypi/black/25.11.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/black/25.9.0/25.11.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>psf/black (black)</summary>

### [`v25.11.0`](https://github.com/psf/black/blob/HEAD/CHANGES.md#25110)

[Compare Source](psf/black@25.9.0...25.11.0)

##### Highlights

- Enable base 3.14 support ([#&#8203;4804](psf/black#4804))
- Add support for the new Python 3.14 t-string syntax introduced by PEP 750 ([#&#8203;4805](psf/black#4805))

##### Stable style

- Fix bug where comments between `# fmt: off` and `# fmt: on` were reformatted ([#&#8203;4811](psf/black#4811))
- Comments containing fmt directives now preserve their exact formatting instead of
  being normalized ([#&#8203;4811](psf/black#4811))

##### Preview style

- Move `multiline_string_handling` from `--unstable` to `--preview` ([#&#8203;4760](psf/black#4760))
- Fix bug where module docstrings would be treated as normal strings if preceded by
  comments ([#&#8203;4764](psf/black#4764))
- Fix bug where python 3.12 generics syntax split line happens weirdly ([#&#8203;4777](psf/black#4777))
- Standardize type comments to form `# type: <value>` ([#&#8203;4645](psf/black#4645))
- Fix `fix_fmt_skip_in_one_liners` preview feature to respect `# fmt: skip` for compound
  statements with semicolon-separated bodies ([#&#8203;4800](psf/black#4800))

##### Configuration

- Add `no_cache` option to control caching behavior. ([#&#8203;4803](psf/black#4803))

##### Packaging

- Releases now include arm64 Linux binaries ([#&#8203;4773](psf/black#4773))

##### Output

- Write unchanged content to stdout when excluding formatting from stdin using pipes
  ([#&#8203;4610](psf/black#4610))

##### *Blackd*

- Implemented BlackDClient. This simple python client allows to easily send formatting
  requests to blackd ([#&#8203;4774](psf/black#4774))

##### Integrations

- Enable 3.14 base CI ([#&#8203;4804](psf/black#4804))
- Enhance GitHub Action `psf/black` to support the `required-version` major-version-only
  "stability" format when using pyproject.toml ([#&#8203;4770](psf/black#4770))
- Improve error message for vim plugin users. It now handles independently vim version
- Vim: Warn on unsupported Vim and Python versions independently ([#&#8203;4772](psf/black#4772))
- Vim: Print the import paths when importing black fails ([#&#8203;4675](psf/black#4675))
- Vim: Fix handling of virtualenvs that have a different Python version ([#&#8203;4675](psf/black#4675))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi4yLjAiLCJ1cGRhdGVkSW5WZXIiOiI0Mi4yLjAiLCJ0YXJnZXRCcmFuY2giOiJtYWluIiwibGFiZWxzIjpbInR5cGUvZGVwZW5kZW5jaWVzIl19-->

Reviewed-on: https://git.tainton.uk/repos/epage/pulls/176
Co-authored-by: renovate[bot] <[email protected]>
Co-committed-by: renovate[bot] <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants