-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
188 lines (164 loc) · 4.59 KB
/
pyproject.toml
File metadata and controls
188 lines (164 loc) · 4.59 KB
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
[project]
name = "ds-platform-utils"
version = "0.4.1"
description = "Utility library for Pattern Data Science."
readme = "README.md"
authors = [
{ name = "Amit Vikram Raj", email = "amit.raj@pattern.com" },
{ name = "Eric Riddoch", email = "eric.riddoch@pattern.com" }
]
# requires-python = ">=3.7"
dependencies = [
"outerbounds>=0.3.159",
"pydantic>=2",
"snowflake-connector-python>=3",
"PyYAML",
"pyarrow",
"pandas",
"jinja2",
"sqlparse>=0.5.3",
"polars>=1.36.1",
]
[dependency-groups]
dev = [
"poethepoet>=0.34.0",
"pre-commit>=4.2.0",
"pytest>=8.3.5",
"pytest-cov>=6.1.1",
"ruff>=0.11.7",
"ipykernel>=6.30.0",
"pytest-xdist>=3.8.0",
]
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
# https://github.com/astral-sh/ruff?tab=readme-ov-file#configuration
[tool.ruff]
line-length = 119
# https://docs.astral.sh/ruff/rules/
[tool.ruff.lint]
extend-select = [
# pycodestyle errors
"E",
# flake8-bugbear
"B",
# pylint equivalent rules
"PL",
# isort
"I",
# pydocstyle for docstrings
"D",
# pep8-naming
"N",
]
ignore = [
"D107", # Missing docstring in `__init__`
"E501", # Line too long
"D100", # Missing docstring in public module
"D104", # Missing docstring in public package
"D103", # Missing docstring in public function
"D101", # Missing docstring in public class
"D401", # First line of docstring should be in imperative mood
# Magic value used in comparison, consider replacing `4` with a constant variable -- Is problem for tests
"PLR2004",
# `with` statement variable `tmp_dir` overwritten by assignment target, eg: tests/unit_tests/components/metaflow_project/test__metaflow_project_.py:17:9
"PLW2901",
"PLC0415", # `import` should be at the top-level of a file
]
# https://docs.astral.sh/ruff/rules/#mccabe-c90
[tool.ruff.lint.mccabe]
max-complexity = 10
[tool.pytest.ini_options]
markers = ["slow: marks tests as slow (deselect with '-m \"not slow\"')"]
pythonpath = ["."]
norecursedirs = [
"src/ds_platform_utils/samples/python_tests",
"example-project",
"tests/artifacts",
]
addopts = [
"--cov=src",
"--cov-fail-under=30", # THIS SHOULD BE ATLEAST 90% in the future
"--junitxml=test-reports/report.xml",
"--cov-report=xml",
"--cov-report=html",
"--cov-report=term",
]
[tool.coverage.paths]
source = ["src/"]
[tool.coverage.report]
exclude_also = [
"pragma: no cover",
"if False",
"def __repr__",
"if self.debug",
"raise AssertionError",
"raise NotImplementedError",
"raise MemoryError",
"except DistributionNotFound",
"except ImportError",
"@abc.abstractmethod",
"if 0:",
"if __name__ == .__main__.:",
"if typing.TYPE_CHECKING:",
"if TYPE_CHECKING:",
]
omit = ["tests/artifacts/*"]
show_missing = true
# Had to disable branch coverage because it was causing errors while generating coverage reports
# DataError: Can't combine statement coverage data with branch data
# DISABLING `branch=false` didn't make any difference
[tool.coverage.run]
branch = true
parallel = true
data_file = "test-reports/.coverage"
[tool.coverage.xml]
output = "test-reports/coverage.xml"
[tool.coverage.html]
directory = "test-reports/htmlcov"
[tool.coverage.json]
output = "test-reports/coverage.json"
# Poe Tasks
[tool.poe]
executor.type = "uv"
[tool.poe.tasks.lint]
cmd = "uvx pre-commit run --all-files"
help = "Run linting, formatting, projen synth, and other static code quality tools"
[tool.poe.tasks.test]
cmd = "pytest"
help = "Run all tests with optional additional arguments"
[tool.poe.tasks.serve-coverage-report]
help = "Serve the coverage report on http://localhost:3333"
shell = """
echo "Serving coverage report on http://localhost:3333"
echo "Press Ctrl+C to stop the server"
python -m http.server 3333 --directory ./test-reports/htmlcov
"""
[tool.poe.tasks.clean]
help = "Remove all files generated by tests, builds, or operating this codebase"
shell = """
rm -rf dist build coverage.xml test-reports sample/ tests/artifacts/
find . \\
-type d \\
\\( \\
-name "*cache*" \\
-o -name "*.dist-info" \\
-o -name "*.egg-info" \\
-o -name "*htmlcov" \\
-o -name "*.metaflow" \\
-o -name "*.metaflow.s3" \\
-o -name "*.mypy_cache" \\
-o -name "*.pytest_cache" \\
-o -name "*.ruff_cache" \\
-o -name "*__pycache__" \\
\\) \\
-not -path "*env/*" \\
-exec rm -r {} + || true
find . \\
-type f \\
-name "*.pyc" \\
-o -name "*.DS_Store" \\
-o -name "*.coverage*" \\
-not -path "*env/*" \\
-exec rm {} +
"""