Skip to content

Commit

Permalink
Merge branch 'master' into feature/allow-overriding-black-version-in-…
Browse files Browse the repository at this point in the history
…github-action
  • Loading branch information
stefanfoulis committed Apr 6, 2021
2 parents 8d9b861 + e114ef5 commit da50fbb
Show file tree
Hide file tree
Showing 48 changed files with 1,377 additions and 762 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/changelog.yml
@@ -0,0 +1,21 @@
name: changelog

on:
pull_request:
types: [opened, synchronize, labeled, unlabeled, reopened]

jobs:
build:
name: Changelog Entry Check

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Grep CHANGES.md for PR number
if: contains(github.event.pull_request.labels.*.name, 'skip news') != true
run: |
grep -Pz "\((\n\s*)?#${{ github.event.pull_request.number }}(\n\s*)?\)" CHANGES.md || \
(echo "Please add '(#${{ github.event.pull_request.number }})' change line to CHANGES.md" && \
exit 1)
8 changes: 7 additions & 1 deletion .github/workflows/doc.yml
Expand Up @@ -16,8 +16,14 @@ on:

jobs:
build:
runs-on: ubuntu-latest
# We want to run on external PRs, but not on our own internal PRs as they'll be run
# by the push to the branch. Without this if check, checks are duplicated since
# internal PRs match both the push and pull_request events.
if:
github.event_name == 'push' || github.event.pull_request.head.repo.full_name !=
github.repository

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/fuzz.yml
Expand Up @@ -4,6 +4,13 @@ on: [push, pull_request]

jobs:
build:
# We want to run on external PRs, but not on our own internal PRs as they'll be run
# by the push to the branch. Without this if check, checks are duplicated since
# internal PRs match both the push and pull_request events.
if:
github.event_name == 'push' || github.event.pull_request.head.repo.full_name !=
github.repository

runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand Down
14 changes: 8 additions & 6 deletions .github/workflows/lint.yml
Expand Up @@ -4,18 +4,20 @@ on: [push, pull_request]

jobs:
build:
# We want to run on external PRs, but not on our own internal PRs as they'll be run
# by the push to the branch. Without this if check, checks are duplicated since
# internal PRs match both the push and pull_request events.
if:
github.event_name == 'push' || github.event.pull_request.head.repo.full_name !=
github.repository

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7]

steps:
- uses: actions/checkout@v2

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

- name: Install dependencies
run: |
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/primer.yml
Expand Up @@ -4,6 +4,13 @@ on: [push, pull_request]

jobs:
build:
# We want to run on external PRs, but not on our own internal PRs as they'll be run
# by the push to the branch. Without this if check, checks are duplicated since
# internal PRs match both the push and pull_request events.
if:
github.event_name == 'push' || github.event.pull_request.head.repo.full_name !=
github.repository

runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/pypi_upload.yml
@@ -0,0 +1,31 @@
name: pypi_upload

on:
release:
types: created

jobs:
build:
name: PyPI Upload
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2

- name: Install latest pip, setuptools, twine + wheel
run: |
python -m pip install --upgrade pip setuptools twine wheel
- name: Build wheels
run: |
python setup.py bdist_wheel
python setup.py sdist
- name: Upload to PyPI via Twine
env:
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
twine upload --verbose -u '__token__' dist/*
7 changes: 7 additions & 0 deletions .github/workflows/test.yml
Expand Up @@ -4,6 +4,13 @@ on: [push, pull_request]

jobs:
build:
# We want to run on external PRs, but not on our own internal PRs as they'll be run
# by the push to the branch. Without this if check, checks are duplicated since
# internal PRs match both the push and pull_request events.
if:
github.event_name == 'push' || github.event.pull_request.head.repo.full_name !=
github.repository

runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Expand Up @@ -13,19 +13,19 @@ repos:
types_or: [python, pyi]

- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.1
rev: 3.9.0
hooks:
- id: flake8
additional_dependencies: [flake8-bugbear]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.780
rev: v0.812
hooks:
- id: mypy
exclude: ^docs/conf.py

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v1.19.1
rev: v2.2.1
hooks:
- id: prettier
args: [--prose-wrap=always, --print-width=88]
21 changes: 20 additions & 1 deletion CHANGES.md
Expand Up @@ -13,6 +13,9 @@
- `Black` no longer adds an incorrect space after a parenthesized assignment expression
in if/while statements (#1655)

- Added `--skip-magic-trailing-comma` / `-C` to avoid using trailing commas as a reason
to split lines (#1824)

- fixed a crash when PWD=/ on POSIX (#1631)

- fixed "I/O operation on closed file" when using --diff (#1664)
Expand All @@ -26,7 +29,23 @@

- use lowercase hex strings (#1692)

- allow choosing black version with github action (#1940)
- added `--extend-exclude` argument (PR #2005)

- speed up caching by avoiding pathlib (#1950)

- `--diff` correctly indicates when a file doesn't end in a newline (#1662)

- Added `--stdin-filename` argument to allow stdin to respect `--force-exclude` rules
(#1780)

- Lines ending with `fmt: skip` will now be not formatted (#1800)

- PR #2053: Black no longer relies on typed-ast for Python 3.8 and higher

- PR #2053: Python 2 support is now optional, install with
`python3 -m pip install black[python2]` to maintain support.

- allow choosing black version on github action (#1940)

#### _Packaging_

Expand Down
16 changes: 16 additions & 0 deletions CONTRIBUTING.md
Expand Up @@ -58,6 +58,22 @@ $ tox -e fuzz
$ black-primer [-k -w /tmp/black_test_repos]
```

### News / Changelog Requirement

`Black` has CI that will check for an entry corresponding to your PR in `CHANGES.md`. If
you feel this PR not require a changelog entry please state that in a comment and a
maintainer can add a `skip news` label to make the CI pass. Otherwise, please ensure you
have a line in the following format:

```md
- `Black` is now more awesome (#X)
```

To workout X, please use
[Next PR Number](https://ichard26.github.io/next-pr-number/?owner=psf&name=black). This
is not perfect but saves a lot of release overhead as now the releaser does not need to
go back and workout what to add to the `CHANGES.md` for each release.

### Docs Testing

If you make changes to docs, you can test they still build locally too.
Expand Down

0 comments on commit da50fbb

Please sign in to comment.