File tree Expand file tree Collapse file tree 5 files changed +47
-2
lines changed Expand file tree Collapse file tree 5 files changed +47
-2
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 2727 run : pip install pre-commit
2828
2929 - name : " Run pre-commit checks"
30- run : pre-commit run --all-files
30+ run : pre-commit run --hook-stage manual -- all-files
3131
3232 build :
3333 runs-on : ubuntu-latest
Original file line number Diff line number Diff line change 44 hooks :
55 - id : " flake8"
66 name : " Python: analysis"
7+ stages : [manual]
78
89 - repo : " https://github.com/pre-commit/mirrors-mypy"
910 rev : " v0.910"
@@ -13,3 +14,17 @@ repos:
1314 additional_dependencies :
1415 - " types-pytz"
1516 - " 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"]
Original file line number Diff line number Diff line change @@ -424,6 +424,7 @@ We recommend that you use Python3's `venv` for development:
424424$ python3 - m venv .venv
425425$ . .venv/ bin / activate
426426$ pip install - e ' .[tests]'
427+ $ pre- commit install
427428```
428429
429430With `- 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.
441442See also Trino' s [guidelines](https://github.com/trinodb/trino/blob/master/.github/DEVELOPMENT.md).
442443Most of them also apply to code in trino- python- client.
443444
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+
444459# ## Running tests
445460
446461`trino- python- client` uses [pytest](https:// pytest.org/ ) for its tests. To run
Original file line number Diff line number Diff line change 3939 "pytest" ,
4040 "pytest-runner" ,
4141 "click" ,
42+ "pre-commit" ,
43+ "black" ,
44+ "isort" ,
4245]
4346
4447setup (
7578 "Programming Language :: Python :: Implementation :: PyPy" ,
7679 "Topic :: Database :: Front-Ends" ,
7780 ],
78- python_requires = ' >=3.7' ,
81+ python_requires = " >=3.7" ,
7982 install_requires = ["pytz" , "requests" ],
8083 extras_require = {
8184 "all" : all_require ,
You can’t perform that action at this time.
0 commit comments