Skip to content

GitHub Action: Allow reading version from pyproject.toml#4294

Merged
JelleZijlstra merged 13 commits into
psf:mainfrom
srittau:action-pyproject
Apr 5, 2024
Merged

GitHub Action: Allow reading version from pyproject.toml#4294
JelleZijlstra merged 13 commits into
psf:mainfrom
srittau:action-pyproject

Conversation

@srittau

@srittau srittau commented Mar 30, 2024

Copy link
Copy Markdown
Contributor

Description

This adds an use_pyproject input to the GitHub Action that – when set to true – will read the black version from pyproject.toml file. Either from the project.dependencies array or one of the arrays from the project.optional-dependencies table.

Closes: #4285

Checklist - did you ...

  • Add an entry in CHANGES.md if necessary?
  • Add / update tests if necessary?
  • Add new / update outdated documentation?

Trial runs at: https://github.com/srittau/python-asserts/actions/runs/8490172420, using this branch of one of my projects: https://github.com/srittau/python-asserts/tree/black-test

@JelleZijlstra JelleZijlstra left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we look for required-version in the tool.black table first? https://black.readthedocs.io/en/stable/usage_and_configuration/the_basics.html#required-version

That seems better than attempting to parse the dependency metadata.

@hugovk hugovk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs nits.

Comment thread docs/integrations/github_actions.md Outdated
Comment thread docs/integrations/github_actions.md Outdated
Comment thread docs/integrations/github_actions.md Outdated
Comment thread action.yml Outdated
srittau and others added 3 commits April 1, 2024 16:31
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>

@JelleZijlstra JelleZijlstra left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Could you also add a changelog entry?

Comment thread action/main.py Outdated
@srittau

srittau commented Apr 4, 2024

Copy link
Copy Markdown
Contributor Author

Thanks! Could you also add a changelog entry?

How to best do this? This doesn't really fit the existing structure of the CHANGES file, as this is independent of the versions of black.

@JelleZijlstra

Copy link
Copy Markdown
Collaborator

Thanks! Could you also add a changelog entry?

How to best do this? This doesn't really fit the existing structure of the CHANGES file, as this is independent of the versions of black.

It can go in the "Integrations" section (https://github.com/psf/black/blob/main/CHANGES.md#integrations). The Actions version is a little disconnected, but for most people the change should still become useful when we make our next release.

Comment thread CHANGES.md Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants