Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
177 lines (161 loc) · 4.66 KB
/
Copy pathpyproject.toml
File metadata and controls
177 lines (161 loc) · 4.66 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
[build-system]
requires = ["setuptools >= 77", "setuptools_scm >= 8"]
build-backend = "setuptools.build_meta"
[project]
name = "src"
description = "Package for storing reusable functions and classes during experimentations."
authors = [
{ name = "Guillem Hurault" },
]
readme = "README.md"
license = "MIT"
license-files = ["LICENSE"]
classifiers = [
"Programming Language :: Python :: 3",
]
dependencies = []
requires-python = ">=3.10"
dynamic = ["version"]
[project.optional-dependencies]
# Use this to specify packages used in analysis but not specified in src.
# This is most useful when CI is setup to control whether analysis dependencies should be installed in the environment or not.
# Otherwise, all dependencies can be specified as core dependencies above.
analysis = [
"matplotlib",
"numpy",
"pandas",
"plotnine",
]
[dependency-groups]
test = [
"pytest",
"pytest-cov",
]
dev = [
"black",
"ipykernel",
"ipywidgets",
"pdoc",
"pre-commit",
"pylint_xxp @ git+https://github.com/ghurault/pylint-xxp.git",
"ruff",
"sqlfluff", # Required in the environment for the VSC extension
"uv",
{ include-group = "test" },
]
[project.urls]
# Homepage = ""
# Documentation = ""
# Repository = ""
# Issues = ""
[tool.setuptools]
# Declare the package explicitly: a directory named `src` would otherwise make
# setuptools assume a src-layout and install `config`/`constants` as top-level modules
packages = ["src"]
[tool.setuptools_scm]
fallback_version = "0.0.0" # Used when git metadata is unavailable (e.g. downloaded archive)
[tool.pyright]
typeCheckingMode = "standard"
exclude = ["**/.*", "**/__pycache__", "**/node_modules", "data"] # Mostly for CLI
reportUnnecessaryTypeIgnoreComment = false # Can have discrepancy between CLI and Language Server if set to true
[[tool.pyright.executionEnvironments]]
# Override settings for analysis directory (since not possible to have a separate typeCheckingMode)
root = "analysis"
reportMissingImports = false
reportWildcardImportFromLibrary = false
reportAttributeAccessIssue = false
reportArgumentType = false
reportUnusedExpression = false
reportCallIssue = false
reportFunctionMemberAccess = false
reportIncompatibleMethodOverride = false
reportIncompatibleVariableOverride = false
reportOverlappingOverload = false
reportPossiblyUnboundVariable = false
[tool.ruff.lint]
select = [
"A", # builtins
"B", # flake8-bugbear
"C4", # comprehensions
"C90", # McCabe cyclomatic complexity
"D", # pydocstyle
"E", # pycodestyle error
"F", # pyflakes
"FURB", # modernising Python codebase
"I", # isort
"ICN", # import conventions
"N", # PEP8 naming
"NPY", # numpy
"PD", # pandas
"PERF", # performance
"PGH004", # Use specific rules in noqa
"PIE790", # Unnecessary placeholders
"PLC", # pylint convention
"PLE", # pylint error
"PLR", # pylint refactoring
"PLW", # pylint warning
"RUF", # ruff specific rules
"S", # bandit (security issues)
"SIM", # flake8-simplify
"TID", # Tidy imports
"TRY300", # Use else block in try-except
"UP", # pyupgrade
"W", # pycodestyle warning
]
ignore = [
"D102", # Missing docstring in public method
"D103", # Missing docstring in public function
"D107", # Missing docstring in __init__
"D202", # Blank line after function docstring
"E501", # Avoid enforcing line-length violations
"PD015", # Use pd.merge
"PERF203", # Try-except in loop
]
[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["E402"] # Ignore import violations
"analysis/*" = [
"B018", # Useless expression
"B028", # No explicit stacklevel for warnings
"D101", # Missing docstring in public class
"F403", # Use of wildcard imports
"F405", # Undefined names because of wildcard imports
"PLR2004", # Magic values
"S", # Disable bandit on analysis files
]
"tests/*" = [
"D100", # Undocumented public module
"D101", # Missing docstring in public class
"PLR2004", # Magic values
"S101", # Use of assert in tests
]
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.ruff.lint.pylint]
max-args = 7
max-positional-args = 3
[tool.ruff.lint.pep8-naming]
extend-ignore-names = ["X", "X_*"]
[tool.ruff.lint.isort]
known-first-party = [
"src",
] # Add others local/private packages
known-local-folder = [
"_local_helpers",
] # Use this convention to treat module in analysis directories as local
[tool.pylint]
load-plugins = ["pylint_xxp.check_function_name"]
disable = "all"
enable = ["C9001"]
[tool.pytest.ini_options]
testpaths = ["src", "tests"]
python_files = ["test_*.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
addopts = [
"--color=yes",
"--cov-report=term-missing",
"--cov=src",
"--cov=tests",
"--doctest-modules",
]
doctest_optionflags = "NORMALIZE_WHITESPACE ELLIPSIS"