Skip to content
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

Use reusable pre-commit workflow #188

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 3 additions & 17 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,9 @@ on:

jobs:
lint:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9']
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install -U pip setuptools wheel
pip install -r ./requirements.txt

- name: Run pre-commit
run: pre-commit install && pre-commit run --all-files
uses: less-action/reusables/.github/workflows/pre-commit.yaml@459cad5ac9877a76911718423b348249a20ce75d
with:
python-version: '3.9'

test:
runs-on: ubuntu-latest
Expand Down
19 changes: 10 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,29 @@ repos:
- id: check-merge-conflict
- id: end-of-file-fixer
- repo: https://github.com/asottile/pyupgrade
rev: v2.29.1
rev: v2.31.0
hooks:
- id: pyupgrade
args: ["--py36-plus"]
- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.9.3
rev: v5.10.1
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 21.12b0
rev: 22.1.0
hooks:
- id: black
- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
hooks:
- id: flake8
- repo: local
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.931
hooks:
- id: mypy
name: mypy
entry: mypy
language: system
types: [ python ]
exclude: "scripts/*"
args: [ "--cache-dir=/dev/null", "--no-incremental" ]
exclude: "scripts/"
types: [python]
additional_dependencies:
- djangorestframework
- django-stubs
antonagestam marked this conversation as resolved.
Show resolved Hide resolved
1 change: 1 addition & 0 deletions rest_framework-stubs/compat.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ except ImportError:

if markdown is not None and pygments is not None:
from markdown.preprocessors import Preprocessor

class CodeBlockPreprocessor(Preprocessor):
pattern: Any = ...
formatter: Any = ...
Expand Down
1 change: 1 addition & 0 deletions rest_framework-stubs/serializers.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ class ModelSerializer(Serializer, BaseSerializer[_MT]):
serializer_choice_field: Type[Field] = ...
url_field_name: Optional[str] = ...
instance: Optional[Union[_MT, Sequence[_MT]]] # type: ignore[override]

class Meta:
model: Type[_MT] # type: ignore
fields: Union[Sequence[str], Literal["__all__"]]
Expand Down