File tree 5 files changed +46
-1
lines changed 5 files changed +46
-1
lines changed Original file line number Diff line number Diff line change
1
+ [flake8]
2
+ # See https://flake8.pycqa.org/en/2.5.5/warnings.html
3
+ select =
4
+ E # pep8 errors
5
+ W # pep8 warnings
6
+ F # PyFlake codes
7
+ ignore =
8
+ W503 # line break before binary operator (makes Flake8 work like black)
9
+ W504 # line break after binary operator
10
+ E203 # whitespace before ‘:’ (makes Flake8 work like black)
11
+ E741 # do not use variables named ‘l’, ‘O’, or ‘I’
12
+ E501 # line too long (82 > 79 characters)
Original file line number Diff line number Diff line change 27
27
run : pip install pre-commit
28
28
29
29
- name : " Run pre-commit checks"
30
- run : pre-commit run --all-files
30
+ run : pre-commit run --hook-stage manual -- all-files
31
31
32
32
build :
33
33
runs-on : ubuntu-latest
Original file line number Diff line number Diff line change 4
4
hooks :
5
5
- id : " flake8"
6
6
name : " Python: analysis"
7
+ stages : [manual]
7
8
8
9
- repo : " https://github.com/pre-commit/mirrors-mypy"
9
10
rev : " v0.910"
@@ -13,3 +14,17 @@ repos:
13
14
additional_dependencies :
14
15
- " types-pytz"
15
16
- " types-requests"
17
+ stages : [manual]
18
+
19
+ - repo : https://github.com/psf/black
20
+ rev : 22.3.0
21
+ hooks :
22
+ - id : black
23
+ args :
24
+ - " --line-length=120"
25
+
26
+ - repo : https://github.com/pycqa/isort
27
+ rev : 5.6.4
28
+ hooks :
29
+ - id : isort
30
+ args : [ "--profile", "black", "--filter-files" ]
Original file line number Diff line number Diff line change @@ -424,6 +424,7 @@ We recommend that you use Python3's `venv` for development:
424
424
$ python3 - m venv .venv
425
425
$ . .venv/ bin / activate
426
426
$ pip install - e ' .[tests]'
427
+ $ pre- commit install
427
428
```
428
429
429
430
With `- e` passed to `pip install` above pip can reference the code you are
@@ -441,6 +442,20 @@ When the code is ready, submit a Pull Request.
441
442
See also Trino' s [guidelines](https://github.com/trinodb/trino/blob/master/.github/DEVELOPMENT.md).
442
443
Most of them also apply to code in trino- python- client.
443
444
445
+ # ## `pre-commit` checks
446
+
447
+ Code is automatically checked on commit by a [pre- commit](https:// pre- commit.com/ ) git hook.
448
+
449
+ Following checks are performed:
450
+
451
+ - [`black` ](https:// github.com/ psf/ black) for code formatting
452
+ - [`isort` ](https:// pycqa.github.io/ isort/ ) for sorting imports
453
+
454
+ In the CI build following additional checks are performed. You can manually execute them using `pre- commit run -- hook- stage manual` .
455
+
456
+ - [`flake8` ](https:// flake8.pycqa.org/ en/ latest/ ) for code linting
457
+ - [`mypy` ](https:// mypy.readthedocs.io/ en/ stable/ ) for static type checking
458
+
444
459
# ## Running tests
445
460
446
461
`trino- python- client` uses [pytest](https:// pytest.org/ ) for its tests. To run
Original file line number Diff line number Diff line change 39
39
"pytest" ,
40
40
"pytest-runner" ,
41
41
"click" ,
42
+ "pre-commit" ,
43
+ "black" ,
44
+ "isort" ,
42
45
]
43
46
44
47
setup (
You can’t perform that action at this time.
0 commit comments