Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
TomFryers committed Mar 31, 2024
2 parents c1f6e4a + 836acad commit 2f16112
Show file tree
Hide file tree
Showing 298 changed files with 11,797 additions and 3,389 deletions.
9 changes: 0 additions & 9 deletions .coveragerc

This file was deleted.

4 changes: 2 additions & 2 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[flake8]
# B905 should be enabled when we drop support for 3.9
ignore = E203, E266, E501, W503, B905, B907
ignore = E203, E266, E501, E701, E704, W503, B905, B907
# line length is intentionally set to 80 here because black uses Bugbear
# See https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html#line-length for more details
# See https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html#bugbear for more details
max-line-length = 80
max-complexity = 18
select = B,C,E,F,W,T4,B9
4 changes: 4 additions & 0 deletions .git_archival.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node: $Format:%H$
node-date: $Format:%cI$
describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$
ref-names: $Format:%D$
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.git_archival.txt export-subst
2 changes: 1 addition & 1 deletion .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Grep CHANGES.md for PR number
if: contains(github.event.pull_request.labels.*.name, 'skip news') != true
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/diff_shades.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ jobs:
matrix: ${{ steps.set-config.outputs.matrix }}

steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "*"
python-version: "3.11"

- name: Install diff-shades and support dependencies
run: |
python -m pip install click packaging urllib3
python -m pip install 'click==8.1.3' packaging urllib3
python -m pip install https://github.com/ichard26/diff-shades/archive/stable.zip
- name: Calculate run configuration & metadata
Expand All @@ -44,35 +44,35 @@ jobs:
HATCH_BUILD_HOOKS_ENABLE: "1"
# Clang is less picky with the C code it's given than gcc (and may
# generate faster binaries too).
CC: clang-12
CC: clang-14
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.configure.outputs.matrix )}}

steps:
- name: Checkout this repository (full clone)
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
# The baseline revision could be rather old so a full clone is ideal.
fetch-depth: 0

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: "*"
python-version: "3.11"

- name: Install diff-shades and support dependencies
run: |
python -m pip install https://github.com/ichard26/diff-shades/archive/stable.zip
python -m pip install click packaging urllib3
python -m pip install 'click==8.1.3' packaging urllib3
# After checking out old revisions, this might not exist so we'll use a copy.
cat scripts/diff_shades_gha_helper.py > helper.py
git config user.name "diff-shades-gha"
git config user.email "diff-shades-gha@example.com"
- name: Attempt to use cached baseline analysis
id: baseline-cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ matrix.baseline-analysis }}
key: ${{ matrix.baseline-cache-key }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/diff_shades_comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ jobs:
comment:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "*"

Expand All @@ -33,15 +33,15 @@ jobs:
- name: Try to find pre-existing PR comment
if: steps.metadata.outputs.needs-comment == 'true'
id: find-comment
uses: peter-evans/find-comment@81e2da3af01c92f83cb927cf3ace0e085617c556
uses: peter-evans/find-comment@d5fe37641ad8451bdd80312415672ba26c86575e
with:
issue-number: ${{ steps.metadata.outputs.pr-number }}
comment-author: "github-actions[bot]"
body-includes: "diff-shades"

- name: Create or update PR comment
if: steps.metadata.outputs.needs-comment == 'true'
uses: peter-evans/create-or-update-comment@5adcb0bb0f9fb3f95ef05400558bdb3f329ee808
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043
with:
comment-id: ${{ steps.find-comment.outputs.comment-id }}
issue-number: ${{ steps.metadata.outputs.pr-number }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up latest Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "*"

Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
Expand All @@ -36,7 +36,7 @@ jobs:
latest_non_release)" >> $GITHUB_ENV

- name: Build and push
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
Expand All @@ -47,7 +47,7 @@ jobs:
if:
${{ github.event_name == 'release' && github.event.action == 'published' &&
!github.event.release.prerelease }}
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
Expand All @@ -58,7 +58,7 @@ jobs:
if:
${{ github.event_name == 'release' && github.event.action == 'published' &&
github.event.release.prerelease }}
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/fuzz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand Down
15 changes: 10 additions & 5 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Lint
name: Lint + format ourselves

on: [push, pull_request]

Expand All @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Assert PR target is main
if: github.event_name == 'pull_request' && github.repository == 'psf/black'
Expand All @@ -24,19 +24,24 @@ jobs:
fi
- name: Set up latest Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "*"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -e '.[d]'
python -m pip install -e '.'
python -m pip install tox
- name: Run pre-commit hooks
uses: pre-commit/action@v3.0.0
uses: pre-commit/action@v3.0.1

- name: Format ourselves
run: |
tox -e run_self
- name: Regenerate schema
run: |
tox -e generate_schema
git diff --exit-code
90 changes: 62 additions & 28 deletions .github/workflows/pypi_upload.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
name: Publish to PyPI
name: Build and publish

on:
release:
types: [published]
pull_request:
push:
branches:
- main

permissions:
contents: read
Expand All @@ -11,12 +15,13 @@ jobs:
main:
name: sdist + pure wheel
runs-on: ubuntu-latest
if: github.event_name == 'release'

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up latest Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "*"

Expand All @@ -28,47 +33,74 @@ jobs:
- name: Build wheel and source distributions
run: python -m build

- name: Upload to PyPI via Twine
- if: github.event_name == 'release'
name: Upload to PyPI via Twine
env:
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: twine upload --verbose -u '__token__' dist/*

generate_wheels_matrix:
name: generate wheels matrix
runs-on: ubuntu-latest
outputs:
include: ${{ steps.set-matrix.outputs.include }}
steps:
- uses: actions/checkout@v4
- name: Install cibuildwheel and pypyp
run: |
pipx install cibuildwheel==2.15.0
pipx install pypyp==1
- name: generate matrix
if: github.event_name != 'pull_request'
run: |
{
cibuildwheel --print-build-identifiers --platform linux \
| pyp 'json.dumps({"only": x, "os": "ubuntu-latest"})' \
&& cibuildwheel --print-build-identifiers --platform macos \
| pyp 'json.dumps({"only": x, "os": "macos-latest"})' \
&& cibuildwheel --print-build-identifiers --platform windows \
| pyp 'json.dumps({"only": x, "os": "windows-latest"})'
} | pyp 'json.dumps(list(map(json.loads, lines)))' > /tmp/matrix
env:
CIBW_ARCHS_LINUX: x86_64
CIBW_ARCHS_MACOS: x86_64 arm64
CIBW_ARCHS_WINDOWS: AMD64
- name: generate matrix (PR)
if: github.event_name == 'pull_request'
run: |
{
cibuildwheel --print-build-identifiers --platform linux \
| pyp 'json.dumps({"only": x, "os": "ubuntu-latest"})'
} | pyp 'json.dumps(list(map(json.loads, lines)))' > /tmp/matrix
env:
CIBW_BUILD: "cp38-* cp312-*"
CIBW_ARCHS_LINUX: x86_64
- id: set-matrix
run: echo "include=$(cat /tmp/matrix)" | tee -a $GITHUB_OUTPUT

mypyc:
name: mypyc wheels (${{ matrix.name }})
name: mypyc wheels ${{ matrix.only }}
needs: generate_wheels_matrix
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
name: linux-x86_64
- os: windows-2019
name: windows-amd64
- os: macos-11
name: macos-x86_64
macos_arch: "x86_64"
- os: macos-11
name: macos-arm64
macos_arch: "arm64"
- os: macos-11
name: macos-universal2
macos_arch: "universal2"
include: ${{ fromJson(needs.generate_wheels_matrix.outputs.include) }}

steps:
- uses: actions/checkout@v3

- name: Build wheels via cibuildwheel
uses: pypa/cibuildwheel@v2.11.4
env:
CIBW_ARCHS_MACOS: "${{ matrix.macos_arch }}"
- uses: actions/checkout@v4
- uses: pypa/cibuildwheel@v2.17.0
with:
only: ${{ matrix.only }}

- name: Upload wheels as workflow artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.name }}-mypyc-wheels
path: ./wheelhouse/*.whl

- name: Upload wheels to PyPI via Twine
- if: github.event_name == 'release'
name: Upload wheels to PyPI via Twine
env:
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: pipx run twine upload --verbose -u '__token__' wheelhouse/*.whl
Expand All @@ -77,17 +109,19 @@ jobs:
name: Update stable branch
needs: [main, mypyc]
runs-on: ubuntu-latest
if: github.event_name == 'release'
permissions:
contents: write

steps:
- name: Checkout stable branch
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: stable
fetch-depth: 0

- name: Update stable branch to release tag & push
- if: github.event_name == 'release'
name: Update stable branch to release tag & push
run: |
git reset --hard ${{ github.event.release.tag_name }}
git push
Loading

0 comments on commit 2f16112

Please sign in to comment.