-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpyproject.toml
More file actions
217 lines (200 loc) · 7.39 KB
/
pyproject.toml
File metadata and controls
217 lines (200 loc) · 7.39 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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
[build-system]
requires = ["setuptools>=64", "setuptools_scm>=8"]
build-backend = "setuptools.build_meta"
[project]
name = "rmi.dispatch"
description = "A simple and efficient dispatch model."
license = {file = "LICENSE.txt"}
readme = "README.rst"
dynamic = ["version"]
classifiers = [
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]
requires-python = ">=3.10,<3.14"
dependencies = [
"bottleneck >= 1.3,< 1.5.1",
"numba >= 0.60.0,< 0.66",
"numexpr >= 2.8, < 2.14.2",
"numpy >= 1.18.5,< 3",
"pandas >= 1.4,< 2.4",
"pandera >= 0.30.1, < 0.31",
"pyarrow>=7, <25",
"rmi.etoolbox @ git+https://github.com/rmi/etoolbox.git",
]
[project.optional-dependencies]
dev = [
"coverage>=5.3,<7.14", # Lets us track what code is being tested
"pytest>=6.2,<9.1", # test framework
]
doc = [
"doc8>=2.0.0,<2.1",
"furo>=2023.09.10",
"rstcheck[sphinx,toml]>=5.0,<6.3",
"sphinx>=4,!=5.1.0,<8.2.4",
"sphinx-autoapi>=1.8,<3.9",
"sphinx-issues>=1.2,<6.1",
"sphinx-autodoc-typehints>1.19,<3.2.0",
"sphinxcontrib-mermaid>=2.0.1,<2.1.0",
]
qa = [ # in local development these are provided globally, here for GHA
"pre-commit>=2.9,<4.7", # Allow us to run pre-commit hooks in testing
"pre-commit-uv>=4.1,<4.3",
"ruff>0.0.215,<0.12.11",
]
tooling = [ # in local development these are provided globally
"rmi-dispatch[qa]",
"tox>=4.16.0,<4.54", # Python test environment manager
"tox-uv>=1.25,<2",
]
tests = ["rmi-dispatch[dev,tooling]"]
viz = [
"plotly>5.10,<6.8",
"kaleido>0.2,<2",
]
[tool.setuptools.dynamic]
version = {attr = "dispatch._version.__version__"}
[tool.setuptools_scm]
version_file = "src/dispatch/_version.py"
[tool.uv]
constraint-dependencies = ["kaleido!=0.2.1.post1"]
#######################################################################################
# Configurations for linters and other tools
#######################################################################################
[tool.doc8]
max-line-length = 88
ignore-path = "docs/_build"
[tool.pytest.ini_options]
testpaths = ["."]
addopts = ["--verbose", "--doctest-modules"]
log_format = "%(asctime)s [%(levelname)8s] %(name)s:%(lineno)s %(message)s"
log_date_format=" %Y-%m-%d %H:%M:%S"
log_cli = true
log_cli_level = "INFO"
doctest_optionflags = ["NORMALIZE_WHITESPACE", "IGNORE_EXCEPTION_DETAIL", "ELLIPSIS"]
filterwarnings = [
"ignore:distutils Version classes are deprecated:DeprecationWarning",
"ignore:Creating a LegacyVersion:DeprecationWarning:pkg_resources[.*]",
]
[tool.rstcheck]
report_level = "WARNING"
ignore_roles = ["pr", "issue", "user", "include"]
ignore_messages = '(Hyperlink target .* is not referenced\.$|Duplicate implicit target name:|An `AttributeError` error occured.*)'
ignore_directives = ["bibliography", "todo", "include"]
[tool.ruff]
line-length = 88
show-fixes = true
[tool.ruff.format]
# Enable reformatting of code snippets in docstrings.
docstring-code-format = true
[tool.ruff.lint]
select = [ # https://beta.ruff.rs/docs/rules/
"A", # flake8-builtins
"B", # flake8-bugbear
"C",
"C4", # flake8-comprehensions
"D", # flake8-docstrings
"E", # pycodestyle
"F", # Pyflakes
"FBT", # flake8-boolean-trap
"G", # flake8-logging-format
"I", # isort
"TID", # flake8-tidy-imports
"N", # pep8-naming
"PD", # pandas
"PT", # flake8-pytest-style
"PGH", # pygrep-hooks
"S", # bandit
"SIM", # flake8-simplify
"TCH", # flake8-type-checking
"UP", # pyupgrade
"W", # pycodestyle
"RUF", # Ruff-specific rules
"Q", # flake8-quotes
]
ignore = [
"D105",
"D203", # 1 blank line required before class docstring
"D213", # Multi-line docstring summary should start at the second line
"D401", # First line of docstring should be in imperative mood: "{first_line}"
"D407", # dashed-underline-after-section, upsets Sphinx
"D416",
"D417",
"E501", # black handles code line length
# conflict with ruff format
"W191", # tab-indentation
"E111", # indentation-with-invalid-multiple
"E114", # indentation-with-invalid-multiple-comment
"E117", # over-indented
"D206", # indent-with-spaces
"D300", # triple-single-quotes
"Q000", # bad-quotes-inline-string
"Q001", # bad-quotes-multiline-string
"Q002", # bad-quotes-docstring
"Q003", # avoidable-escaped-quote
"COM812", # missing-trailing-comma
"COM819", # prohibited-trailing-comma
"ISC001", # single-line-implicit-string-concatenation
"ISC002", # multi-line-implicit-string-concatenation
]
flake8-tidy-imports.ban-relative-imports = "all"
flake8-type-checking.strict = true
mccabe.max-complexity = 15 # Unlike Flake8, default to a complexity level of 10.
pycodestyle.max-doc-length = 88
pydocstyle.convention = "google"
[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401"]
"docs/conf.py" = ["E501"]
"engine.py" = ["E501", "B905", "S101"]
"model.py" = [
"E501",
"W505", # Doc line too long, these are in doctest lines
# to clean up later
"PD010", # `.pivot_table` is preferred to `.pivot` or `.unstack`; provides same functionality
"PD013", # `.melt` is preferred to `.stack`; provides same functionality
"PD901", # `df` is a bad variable name. Be kinder to your future self.
]
"tests/*.py" = ["S101", "SIM117", "F841", "D101", "PD901", "FBT003"]
"tests/engine_test.py" = ["E501"]
[tool.tox]
env_list = ["linters", "docs", "ci"]
[tool.tox.env_run_base]
allowlist_externals = ["bash", "coverage", "sphinx-build", "pytest", "ruff", "pre-commit"]
runner = "uv-venv-runner"
passenv = ["ETB_AZURE_SAS_TOKEN", "ETB_AZURE_ACCOUNT_NAME"]
extras = ["qa", "dev", "doc", "viz"]
[tool.tox.env.linters]
description = "Run the pre-commit, flake8 and bandit linters."
commands = [
['pre-commit', 'run', '--all-files', '--show-diff-on-failure', 'python-no-eval'],
['pre-commit', 'run', '--all-files', '--show-diff-on-failure', 'python-no-log-warn'],
['pre-commit', 'run', '--all-files', '--show-diff-on-failure', 'python-check-blanket-noqa'],
['pre-commit', 'run', '--all-files', '--show-diff-on-failure', 'check-merge-conflict'],
['pre-commit', 'run', '--all-files', '--show-diff-on-failure', 'check-yaml'],
['pre-commit', 'run', '--all-files', '--show-diff-on-failure', 'check-case-conflict'],
['pre-commit', 'run', '--all-files', '--show-diff-on-failure', 'debug-statements'],
['pre-commit', 'run', '--all-files', '--show-diff-on-failure', 'name-tests-test'],
['ruff', 'check', '.'],
]
[tool.tox.env.docs]
description = "Build the HTML docs from scratch using Sphinx."
commands = [
['bash', '-c', 'rm -rf docs/_build'],
['doc8', 'docs/', 'README.rst'],
['rstcheck', '--config', 'pyproject.toml', '--recursive', './'],
['sphinx-build', '-b', 'html', 'docs', 'docs/_build/html']
]
[tool.tox.env.ci]
description = "un all continuous integration (CI) checks & generate test coverage."
commands = [
['coverage', 'erase'],
['coverage', 'run', '--source={envsitepackagesdir}/dispatch', '-m', 'pytest', '--doctest-modules', '{envsitepackagesdir}/dispatch', 'tests'],
['coverage', 'lcov', '-o', 'coverage.info'],
['coverage', 'report', '--sort=cover']
]