Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

gh-138848: Add PNG optimization to pre-commit#139061

Closed
StanFromIreland wants to merge 4 commits into
python:mainpython/cpython:mainfrom
StanFromIreland:pre-commitStanFromIreland/cpython:pre-commitCopy head branch name to clipboard
Closed

gh-138848: Add PNG optimization to pre-commit#139061
StanFromIreland wants to merge 4 commits into
python:mainpython/cpython:mainfrom
StanFromIreland:pre-commitStanFromIreland/cpython:pre-commitCopy head branch name to clipboard

Conversation

@StanFromIreland

@StanFromIreland StanFromIreland commented Sep 17, 2025

Copy link
Copy Markdown
Member

@hugovk hugovk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's also move this before the slower sphinx-lint.

Comment thread .pre-commit-config.yaml Outdated
Comment thread .pre-commit-config.yaml Outdated
Comment thread .pre-commit-config.yaml
StanFromIreland and others added 2 commits September 29, 2025 16:35
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Comment thread .pre-commit-config.yaml
hooks:
- id: oxipng
args: [--strip=safe, --alpha]
# Exclude all existing pngs

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is it all existing pngs, or a subset?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

All, however, it would just save off a byte or two for a few.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I really don't think we want to exclude all existing images, that will severely reduce the usefulness of the new check. After all, the most likely changes are going to be to existing images to update them.

Does anyone know why we use --all-files in the CI pre-commit check? Surely it would be better to make use of --from-ref and --to-ref?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Alternately, we should just take the hit once to enable the check and optimize the snot out of everything in this PR with no exclude list.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Optimising exisiting PNGs has some benefit, but results in a larger repo size. The only user-visible effects should be in the documentation, where we'd preferably use SVGs to PNGs (especially for diagrams etc).

Personally, I think this check would probably cost more than it saves (at least on a macro scale), but I don't have a strong opinion, I don't use pre-commit.

@github-actions

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Apr 29, 2026
@StanFromIreland

Copy link
Copy Markdown
Member Author

Closing, there wasn't much support for this.

@StanFromIreland StanFromIreland deleted the pre-commit branch May 3, 2026 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review skip news stale Stale PR or inactive for long period of time.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.