File tree Expand file tree Collapse file tree 18 files changed +3448
-0
lines changed
Expand file tree Collapse file tree 18 files changed +3448
-0
lines changed Original file line number Diff line number Diff line change 1+ [run]
2+ source =src
3+
4+ [report]
5+ exclude_lines =
6+ # Have to re-enable the standard pragma
7+ pragma: no cover
8+
9+ # Don't complain about missing debug-only code:
10+ def __repr__
11+ if self\.debug
12+
13+ # Don't complain if tests don't hit defensive assertion code:
14+ raise AssertionError
15+ raise NotImplementedError
16+
17+ # Don't complain if non-runnable code isn't run:
18+ if 0:
19+ if __name__ == .__main__.:
20+
21+ ignore_errors = True
22+
23+ omit =
24+ */tests/*
25+ */test/*
26+ */cli/*
Original file line number Diff line number Diff line change 1+ [flake8]
2+ max-line-length = 88
3+ extend-ignore = E203
4+ include = src
Original file line number Diff line number Diff line change 1+ exclude : ' .git|.tox'
2+ default_stages : [commit]
3+ fail_fast : true
4+
5+ repos :
6+ - repo : https://github.com/pre-commit/pre-commit-hooks
7+ rev : v4.0.1
8+ hooks :
9+ - id : check-ast
10+ - id : check-case-conflict
11+ - id : check-docstring-first
12+ - id : check-json
13+ - id : check-merge-conflict
14+ - id : check-toml
15+ - id : check-xml
16+ - id : check-yaml
17+ - id : detect-private-key
18+ - id : end-of-file-fixer
19+ - id : no-commit-to-branch
20+ args : ['--branch', 'master']
21+ - id : pretty-format-json
22+ - id : trailing-whitespace
23+
24+ - repo : https://github.com/timothycrosley/isort
25+ rev : 5.10.1
26+ hooks :
27+ - id : isort
28+ name : isort (python)
29+
30+ - repo : https://github.com/psf/black
31+ rev : 22.3.0
32+ hooks :
33+ - id : black
34+ language_version : python3.8
35+
36+ - repo : https://gitlab.com/pycqa/flake8
37+ rev : 4.0.1
38+ hooks :
39+ - id : flake8
40+ additional_dependencies : [flake8-isort]
Original file line number Diff line number Diff line change 1+ name : build
2+
3+ on : [push, pull_request]
4+
5+ jobs :
6+ build :
7+ runs-on : ubuntu-latest
8+
9+ steps :
10+
11+ - name : Checkout repository
12+ uses : actions/checkout@v2
13+
14+ - name : Set up Python 3.9
15+ uses : actions/setup-python@v2
16+ with :
17+ python-version : 3.9
18+
19+ - name : Install Poetry
20+ uses : snok/install-poetry@v1
21+ with :
22+ virtualenvs-in-project : true
23+ virtualenvs-path : .venv
24+
25+ - name : Cache Poetry
26+ uses : actions/cache@v3
27+ with :
28+ path : .venv
29+ key : venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
30+
31+ - name : Install dependencies
32+ if : steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
33+ run : poetry install --no-interaction --no-root
34+
35+ - name : Linter
36+ run : |
37+ poetry run flake8 src
38+
39+ - name : Mypy
40+ run : |
41+ poetry run mypy --incremental --show-error-codes --pretty src
42+
43+ - name : Tests
44+ run : |
45+ poetry run coverage run -m pytest src --cov-config=.coveragerc --junit-xml=junit/test-results.xml --cov-report=html --cov-report=xml
46+
47+ - name : Tests Coverage
48+ run : |
49+ poetry run coverage html
50+ poetry run coverage xml
51+ poetry run coverage report --show-missing
52+
53+ # Upload your code coverage here
54+ # - name: Upload codecov
55+ # uses: codecov/codecov-action@v1
56+ # with:
57+ # fail_ci_if_error: true
Original file line number Diff line number Diff line change 1+ # Byte-compiled / optimized / DLL files
2+ __pycache__ /
3+ * .py [cod ]
4+ * $py.class
5+
6+ # C extensions
7+ * .so
8+
9+
10+ # Distribution / packaging
11+ .Python
12+ build /
13+ develop-eggs /
14+ dist /
15+ downloads /
16+ eggs /
17+ .eggs /
18+ lib64 /
19+ parts /
20+ sdist /
21+ var /
22+ wheels /
23+ * .egg-info /
24+ .installed.cfg
25+ * .egg
26+ MANIFEST
27+
28+ # PyInstaller
29+ # Usually these files are written by a python script from a template
30+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
31+ * .manifest
32+ * .spec
33+
34+ # Installer logs
35+ pip-log.txt
36+ pip-delete-this-directory.txt
37+
38+ # Unit test / coverage reports
39+ htmlcov /
40+ .tox /
41+ .coverage
42+ .coverage. *
43+ .cache
44+ nosetests.xml
45+ coverage.xml
46+ * .cover
47+ .hypothesis /
48+ .pytest_cache /
49+
50+ # Translations
51+ * .mo
52+ * .pot
53+
54+ # Django stuff:
55+ * .log
56+ local_settings.py
57+ db.sqlite3
58+
59+ # Flask stuff:
60+ instance /
61+ .webassets-cache
62+
63+ # Scrapy stuff:
64+ .scrapy
65+
66+ # Sphinx documentation
67+ docs /_build /
68+
69+ # PyBuilder
70+ target /
71+
72+ # Jupyter Notebook
73+ .ipynb_checkpoints
74+
75+ # pyenv
76+ .python-version
77+
78+ # celery beat schedule file
79+ celerybeat-schedule
80+
81+ # SageMath parsed files
82+ * .sage.py
83+
84+ # Environments
85+ .env
86+ .venv
87+ .envrc
88+ env /
89+ venv /
90+ ENV /
91+ env.bak /
92+ venv.bak /
93+
94+ # Spyder project settings
95+ .spyderproject
96+ .spyproject
97+
98+ # Rope project settings
99+ .ropeproject
100+
101+ # mkdocs documentation
102+ /site
103+
104+ # mypy
105+ .mypy_cache /
106+
107+ # Project's custom
108+ .vscode /
109+ .idea /
Original file line number Diff line number Diff line change 1+ [settings]
2+ multi_line_output = 3
3+ include_trailing_comma = True
4+ force_grid_wrap = 0
5+ use_parentheses = True
6+ ensure_newline_before_comments = True
7+ line_length = 88
Original file line number Diff line number Diff line change 1+ # Installation
2+ setup_venv :
3+ poetry install --no-root
4+
5+ install_pre_commit :
6+ poetry run pre-commit install -c .github/hooks/.pre-commit-config.yml
7+
8+ install_dev : setup_venv install_pre_commit
9+
10+ # Dev tools
11+ isort :
12+ poetry run isort src
13+
14+ black :
15+ poetry run black --config pyproject.toml src
16+
17+ # pre-commit flake8 runs only against staged files
18+ flake8 :
19+ poetry run flake8 src
20+
21+ format : isort black
22+
23+ mypy :
24+ poetry run mypy --incremental --show-error-codes --pretty src
25+
26+ pre_commit :
27+ poetry run pre-commit run -a -c .github/hooks/.pre-commit-config.yml
28+
29+ test :
30+ poetry run pytest src
31+
32+ test_cov :
33+ poetry run coverage run -m pytest src --cov-config=.coveragerc --junit-xml=junit/test-results.xml --cov-report=html --cov-report=xml
34+ poetry run coverage html
35+ poetry run coverage xml
36+ poetry run coverage report --show-missing
37+
38+ compile_env :
39+ poetry lock --no-update
40+
41+ build : isort black pre_commit flake8 mypy test
42+
43+ # Misc
44+ jupyter :
45+ poetry run jupyter notebook
Original file line number Diff line number Diff line change 11# python-template
2+
3+ ## Developer Guide
4+
5+ Setup your local environment:
6+
7+ ``` sh
8+ make install_dev
9+ ```
10+
11+ This command will create local ` .venv ` managed by ` poetry ` and install ` pre-commit ` .
12+
13+ ### [ pre-commit] ( .github/hooks/.pre-commit-config.yml )
14+
15+ - syntax checks
16+ - no commit to master
17+ - ` isort `
18+ - ` black `
19+ - ` flake8 `
20+
21+ ### [ Makefile] ( Makefile )
22+
23+ - ` setup_venv `
24+ - ` install_pre_commit `
25+ - ` install_dev ` : : ` setup_venv ` ` install_pre_commit `
26+ - ` isort `
27+ - ` black `
28+ - ` flake8 `
29+ - ` format ` : ` isort ` ` black `
30+ - ` mypy `
31+ - ` pre_commit `
32+ - ` test `
33+ - ` test_cov `
34+ - ` compile_env `
35+ - ` build ` : ` isort ` ` black ` ` pre_commit ` ` flake8 ` ` mypy ` ` test `
36+
37+ To quickly format repo while coding run:
38+
39+ ``` sh
40+ make format
41+ ```
42+
43+ It's also useful to run ` flake8 ` as ` pre-commit ` runs it only against staged files.
44+
45+ ``` sh
46+ make flake8
47+ ```
48+
49+ Before you commit, it's good to run a full check:
50+
51+ ``` sh
52+ make build
53+ ```
You can’t perform that action at this time.
0 commit comments