Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 13 commits into from Apr 5, 2024

Conversation

srittau
Copy link
Contributor

@srittau srittau commented Mar 30, 2024

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

Copy link
Collaborator

@JelleZijlstra JelleZijlstra left a comment

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.

Copy link
Contributor

@hugovk hugovk left a comment

Choose a reason for hiding this comment

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

Docs nits.

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

@JelleZijlstra JelleZijlstra left a comment

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?

action/main.py Outdated Show resolved Hide resolved
@srittau
Copy link
Contributor Author

srittau commented Apr 4, 2024

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
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.

CHANGES.md Outdated Show resolved Hide resolved
@JelleZijlstra JelleZijlstra merged commit 3383f53 into psf:main Apr 5, 2024
43 checks passed
@srittau srittau deleted the action-pyproject branch April 5, 2024 13:00
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.

GitHub Action: Option to parse version from pyproject.toml
3 participants