-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathpyproject.toml
More file actions
283 lines (259 loc) · 11.4 KB
/
pyproject.toml
File metadata and controls
283 lines (259 loc) · 11.4 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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
[build-system]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"
[project]
name = "querychat"
dynamic = ["version"]
description = "Chat with your data using natural language"
readme = "pkg-py/README.md"
requires-python = ">=3.10"
license = { file = "pkg-py/LICENSE" }
authors = [
{ name = "Joe Cheng", email = "joe@posit.co" },
{ name = "Garrick Aden-Buie", email = "garrick@posit.co" },
{ name = "Carson Sievert", email = "carson@posit.co" },
{ name = "Dan Chen", email = "daniel.chen@posit.co" },
{ name = "Barret Schloerke", email = "barret@posit.co" }
]
maintainers = [
{ name = "Garrick Aden-Buie", email = "garrick@posit.co" }
]
dependencies = [
"duckdb",
"shiny @ git+https://github.com/posit-dev/py-shiny.git",
"shinychat @ git+https://github.com/posit-dev/shinychat.git",
"htmltools",
"chatlas>=0.13.2",
"narwhals>=2.2.0",
"chevron",
"sqlalchemy>=2.0.0", # Using 2.0+ for improved type hints and API
"great-tables>=0.16.0",
]
classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
]
[project.optional-dependencies]
# For SQLAlchemySource and sample data, one of polars or pandas is required
pandas = ["pandas"]
polars = ["polars", "pyarrow"] # duckdb requires pyarrow for polars DataFrame registration
ibis = ["ibis-framework>=9.0.0", "pandas"] # pandas required for ibis .execute() to return DataFrames
# Web framework extras
streamlit = ["streamlit>=1.30"]
gradio = ["gradio>=6.0"]
dash = ["dash-ag-grid>=31.0", "dash[async]>=3.1", "dash-bootstrap-components>=2.0", "pandas"]
# Visualization with ggsql
viz = [
# Temporary direct reference until ggsql 0.3.0 is available on the package index.
"ggsql @ git+https://github.com/posit-dev/ggsql-python.git@refs/pull/5/head",
"altair>=6.0",
"shinywidgets>=0.8.0",
"vl-convert-python>=1.9.0",
]
[project.urls]
Homepage = "https://github.com/posit-dev/querychat" # TODO update when we have docs
Repository = "https://github.com/posit-dev/querychat"
Issues = "https://github.com/posit-dev/querychat/issues"
Source = "https://github.com/posit-dev/querychat/tree/main/pkg-py"
[tool.uv]
# Restrict lock-file resolution to platforms we actually target in CI.
# Without this, uv may resolve dependency versions whose wheels aren't
# available on all platforms (e.g. non-x86_64 Linux), causing CI failures.
required-environments = [
"sys_platform == 'linux' and platform_machine == 'x86_64'",
"sys_platform == 'darwin'",
]
[tool.hatch.metadata]
allow-direct-references = true
[tool.hatch.build.targets.wheel]
packages = ["pkg-py/src/querychat"]
include = ["py.typed"]
[tool.hatch.build.targets.sdist]
include = ["pkg-py/src/querychat", "pkg-py/LICENSE", "pkg-py/README.md"]
[tool.hatch.version]
source = "vcs"
tag-pattern = "^py/(?:[\\w-]+-)?(?P<version>[vV]?\\d+(?:\\.\\d+){0,2}[^\\+]*)(?:\\+.*)?$"
[tool.hatch.version.raw-options]
git_describe_command = "git describe --dirty --tags --long --match 'py/v*'"
[tool.hatch.build.hooks.vcs]
version-file = "pkg-py/src/querychat/__version.py"
[dependency-groups]
dev = [
"ruff>=0.6.5",
"pyright>=1.1.401",
"tox-uv>=1.11.4",
"pytest>=8.4.0",
"polars>=1.0.0",
"pyarrow>=14.0.0",
"ibis-framework[duckdb]>=9.0.0",
# Temporary direct reference until ggsql 0.3.0 is available on the package index.
"ggsql @ git+https://github.com/posit-dev/ggsql-python.git@refs/pull/5/head",
"altair>=6.0",
"shinywidgets>=0.8.0",
"vl-convert-python>=1.9.0",
]
docs = ["quartodoc>=0.11.1", "griffe<2", "nbformat", "nbclient", "ipykernel"]
examples = [
"openai",
"palmerpenguins>=0.1.4",
"seaborn",
]
streamlit = ["streamlit>=1.30"]
gradio = ["gradio>=6.0"]
dash = ["dash-ag-grid>=31.0", "dash[async]>=3.1", "dash-bootstrap-components>=2.0", "pandas"]
test = [
"pytest>=8.0.0",
"pytest-playwright>=0.5.0",
"pytest-xdist>=3.5.0",
"pytest-rerunfailures>=14.0",
"playwright>=1.40.0",
]
[tool.ruff]
src = ["pkg-py/src/querychat"]
exclude = [
"__version.py",
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".ipynb_checkpoints",
".mypy_cache",
".nox",
".pants.d",
".pyenv",
".pytest_cache",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
".vscode",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"site-packages",
"venv",
"app-*.py", # ignore example apps for now
"app.py",
"examples", # ignore example apps for now
]
line-length = 88
indent-width = 4
target-version = "py310"
[tool.ruff.lint]
extend-ignore = [
"A002", # Shadowing a built-in
"ARG001", # Unused argument
"D103", # Missing docstring in public function
"D200", # One-line docstring should fit on one line with quotes
"D203", # 1 blank line required before class docstring
"D212", # Multi-line docstring summary should start at the first line
"E501", # Line too long
"ISC001", # single-line-implicit-string-concatenation
"ISC002", # multi-line-implicit-string-concatenation
"PLC0415", # Imports inside functions (intentional lazy loading for optional deps)
"PLR0913", # Too many arguments in function definition
"PLR0915", # Too many statements in function
"RET504", # Unnecessary assignment to `{name}` before `return` statement
"RET505", # Unnecessary branch after `return` statement
"UP007", # Use `X | Y` for type annotations (or Optional[X])
# This package trusts the user
"S608", # Possible SQL injection vector through string-based query construction
# TODO: Remove in the future, when we have docstrings.
"D100", # Missing docstring in public module
"D101", # Missing docstring in public class
"D102", # Missing docstring in public method
"D104", # Missing docstring in public package
"D107", # Missing docstring in __init__
"D205", # 1 blank line required between summary line and description
"UP045", # Use `X | NULL` for type annotations, not `Optional[X]`
"TD003", # TODO doesn't need to have an issue link
"COM812", # conflicts with formatter
]
extend-select = [
# "C90", # C90; mccabe: https://docs.astral.sh/ruff/rules/complex-structure/
"ASYNC", # ASYNC; flake8-async: https://docs.astral.sh/ruff/rules/#flake8-async-async
"S", # S; flake8-bandit: https://docs.astral.sh/ruff/rules/#flake8-bandit-s
"FBT", # FBT; flake8-boolean-trap: https://docs.astral.sh/ruff/rules/#flake8-boolean-trap-fbt
"B", # B; flake8-bugbear: https://docs.astral.sh/ruff/rules/#flake8-bugbear-b
"A", # A; flake8-builtins: https://docs.astral.sh/ruff/rules/#flake8-builtins-a
"COM", # COM; Commas: https://docs.astral.sh/ruff/rules/#flake8-commas-com
"C4", # C4; flake8-comprehensions: https://docs.astral.sh/ruff/rules/#flake8-comprehensions-c4
"DTZ", # DTZ; flake8-datetimez: https://docs.astral.sh/ruff/rules/#flake8-datetimez-dtz
"T10", # T10; flake8-dbugger: https://docs.astral.sh/ruff/rules/#flake8-debugger-t10
"FA", # FA; flake8-future-annotations: https://docs.astral.sh/ruff/rules/#flake8-future-annotations-fa
"ISC", # ISC; flake8-implicit-str-concat: https://docs.astral.sh/ruff/rules/#flake8-implicit-str-concat-isc
"ICN", # ICN; flake8-import-conventions: https://docs.astral.sh/ruff/rules/#flake8-import-conventions-icn
"PIE", # PIE; flake8-pie: https://docs.astral.sh/ruff/rules/#flake8-pie-pie
"PYI", # PYI; flake8-pyi : https://docs.astral.sh/ruff/rules/#flake8-pyi-pyi
"PT", # PT; flake8-pytest-style: https://docs.astral.sh/ruff/rules/#flake8-pytest-style-pt
"Q", # Q; flake8-quotes: https://docs.astral.sh/ruff/rules/#flake8-quotes-q
"RET", # RET; flake8-return: https://docs.astral.sh/ruff/rules/#flake8-return-ret
"SIM", # SIM; flake8-simplify: https://docs.astral.sh/ruff/rules/#flake8-simplify-sim
"TID253", # banned-module-level-imports: https://docs.astral.sh/ruff/rules/banned-module-level-imports/#banned-module-level-imports-tid253
"TC", # TC; flake8-type-checking: https://docs.astral.sh/ruff/rules/#flake8-type-checking-tch
"TD", # TD; flake8-todos: https://docs.astral.sh/ruff/rules/#flake8-todosimports-td
"ARG", # ARG; flake8-argparse: https://docs.astral.sh/ruff/rules/#flake8-unused-arguments-arg
"PTH", # PTH; flake8-use-pathlib: https://docs.astral.sh/ruff/rules/#flake8-use-pathlib-pth
"I", # I; isort: https://docs.astral.sh/ruff/rules/#isort-i
"NPY", # NPY; NumPy-specific rules: https://docs.astral.sh/ruff/rules/#numpy-specific-rules-npy
"PD", # PD; pandas-vet: https://docs.astral.sh/ruff/rules/#pandas-vet-pd
"N", # N; pep8-naming: https://docs.astral.sh/ruff/rules/#pep8-naming-n
"PERF", # PERF; flake8-performance: https://docs.astral.sh/ruff/rules/#flake8-performance-perf
"E", # E; pycodestyle: https://docs.astral.sh/ruff/rules/#pycodestyle-e-w
"W", # W; pycodestyle: https://docs.astral.sh/ruff/rules/#pycodestyle-e-w
"D", # D; pydocstyle: https://docs.astral.sh/ruff/rules/#pydocstyle-d
"F", # F; Pyflakes: https://docs.astral.sh/ruff/rules/#pyflakes-f
"PGH", # PGH; pygrep-hooks: https://docs.astral.sh/ruff/rules/#pygrep-hooks-pgh
"PL", # PL; pylint: https://docs.astral.sh/ruff/rules/#pylint-pl
"UP", # UP; pyupgrade: https://docs.astral.sh/ruff/rules/#pyupgrade-up
"FURB", # FURB; refurb: https://docs.astral.sh/ruff/rules/#refurb-furb
"RUF", # RUF; Ruff specific rules: https://docs.astral.sh/ruff/rules/#ruff-specific-rules-ruf
]
# Allow fix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
unfixable = []
# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
# disable S101 (flagging asserts) for tests
[tool.ruff.lint.per-file-ignores]
"pkg-py/tests/*.py" = ["S101", "PLR2004", "ARG", "PLW0108"] # Allow assert, magic numbers, unused args, and unnecessary lambdas in tests
"pkg-py/tests/playwright/*.py" = ["S101", "PLR2004", "S310", "S603", "S607", "PERF203"] # Test fixtures launch subprocesses
"pkg-py/examples/tests/*.py" = ["S101", "PLR2004"] # Allow assert and magic numbers in tests
"pkg-py/src/querychat/_dash.py" = ["E402"] # Backwards-compat aliases at end of file
"pkg-py/src/querychat/_gradio.py" = ["E402"] # Backwards-compat aliases at end of file
"pkg-py/src/querychat/_streamlit.py" = ["E402"] # Backwards-compat aliases at end of file
"pkg-py/src/querychat/types/__init__.py" = ["A005"] # Deliberately shadows stdlib types module
"pkg-py/docs/_screenshots/*.py" = ["S310", "PLR2004", "PERF203"] # Dev utility scripts
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "auto"
docstring-code-format = true
docstring-code-line-length = "dynamic"
[tool.pytest.ini_options]
markers = ["ggsql: requires working ggsql.render_altair()"]
[tool.pyright]
include = ["pkg-py/src/querychat"]
# For more tox testing usage (in addition to typing), see:
# https://github.com/posit-dev/chatlas/blob/b91c020a555917c1be5ae2462496de25d82c529d/pyproject.toml#L122-L139
[tool.tox]
legacy_tox_ini = """
[tox]
env_list = py3{10,11,12,13,14}
isolated_build = True
[testenv]
package = wheel
wheel_build_env = .pkg
commands = pyright
"""