Skip to content

Commit a16bb56

Browse files
authored
69 consolidate pre commit dependencies with poetry (#71)
* Move flake8, codespell configs to pyproject.toml * Switch pre-commit to local repository * Fix pre-commit
1 parent 9ca157c commit a16bb56

File tree

6 files changed

+128
-40
lines changed

6 files changed

+128
-40
lines changed

.flake8

Lines changed: 0 additions & 4 deletions
This file was deleted.

.github/hooks/.pre-commit-config.yml

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,38 +26,42 @@ repos:
2626
- id: absolufy-imports
2727
files: ^src/
2828

29-
- repo: https://github.com/codespell-project/codespell
30-
rev: v2.2.4
29+
- repo: local
3130
hooks:
3231
- id: codespell
32+
name: codespell
33+
entry: codespell
34+
language: system
3335
types_or: [python, rst, markdown]
34-
args: [--ignore-words=.codespell]
36+
files: ^src/
3537

36-
- repo: https://github.com/timothycrosley/isort
37-
rev: 5.12.0
38-
hooks:
3938
- id: isort
40-
name: isort (python)
39+
name: isort
40+
entry: isort
41+
language: system
42+
files: ^src/
4143

42-
- repo: https://github.com/asottile/pyupgrade
43-
rev: v3.3.1
44-
hooks:
4544
- id: pyupgrade
45+
name: pyupgrade
46+
entry: pyupgrade
47+
language: system
4648
args: [--py310-plus]
49+
files: ^src/
4750

48-
- repo: https://github.com/asottile/yesqa
49-
rev: v1.4.0
50-
hooks:
5151
- id: yesqa
52+
name: yesqa
53+
entry: yesqa
54+
language: system
55+
files: ^src/
5256

53-
- repo: https://github.com/psf/black
54-
rev: 23.1.0
55-
hooks:
5657
- id: black
57-
language_version: python3.10
58+
name: black
59+
entry: black
60+
language: system
61+
files: ^src/
5862

59-
- repo: https://github.com/pycqa/flake8
60-
rev: 6.0.0
61-
hooks:
6263
- id: flake8
63-
additional_dependencies: [flake8-isort]
64+
name: flake8
65+
entry: flake8
66+
language: system
67+
files: ^src/

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,11 @@ This is a template repository dedicated to ML projects in python. It provides so
1414

1515
- `.github` - CI/CD pipelines, usually named after repository host (`.github`, `.azure`, `.gitlab`, etc)
1616
- `data` - if you need any data to be present locally, store it here
17-
- `notebooks` - notebooks are particularly _meh_, but this is the directory to put them
17+
- `notebooks` - notebooks are kinda _meh_, but this is the directory to put them
1818
- `src` - here goes your project's code
1919
- `src/cli` - project's entry points should be wrapped with CLI and exposed via Makefile, good idea to store them separately
2020
- `.codespell` - whitelist for project-related terms
2121
- `.coveragearc` - corage config, usually you don't want to report coverage on CLI, tests and some expressions
22-
- `.flake8` - `flake8` config
23-
- `isort.cfg` - `isort` config
2422
- `Makefile` - tasks definitions, much simpler to call `make` than writing whole commands in the terminal
2523
- `mypy.ini` - `mypy` config, usually some of your dependencies won't be hinted so you gonna ignore them here
2624
- `poetry.lock` - compiled dependencies

poetry.lock

Lines changed: 84 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

poetry.toml

Lines changed: 0 additions & 2 deletions
This file was deleted.

pyproject.toml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,32 @@ seaborn = "^0.11.2"
1414

1515
[tool.poetry.group.dev.dependencies]
1616
black = "^23.3.0"
17+
codespell = "^2.2.4"
1718
coverage = "^7.2.2"
1819
flake8 = "^6.0.0"
20+
flake8-isort = "^6.0.0"
1921
isort = "^5.11.4"
2022
mypy = "^1.1.1"
2123
pre-commit = "^3.2.1"
2224
pytest = "^7.1.2"
2325
pytest-cov = "^3.0.0"
26+
pyupgrade = "^3.4.0"
2427
vulture = "^2.7"
28+
yesqa = "^1.4.0"
29+
30+
[tool.flake8]
31+
max-line-length = 88
32+
include = "src"
2533

2634
[tool.isort]
27-
profile = "black"
28-
multi_line_output = 3
29-
include_trailing_comma = "False"
35+
ensure_newline_before_comments = true
3036
force_grid_wrap = 0
31-
use_parentheses = "True"
32-
ensure_newline_before_comments = "True"
37+
include_trailing_comma = true
3338
line_length = 88
39+
multi_line_output = 3
40+
profile = "black"
41+
py_version = '310'
42+
use_parentheses = true
3443

3544
[tool.black]
3645
line-length = 88
@@ -64,9 +73,12 @@ paths = ["src"]
6473
sort_by_size = true
6574
verbose = false
6675

76+
[tool.codespell]
77+
ignore-words = ".codespell"
78+
6779
[tool.pytest.ini_options]
68-
minversion = "7.0"
6980
addopts = "-ra --log-level=CRITICAL"
81+
minversion = "7.0"
7082
filterwarnings = [
7183
"ignore::UserWarning",
7284
"ignore::DeprecationWarning",

0 commit comments

Comments
 (0)