Debian Codegraph @

pyproject.toml

raw
1 [project]
2
3 name = "harlequin"
4 version = "2.15.0"
5 requires-python = ">=3.10"
6 description = "The SQL IDE for Your Terminal."
7 authors = [
8 { name = "Ted Conbeer", email = "[email protected]" }
9 ]
10 license = "MIT"
11 readme = "README.md"
12 keywords = ["sql", "tui", "ide", "textual", "harlequin"]
13 classifiers = [
14 "Development Status :: 4 - Beta",
15 "Operating System :: MacOS :: MacOS X",
16 "Operating System :: Microsoft :: Windows",
17 "Operating System :: POSIX :: Linux",
18 "Programming Language :: Python :: 3.10",
19 "Programming Language :: Python :: 3.11",
20 "Programming Language :: Python :: 3.12",
21 "Programming Language :: Python :: 3.13",
22 "Programming Language :: Python :: 3.14",
23 ]
24 dependencies = [
25 # textual and component libraries
26 "textual==8.2.8",
27 "textual-fastdatatable==0.19.2",
28 "textual-textarea==0.18.4",
29
30 # click
31 "click==8.5.0",
32 # 1.9 is the first release compatible with click 8.2's Parameter.make_metavar()
33 "rich-click==1.9.9",
34
35 # statement splitting. Both arrive anyway, transitively, via
36 # textual-textarea's `textual[syntax]` -- but `harlequin.statements` drives
37 # the grammar directly, without Textual, so the dependency is declared here
38 # rather than relied on incidentally.
39 "tree-sitter>=0.25,<0.27",
40 "tree-sitter-sql>=0.3.11,<0.4",
41
42 # measuring text for the headless layouts. Installed for everyone today,
43 # but transitively via prompt_toolkit -- which is one of the packages the
44 # headless import graph exists to keep out, so inheriting it from there is
45 # exactly backwards. It is pure Python with no dependencies of its own.
46 "wcwidth>=0.2.13,<0.9",
47
48 # other deps
49 "duckdb>=1.1.1; python_version < '3.14'",
50 "shandy-sqlfmt>=0.28.2",
51 "platformdirs>=3.10,<5.0",
52
53 # tomlkit writes config files: it is the parser that keeps a user's
54 # comments and key order across `harlequin --config`. Reading goes through
55 # stdlib `tomllib` instead, which is ~30x faster on the pyproject.toml that
56 # start-up finds in any Python project's working directory. `tomli` is that
57 # same parser, and is what 3.10 has instead.
58 "tomlkit>=0.15.1,<0.16.0",
59 "tomli>=2.0.1; python_version < '3.11'",
60
61 # msgspec declares what a config file may say, and validates it against that
62 # declaration -- strictly, so `limit = true` is refused rather than quietly
63 # made one row. It is a C extension with wheels for every version we
64 # support, and it costs ~30ms to import, so `harlequin.config` defers the
65 # import into the function that validates: an invocation that discovers no
66 # config file with anything in it never pays it.
67 "msgspec>=0.19,<1",
68 "questionary==2.1.1",
69 # imported directly by components/error_modal.py; also a textual-textarea dep
70 "pyperclip>=1.9,<2",
71
72 # ensure we install from wheels
73 "duckdb>=1.4.2; python_version >= '3.14'",
74 ]
75
76
77 [project.optional-dependencies]
78
79 s3 = ["boto3==1.43.93"]
80 postgres = ["harlequin-postgres"]
81 mysql = ["harlequin-mysql"]
82 odbc = ["harlequin-odbc"]
83 bigquery = ["harlequin-bigquery"]
84 trino = ["harlequin-trino"]
85 databricks = ["harlequin-databricks"]
86 adbc = ["harlequin-adbc"]
87 cassandra = ["harlequin-cassandra"]
88 nebulagraph = ["harlequin-nebulagraph"]
89 chdb = ["harlequin-chdb"]
90
91
92 [dependency-groups]
93 dev = [
94 "pre-commit>=4.5,<5",
95 "textual-dev==1.8.0",
96 "harlequin-postgres>=1.1.1,<2",
97 "harlequin-mysql>=1,<2",
98 "pyinstrument>=5,<6",
99 ]
100 static = [
101 "ruff>=0.14.1",
102 "mypy==2.3.1,<3",
103 "boto3-stubs>=1.34.23,<2",
104 "import-linter>=2.5",
105 # jsonschema ships no py.typed, and the config-schema tests call it
106 "types-jsonschema>=4.26.0.20260518",
107 # nor does pyyaml, which the skill's frontmatter tests call
108 "types-pyyaml>=6",
109 ]
110 test = [
111 "pytest>=9.1.1,<9.2.0",
112 "pytest-asyncio==1.4.0",
113 "pytest-xdist>=3.6",
114 "pytest-textual-snapshot @ git+https://github.com/tconbeer/pytest-textual-snapshot.git@a2c6763b45283f76757a123342900accefcf04e8",
115 "boto3==1.43.93",
116 # extension tests require consistent version of duckdb.
117 "duckdb==1.5.5",
118 "flaky>=3.8.1",
119 # runs the schema `hsql --config schema` generates against real config
120 # files, so a schema that is not a schema fails here rather than in an
121 # editor. Not a runtime dependency: nothing in the package reads one.
122 "jsonschema>=4.20",
123 # parses the skill's frontmatter the way a harness loading it would. Not a
124 # runtime dependency either: `--skill` prints the file and reads nothing.
125 "pyyaml>=6",
126 ]
127
128
129 # For development of related libraries
130 # [tool.uv.sources]
131
132 # textual-fastdatatable = { path = "../textual-fastdatatable" }
133 # textual-textarea = { path = "../textual-textarea" }
134
135
136 [project.urls]
137
138 Homepage = "https://harlequin.sh"
139 Documentation = "https://harlequin.sh/docs/getting-started/index"
140 Repository = "https://github.com/tconbeer/harlequin"
141 "Bug Tracker" = "https://github.com/tconbeer/harlequin/issues"
142 Changelog = "https://github.com/tconbeer/harlequin/blob/main/CHANGELOG.md"
143
144
145 [project.scripts]
146
147 harlequin = "harlequin.cli:harlequin"
148 hsql = "harlequin.hsql:main"
149
150
151 [project.entry-points."harlequin.adapter"]
152
153 duckdb = "harlequin_duckdb:DuckDbAdapter"
154 sqlite = "harlequin_sqlite:HarlequinSqliteAdapter"
155
156
157 [project.entry-points."harlequin.keymap"]
158
159 vscode = "harlequin_vscode:VSCODE"
160
161
162 [build-system]
163
164 requires = ["hatchling"]
165 build-backend = "hatchling.build"
166
167
168 [tool.hatch.build.targets.wheel]
169
170 # The plugin manifest that makes the skill directory a plugin. hatchling skips
171 # dot-directories, and `.claude-plugin/` is where the plugin tooling looks.
172 force-include = { "src/harlequin/hsql/skill/.claude-plugin/plugin.json" = "harlequin/hsql/skill/.claude-plugin/plugin.json" }
173
174 packages = [
175 "src/harlequin",
176 "src/harlequin_duckdb",
177 "src/harlequin_sqlite",
178 "src/harlequin_vscode",
179 ]
180
181 [tool.hatch.build.targets.sdist]
182
183 force-include = { "src/harlequin/hsql/skill/.claude-plugin/plugin.json" = "src/harlequin/hsql/skill/.claude-plugin/plugin.json" }
184
185 only-include = [
186 "src",
187 "README.md",
188 "CHANGELOG.md",
189 "LICENSE",
190 "pyproject.toml"
191 ]
192
193
194 [tool.ruff]
195
196 target-version = "py310"
197
198
199 [tool.ruff.lint]
200
201 select = ["A", "B", "E", "F", "I"]
202
203
204 [tool.mypy]
205
206 python_version = "3.10"
207 files = [
208 "src/**/*.py",
209 "tests/**/*.py",
210 ]
211 mypy_path = "stubs,src"
212
213 show_column_numbers = true
214
215 # show error messages from unrelated files
216 follow_imports = "normal"
217
218 # be strict
219 disallow_untyped_calls = true
220 disallow_untyped_defs = true
221 check_untyped_defs = true
222 disallow_untyped_decorators = true
223 disallow_incomplete_defs = true
224 disallow_subclassing_any = true
225 strict_optional = true
226
227 warn_return_any = true
228 warn_no_return = true
229 warn_redundant_casts = true
230 warn_unused_ignores = true
231 warn_unused_configs = true
232
233 no_implicit_reexport = true
234 strict_equality = true
235
236
237 [tool.pytest.ini_options]
238
239 # Tests run in parallel, one worker per CPU. Pass -n0 to run them in a single
240 # process, e.g. when using a debugger or -s.
241 addopts = ["-n", "auto"]
242
243 markers = [
244 "online: requeries internet connection (deselect with '-m \"not online\"')",
245 "use_cache: override the autouse fixture the disables the buffer cache",
246 "py12: Only run on Python 3.12 or higher",
247 "session_divergent: asserts state a warm session keeps between invocations that a cold run does not",
248 ]
249
250
251 [tool.importlinter]
252
253 root_packages = ["harlequin", "harlequin_duckdb", "harlequin_sqlite"]
254 include_external_packages = true
255 exclude_type_checking_imports = true
256
257
258 [[tool.importlinter.contracts]]
259
260 name = "The adapter API is reachable without the TUI"
261 type = "forbidden"
262 source_modules = [
263 "harlequin.adapter",
264 "harlequin.autocomplete",
265 "harlequin.catalog",
266 "harlequin.config",
267 "harlequin.crash",
268 "harlequin.environment",
269 "harlequin.exception",
270 "harlequin.keymap",
271 "harlequin.navigate",
272 "harlequin.options",
273 "harlequin.plugins",
274 "harlequin.redact",
275 "harlequin.ssh",
276 "harlequin.transaction_mode",
277 "harlequin_duckdb",
278 "harlequin_sqlite",
279 ]
280 forbidden_modules = [
281 "questionary",
282 "textual",
283 "textual_fastdatatable",
284 "textual_textarea",
285 "harlequin.app",
286 "harlequin.colors",
287 "harlequin.components",
288 "harlequin.copy_widgets",
289 "harlequin.keys_app",
290 "harlequin.messages",
291 ]
292 # import-linter reads the static graph, so it cannot see that these four are
293 # deferred into the function that needs them -- but a reader of this list can,
294 # and every one of them is a deliberate deferral with a comment at the import
295 # site. Any *new* route to Textual fails the contract instead of joining them.
296 # `tests/unit_tests/test_import_hygiene.py` is what proves the deferrals hold at
297 # run time.
298 ignore_imports = [
299 "harlequin.exception -> harlequin.colors", # pretty_print_warning()
300 "harlequin.options -> harlequin.copy_widgets", # to_widgets()
301 "harlequin.options -> harlequin.colors", # to_questionary()
302 "harlequin.options -> questionary", # to_questionary()
303 ]
304
305
306 [[tool.importlinter.contracts]]
307
308 # The headless execution core, and the two modules that write its results out.
309 # It may reach `textual_fastdatatable.backend` -- that is where result
310 # normalization lives, and as of 0.16.1 it costs no Textual -- but nothing here
311 # may reach Textual itself or any part of the app. `harlequin.export` is in the
312 # list from both directions: it is what a headless caller writes a file with,
313 # and it is what the app's export dialog calls, so the dependency has to point
314 # that way and not back.
315 name = "The execution core is reachable without the TUI"
316 type = "forbidden"
317 source_modules = [
318 "harlequin.export",
319 "harlequin.layout",
320 "harlequin.query",
321 "harlequin.query_log",
322 "harlequin.statements",
323 ]
324 forbidden_modules = [
325 "questionary",
326 "textual",
327 "textual_textarea",
328 "harlequin.app",
329 "harlequin.colors",
330 "harlequin.components",
331 "harlequin.copy_widgets",
332 "harlequin.keys_app",
333 "harlequin.messages",
334 ]
335 # the same deliberate deferrals the adapter-API contract lists, each with a
336 # comment at its import site; `harlequin.query_log` reaches the second three
337 # through `harlequin.redact`, which reads a profile's option declarations.
338 # tests/unit_tests/test_import_hygiene.py is what proves they defer.
339 ignore_imports = [
340 "harlequin.exception -> harlequin.colors", # pretty_print_warning()
341 "harlequin.options -> harlequin.copy_widgets", # to_widgets()
342 "harlequin.options -> harlequin.colors", # to_questionary()
343 "harlequin.options -> questionary", # to_questionary()
344 ]
345 unmatched_ignore_imports_alerting = "error"
346
347
348 [[tool.importlinter.contracts]]
349
350 # The whole point of shipping hsql as a second console script rather than a flag
351 # on `harlequin` is that this becomes a rule CI can check, instead of a
352 # discipline every contributor has to remember.
353 name = "hsql does not reach the TUI"
354 type = "forbidden"
355 source_modules = ["harlequin.hsql"]
356 # `locale_manager` is not a TUI module, but it is the one trap on this path:
357 # the IDE calls set_locale() so a human sees grouped digits, and output that
358 # varied with LC_ALL is output a caller cannot predict. hsql casts through
359 # duckdb instead, and must never reach the other thing.
360 forbidden_modules = [
361 "questionary",
362 "sqlfmt",
363 "textual",
364 "textual_textarea",
365 "harlequin.app",
366 "harlequin.cli",
367 "harlequin.colors",
368 "harlequin.components",
369 "harlequin.config_wizard",
370 "harlequin.copy_widgets",
371 "harlequin.keys_app",
372 "harlequin.locale_manager",
373 "harlequin.messages",
374 ]
375 # deferred into pretty_print_warning(), which nothing here calls; the run-time
376 # test in tests/unit_tests/test_import_hygiene.py is what proves it defers.
377 # the same deliberate deferrals the adapter-API contract lists, each with a
378 # comment at its import site. tests/unit_tests/test_import_hygiene.py is what
379 # proves they defer; a *new* route to Textual fails this contract instead.
380 ignore_imports = [
381 "harlequin.exception -> harlequin.colors", # pretty_print_warning()
382 "harlequin.options -> harlequin.copy_widgets", # to_widgets()
383 "harlequin.options -> harlequin.colors", # to_questionary()
384 "harlequin.options -> questionary", # to_questionary()
385 ]
386 unmatched_ignore_imports_alerting = "error"
387
388
389 [[tool.importlinter.contracts]]
390
391 # A warm session answers in about 20ms, almost all of which is the interpreter
392 # starting, so the client's import graph is the feature. `click` alone costs
393 # more than the round trip and `harlequin.config` more again -- so the three
394 # modules a session client loads reach for stdlib and each other, and nothing
395 # else. The run-time guards in tests/unit_tests/test_import_hygiene.py are what
396 # hold the stdlib half of the same rule, by counting modules.
397 name = "The warm-session client imports nothing it cannot afford"
398 type = "forbidden"
399 source_modules = [
400 "harlequin.hsql.client",
401 "harlequin.hsql.protocol",
402 "harlequin.hsql.session",
403 ]
404 # `harlequin` covers its every submodule, so a stdlib-only one added later is
405 # on this list without anyone remembering to add it. The two exceptions are the
406 # other members of this contract's own source set.
407 forbidden_modules = [
408 "click",
409 "msgspec",
410 "platformdirs",
411 "pyarrow",
412 "questionary",
413 "textual",
414 "textual_fastdatatable",
415 "textual_textarea",
416 "tomlkit",
417 "wcwidth",
418 "harlequin",
419 ]
420 ignore_imports = [
421 "harlequin.hsql.client -> harlequin.hsql.protocol",
422 "harlequin.hsql.client -> harlequin.hsql.session",
423 ]
424 unmatched_ignore_imports_alerting = "error"
425
426
427 [[tool.importlinter.contracts]]
428
429 # Importing any harlequin.* submodule executes this package's __init__, so a
430 # single eager import there puts the whole TUI behind every consumer. The
431 # public names are resolved by a PEP 562 __getattr__ instead.
432 name = "The package root does not import either app"
433 type = "forbidden"
434 source_modules = ["harlequin"]
435 forbidden_modules = ["harlequin.app", "harlequin.keys_app"]
436 unmatched_ignore_imports_alerting = "error"