Skip to content

Commit 85240af

Browse files
authored
Merge branch 'main' into dependency-specifiers-grammar-fixes
2 parents f91e32f + 9d2e58f commit 85240af

File tree

85 files changed

+7925
-2445
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+7925
-2445
lines changed

.git-blame-ignore-revs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1d7b1abd152e4cb5e6a46e52e6b7e3bf8d366486

.github/sphinx_lint_matcher.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"owner": "sphinx-lint-problem-matcher",
5+
"pattern": [
6+
{
7+
"regexp": "^(.*):(\\d+):\\s+(.*)$",
8+
"file": 1,
9+
"line": 2,
10+
"message": 3
11+
}
12+
]
13+
}
14+
]
15+
}

.github/workflows/cron.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
3+
name: Cron
4+
5+
on:
6+
schedule:
7+
- cron: "0 6 * * *" # daily at 6am
8+
9+
jobs:
10+
test:
11+
if: github.repository_owner == 'pypa' # suppress noise in forks
12+
uses: ./.github/workflows/test.yml
13+
14+
...
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Read the Docs PR preview
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
8+
permissions:
9+
contents: read
10+
pull-requests: write
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
documentation-links:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: readthedocs/actions/preview@v1
21+
with:
22+
project-slug: "python-packaging-user-guide"
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Test translations
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
paths:
7+
- '**.po'
8+
branches:
9+
- translation/source
10+
push:
11+
paths:
12+
- '**.po'
13+
branches:
14+
- translation/source
15+
16+
permissions:
17+
contents: read
18+
19+
concurrency:
20+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
21+
cancel-in-progress: true
22+
23+
env:
24+
I18N_BRANCH: translation/source
25+
26+
jobs:
27+
matrix:
28+
runs-on: ubuntu-latest
29+
outputs:
30+
languages: ${{ steps.languages.outputs.languages }}
31+
32+
steps:
33+
- name: Grab the repo src
34+
uses: actions/checkout@v4
35+
with:
36+
ref: ${{ env.I18N_BRANCH }}
37+
38+
- name: List languages
39+
id: languages
40+
working-directory: locales
41+
run: |
42+
list=$(find * -maxdepth 0 -type d | jq -nRc '[inputs]')
43+
echo "languages=$list" >> $GITHUB_OUTPUT
44+
45+
46+
test-translation:
47+
runs-on: ubuntu-latest
48+
needs: matrix
49+
strategy:
50+
fail-fast: false
51+
matrix:
52+
language: ${{fromJson(needs.matrix.outputs.languages)}}
53+
54+
steps:
55+
- name: Grab the repo src
56+
uses: actions/checkout@v4
57+
with:
58+
ref: ${{ env.I18N_BRANCH }}
59+
60+
- name: Set up Python
61+
uses: actions/setup-python@v5
62+
with:
63+
python-version: >-
64+
3.10
65+
66+
- name: Install Python tooling
67+
run: python -m pip install --upgrade nox virtualenv sphinx-lint
68+
69+
- name: Set Sphinx problem matcher
70+
uses: sphinx-doc/[email protected]
71+
72+
- name: Build translated docs in ${{ matrix.language }}
73+
run: nox -s build -- -q -D language=${{ matrix.language }}
74+
75+
- name: Set Sphinx Lint problem matcher
76+
if: always()
77+
run: echo '::add-matcher::.github/sphinx_lint_matcher.json'
78+
79+
- name: Lint translation file
80+
if: always()
81+
run: sphinx-lint locales/${{ matrix.language }}/LC_MESSAGES/messages.po

.github/workflows/test.yml

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
name: Test
22

3-
on:
3+
on:
4+
merge_group:
45
push:
6+
branches-ignore:
7+
- gh-readonly-queue/** # Temporary merge queue-related GH-made branches
58
pull_request:
6-
schedule:
7-
- cron: "0 6 * * *" # daily at 6am
9+
workflow_call:
810

911
concurrency:
1012
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
@@ -13,6 +15,7 @@ concurrency:
1315
jobs:
1416
build:
1517
name: ${{ matrix.noxenv }}
18+
if: ${{ github.repository_owner == 'pypa' || github.event_name != 'schedule' }}
1619
runs-on: ubuntu-latest
1720
strategy:
1821
matrix:
@@ -26,7 +29,7 @@ jobs:
2629
- name: Set up Python
2730
uses: actions/setup-python@v4
2831
with:
29-
python-version: 3.9
32+
python-version: "3.11"
3033
cache: 'pip'
3134
cache-dependency-path: 'requirements.txt'
3235

@@ -37,3 +40,21 @@ jobs:
3740
- name: Nox ${{ matrix.noxenv }}
3841
run: |
3942
python -m nox -s ${{ matrix.noxenv }}
43+
44+
45+
check:
46+
# This job does nothing and is only used for the branch protection
47+
# or multi-stage CI jobs, like making sure that all tests pass before
48+
# a publishing job is started.
49+
if: always()
50+
51+
needs:
52+
- build
53+
54+
runs-on: ubuntu-latest
55+
56+
steps:
57+
- name: Decide whether the needed jobs succeeded or failed
58+
uses: re-actors/alls-green@release/v1
59+
with:
60+
jobs: ${{ toJSON(needs) }}

.github/workflows/translation.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ env:
1515
jobs:
1616
build:
1717
runs-on: ubuntu-latest
18+
if: github.repository_owner == 'pypa'
1819

1920
steps:
2021
- name: Grab the repo src
@@ -65,6 +66,7 @@ jobs:
6566
run: |
6667
git_hash=$(git rev-parse --short "${GITHUB_SHA}")
6768
git add --force locales/messages.pot
69+
git diff-index --quiet HEAD || \
6870
git commit \
6971
-m "Update messages.pot as of version ${git_hash}" \
7072
locales/messages.pot

.pre-commit-config.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.6.0
4+
hooks:
5+
- id: check-added-large-files
6+
- id: check-case-conflict
7+
- id: check-merge-conflict
8+
- id: check-symlinks
9+
- id: check-yaml
10+
- id: end-of-file-fixer
11+
- id: mixed-line-ending
12+
- id: trailing-whitespace
13+
14+
- repo: https://github.com/codespell-project/codespell
15+
rev: v2.2.6
16+
hooks:
17+
- id: codespell
18+
args: ["-L", "ned,ist,oder", "--skip", "*.po"]
19+
20+
- repo: local
21+
hooks:
22+
- id: disallow-caps
23+
name: Disallow improper capitalization
24+
language: pygrep
25+
entry: PyBind|Numpy|Cmake|CCache|Github|PyTest
26+
exclude: .pre-commit-config.yaml
27+
exclude_types: ["pofile"]
28+
29+
- repo: https://github.com/pre-commit/pygrep-hooks
30+
rev: v1.10.0
31+
hooks:
32+
- id: rst-backticks
33+
- id: rst-directive-colons
34+
- id: rst-inline-touching-normal
35+
36+
- repo: https://github.com/astral-sh/ruff-pre-commit
37+
rev: v0.4.3
38+
hooks:
39+
- id: ruff
40+
- id: ruff-format

.readthedocs.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ sphinx:
99
# https://github.com/pyca/cryptography/issues/5863#issuecomment-792343136
1010
builder: dirhtml
1111

12+
build:
13+
os: ubuntu-22.04
14+
tools:
15+
python: "3.11"
16+
1217
python:
13-
version: 3.8
1418
install:
1519
- requirements: requirements.txt

noxfile.py

Lines changed: 42 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
# Attribution-ShareAlike license:
44
# http://creativecommons.org/licenses/by-sa/3.0.
55

6-
import shutil
7-
import nox
86

7+
import nox
98

109
nox.options.sessions = []
1110

@@ -18,27 +17,26 @@ def translation(session):
1817
session.install("-r", "requirements.txt")
1918
target_dir = "locales"
2019
session.run(
21-
"sphinx-build",
22-
"-b", "gettext", # build gettext-style message catalogs (.pot file)
23-
"-d", ".nox/.doctrees/", # path to put the cache
20+
"sphinx-build",
21+
"-b",
22+
"gettext", # build gettext-style message catalogs (.pot file)
23+
"-d",
24+
session.cache_dir / ".doctrees", # path to put the cache
2425
"source/", # where the rst files are located
25-
target_dir, # where to put the .pot file
26+
target_dir, # where to put the .pot file
2627
)
2728

29+
2830
@nox.session()
2931
def build(session, autobuild=False):
3032
"""
3133
Make the website.
3234
"""
3335
session.install("-r", "requirements.txt")
3436

35-
target_build_dir = "build"
36-
37-
shutil.rmtree(target_build_dir, ignore_errors=True)
38-
3937
if autobuild:
4038
command = "sphinx-autobuild"
41-
extra_args = "-H", "0.0.0.0"
39+
extra_args = "--host", "0.0.0.0"
4240
else:
4341
# NOTE: This branch adds options that are unsupported by autobuild
4442
command = "sphinx-build"
@@ -48,14 +46,19 @@ def build(session, autobuild=False):
4846
)
4947

5048
session.run(
51-
command, *extra_args,
52-
"-j", "auto", # parallelize the build
53-
"-b", "html", # use HTML builder
49+
command,
50+
*extra_args,
51+
"-j",
52+
"auto", # parallelize the build
53+
"-b",
54+
"html", # use HTML builder
55+
"-d",
56+
session.cache_dir / ".doctrees", # path to put the cache
5457
"-n", # nitpicky warn about all missing references
5558
"-W", # Treat warnings as errors.
5659
*session.posargs,
5760
"source", # where the rst files are located
58-
target_build_dir, # where to put the html output
61+
"build", # where to put the html output
5962
)
6063

6164

@@ -75,10 +78,29 @@ def linkcheck(session):
7578
"""
7679
session.install("-r", "requirements.txt")
7780
session.run(
78-
"sphinx-build",
79-
"-b", "linkcheck", # use linkcheck builder
81+
"sphinx-build",
82+
"-b",
83+
"linkcheck", # use linkcheck builder
84+
"-d",
85+
session.cache_dir / ".doctrees", # path to put the cache
8086
"--color",
81-
"-n", "-W", "--keep-going", # be strict
82-
"source", # where the rst files are located
83-
"build", # where to put the check output
87+
"-n",
88+
"-W",
89+
"--keep-going", # be strict
90+
"source", # where the rst files are located
91+
"build", # where to put the check output
92+
)
93+
94+
95+
@nox.session()
96+
def checkqa(session):
97+
"""
98+
Format the guide using pre-commit.
99+
"""
100+
session.install("pre-commit")
101+
session.run(
102+
"pre-commit",
103+
"run",
104+
"--all-files",
105+
"--show-diff-on-failure",
84106
)

0 commit comments

Comments
 (0)