FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Generate digital attestations for PyPI (PEP 740) by hugovk · Pull Request #198 · python/python-docs-theme · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .toml  (1) .yaml  (1) .yml  (1) All 3 file types selected
Only manifest files
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
5 changes: 5 additions & 0 deletions .github/workflows/pypi-package.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ on:
permissions:
contents: read

env:
FORCE_COLOR: 1

jobs:
# Always build & lint package.
build-package:
Expand Down Expand Up @@ -45,3 +48,5 @@ jobs:

- name: Upload package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
attestations: true
Comment on lines +51 to +52

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

So this is what actually generates the attestations, and even though the feature is still experimental we can still enable it here (and in the other repos) and let gh-action-pypi-publish deal with potential API changes, right?

I guess the other changes are unrelated, but it was convenient to bundle them together.

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Yes, pretty much. There's a chance we may need to change config here too, but gh-action-pypi-publish should deal with most of it.

12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.0
rev: v0.6.8
hooks:
- id: ruff
args: [--exit-non-zero-on-fix]

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.4.0
rev: 24.8.0
hooks:
- id: black

Expand All @@ -22,24 +22,24 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.28.2
rev: 0.29.2
hooks:
- id: check-dependabot
- id: check-github-workflows

- repo: https://github.com/rhysd/actionlint
rev: v1.6.27
rev: v1.7.2
hooks:
- id: actionlint

- repo: https://github.com/tox-dev/pyproject-fmt
rev: 1.8.0
rev: 2.2.4
hooks:
- id: pyproject-fmt
args: [--max-supported-python=3.13]

- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.16
rev: v0.20.2
hooks:
- id: validate-pyproject

Expand Down
31 changes: 12 additions & 19 deletions pyproject.toml

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Just out of curiosity, do you know what caused the changes below?
Some of them seem backward, at least coming from Python (e.g. removing the double space before # and adding spaces within [] and {}), at least coming from Python.

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

They nearly all came from the pyproject-fmt upgrade from 1.x to 2.x.

We needed to bump actionlint so it wouldn't fail on the new attestations config, then I updated the other pre-commit at the same time.

One pyproject-fmt change is to align all the comments. Before, we just so happened to manually align them. Now, it automatically does it. I'm not sure why pyproject-fmt chose a single space, but it's a TOML file, not a Python file.

(Looks like it's using this TOML formatter which has align_comments but no option for how many spaces.)


I manually adjusted this into a single line:

include = [
    "python_docs_theme/",
]

to:

include = [ "python_docs_theme/" ]

The extra spaces are also from pyproject-fmt, and common in examples in the spec: https://toml.io/en/v1.0.0

Again, this TOML not Python. I guess I might slightly prefer more a Python-y style, but having an autoformatter keep things consistent, and easier to compare across projects, is much more valuable for me.

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Yep, I figured that TOML might be following different conventions, and it makes sense to be consistent with those.
Thanks for looking into this!

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[build-system]
build-backend = "flit_core.buildapi"
requires = [
"flit_core>=3.7",
"flit-core>=3.7",
]

[project]
Expand All @@ -10,7 +10,7 @@ version = "2024.6"
description = "The Sphinx theme for the CPython docs and related projects"
readme = "README.md"
license.file = "LICENSE"
authors = [{name = "PyPA", email = "distutils-sig@python.org"}]
authors = [ { name = "PyPA", email = "distutils-sig@python.org" } ]
requires-python = ">=3.9"
classifiers = [
"Development Status :: 5 - Production/Stable",
Expand All @@ -32,22 +32,18 @@ urls.Code = "https://github.com/python/python-docs-theme"
urls.Download = "https://pypi.org/project/python-docs-theme/"
urls.Homepage = "https://github.com/python/python-docs-theme/"
urls."Issue tracker" = "https://github.com/python/python-docs-theme/issues"
[project.entry-points."sphinx.html_themes"]
python_docs_theme = 'python_docs_theme'
entry-points."sphinx.html_themes".python_docs_theme = "python_docs_theme"

[tool.flit.module]
name = "python_docs_theme"

[tool.flit.sdist]
include = [
"python_docs_theme/",
]
include = [ "python_docs_theme/" ]

[tool.ruff]
fix = true

[tool.ruff.lint]
select = [
lint.select = [
"C4", # flake8-comprehensions
"E", # pycodestyle errors
"F", # pyflakes errors
Expand All @@ -56,19 +52,16 @@ select = [
"LOG", # flake8-logging
"PGH", # pygrep-hooks
"PYI", # flake8-pyi
"RUF100", # unused noqa (yesqa)
"RUF022", # unsorted-dunder-all
"RUF100", # unused noqa (yesqa)
"UP", # pyupgrade
"W", # pycodestyle warnings
"YTT", # flake8-2020
]
ignore = [
"E203", # Whitespace before ':'
"E221", # Multiple spaces before operator
"E226", # Missing whitespace around arithmetic operator
"E241", # Multiple spaces after ','
lint.ignore = [
"E203", # Whitespace before ':'
"E221", # Multiple spaces before operator
"E226", # Missing whitespace around arithmetic operator
"E241", # Multiple spaces after ','
]


[tool.ruff.lint.isort]
required-imports = ["from __future__ import annotations"]
lint.isort.required-imports = [ "from __future__ import annotations" ]

Back | FazBrowse Home | New Git URL