Skip to content

CI: add pre-commit action, include pyupgrade #36471

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Sep 22, 2020
14 changes: 14 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: pre-commit

on:
pull_request:
push:
branches: [master]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: pre-commit/[email protected]
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,19 @@ repos:
rev: 19.10b0
hooks:
- id: black
language_version: python3
Copy link
Member Author

Choose a reason for hiding this comment

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

- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.3
hooks:
- id: flake8
language: python_venv
Copy link
Member Author

Choose a reason for hiding this comment

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

Same, they already specify this here https://gitlab.com/pycqa/flake8/-/blob/master/.pre-commit-hooks.yaml

and according to pre-commit docs https://pre-commit.com/

The python_venv language is now an alias to python

additional_dependencies: [flake8-comprehensions>=3.1.0]
- id: flake8
name: flake8-pyx
language: python_venv
files: \.(pyx|pxd)$
types:
- file
args: [--append-config=flake8/cython.cfg]
- id: flake8
name: flake8-pxd
language: python_venv
files: \.pxi\.in$
types:
- file
Expand All @@ -28,5 +24,9 @@ repos:
rev: v5.2.2
hooks:
- id: isort
language: python_venv
Copy link
Member Author

Choose a reason for hiding this comment

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

exclude: ^pandas/__init__\.py$|^pandas/core/api\.py$
- repo: https://github.com/asottile/pyupgrade
rev: v2.7.2
hooks:
- id: pyupgrade
args: [--py37-plus]
1 change: 0 additions & 1 deletion doc/sphinxext/announce.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python3
# -*- encoding:utf-8 -*-
"""
Script to generate contributor and pull request lists

Expand Down