-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpyproject.toml
144 lines (130 loc) · 4.39 KB
/
pyproject.toml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
[tool.poetry]
name = "tech-coach-examples"
version = "0.1.0"
description = ""
authors = ["Arne Sørli <81353974+arneso-ssb@users.noreply.github.com>"]
license = "MIT"
# To include functions in Jupyter Notebooks from other parts of the directory tree,
# without using ProjectRoot from ssb-fagfunksjoner.
packages = [
{ include = "config" },
]
[tool.poetry.dependencies]
python = "^3.10"
papermill = ">=2.4.0"
dapla-toolbelt = ">=1.8.2"
pandas = {extras = ["gcp", "performance"], version = ">=2.0.2"}
duckdb = ">=0.9.1"
tomli = ">=2.0.1"
ssb-fagfunksjoner = ">=0.1.0"
polars = ">=0.20.14"
python-dotenv = ">=1.0.1"
google-cloud-secret-manager = ">=2.19.0"
cryptography = ">=42.0.5"
tzdata = ">=2024.1"
colorlog = ">=6.8.2"
google-cloud-logging = ">=3.11.2"
dynaconf = ">=3.2.6"
pydantic = {extras = ["mypy"], version = ">=2.10.6"}
[tool.poetry.group.dev.dependencies]
black = {extras = ["d", "jupyter"], version = ">=23.3.0"}
isort = ">=5.12.0"
jupyter = ">=1.0.0"
jupytext = ">=1.15.2"
nbstripout = ">=0.6.1"
pre-commit = ">=3.3.1"
pre-commit-hooks = ">=4.4.0"
pytest = ">=7.3.1"
ruff = ">=0.1.3"
pytest-cov = ">=4.1.0"
faker = ">=24.11.0"
mypy = ">=1.14.1"
datamodel-code-generator = ">=0.26.5"
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
[tool.pytest.ini_options]
pythonpath = ["src"]
testpaths = ["tests"]
[tool.coverage.run]
branch = true
relative_files = true
[tool.coverage.report]
skip_empty = true
[tool.isort]
profile = "black"
force_single_line = true
skip_gitignore = true
lines_after_imports = 2
# The line below is needed for jupyter notebooks stored as .py in percent format.
# See https://github.com/PyCQA/isort/issues/1338 for details
treat_comments_as_code = ["# %%"]
[tool.jupytext]
formats = "ipynb,auto:percent"
notebook_metadata_filter = "jupytext.text_representation,-jupytext.text_representation.jupytext_version,-widgets,-varInspector"
cell_metadata_filter = "-papermill,tags"
[tool.mypy]
plugins = [
"pydantic.mypy"
]
[tool.ruff]
force-exclude = true # Apply excludes to pre-commit
show-fixes = true
# src = ["src", "tests"]
target-version = "py310" # Minimum Python version supported
include = ["*.py", "*.pyi", "**/pyproject.toml", "*.ipynb"]
extend-exclude = [
"__pycache__",
"old",
".ipynb_checkpoints",
"noxfile.py",
"docs/conf.py",
]
# Ruff rules may be customized as desired: https://docs.astral.sh/ruff/rules/
[tool.ruff.lint]
select = [
"A", # prevent using keywords that clobber python builtins
"B", # bugbear: security warnings
"D", # pydocstyle
"E", # pycodestyle
"F", # pyflakes
"ISC", # implicit string concatenation
"UP", # alert you when better syntax is available in your python version
"RUF", # the ruff developer's own rules
]
ignore = [
"ANN202", # Don't requiere return type annotation for private functions.
"ANN401", # Allow type annotation with type Any.
"D100", # Supress undocumented-public-module. Only doc of public api required.
"E402", # Supress module-import-not-at-top-of-file, needed in jupyter notebooks.
"E501", # Supress line-too-long warnings: trust black's judgement on this one.
"I001", # Don't use ruff to sort imports because of jupytext files.
"T201", # Allow print statements.
"ERA001", # Allow commented-out code, needed for jupytext.
"INP001", # Don't require __init__.py file.
"PD901", # Allow df as variable name.
"B018", # Like T201, allow expressions printing variables in notebooks.
"C408", # Allow unnecessary collection call since can be more readable.
"D101", # Don't require docstring.
"D102", # Don't require docstring.
"D103", # Don't require docstring.
"D107", # Don't require docstring.
]
[tool.ruff.lint.mccabe]
max-complexity = 15
[tool.ruff.lint.pydocstyle]
convention = "google" # You can also use "numpy".
[tool.ruff.lint.per-file-ignores]
"*/__init__.py" = ["F401"]
"**/tests/*" = [
"ANN003", # type annotations don't add value for test functions
"ANN201", # type annotations don't add value for test functions
"ANN204", # type annotations don't add value for test functions
"ANN205", # type annotations don't add value for test functions
"ANN206", # type annotations don't add value for test functions
"D100", # docstrings are overkill for test functions
"D101",
"D102",
"D103",
"S101", # asserts are encouraged in pytest
]