Debian Codegraph @

pyproject.toml

raw
1 [project]
2
3 name = "harlequin"
4 version = "2.13.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.1",
28 "textual-textarea==0.18.2",
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.8",
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.85"]
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
90
91 [dependency-groups]
92 dev = [
93 "pre-commit>=4.5,<5",
94 "textual-dev==1.8.0",
95 "harlequin-postgres>=1.1.1,<2",
96 "harlequin-mysql>=1,<2",
97 "pyinstrument>=5,<6",
98 ]
99 static = [
100 "ruff>=0.14.1",
101 "mypy==2.3.1,<3",
102 "boto3-stubs>=1.34.23,<2",
103 "import-linter>=2.5",
104 # jsonschema ships no py.typed, and the config-schema tests call it
105 "types-jsonschema>=4.26.0.20260518",
106 # nor does pyyaml, which the skill's frontmatter tests call
107 "types-pyyaml>=6",
108 ]
109 test = [
110 "pytest>=9.1.1,<9.2.0",
111 "pytest-asyncio==1.4.0",
112 "pytest-xdist>=3.6",
113 "pytest-textual-snapshot @ git+https://github.com/tconbeer/pytest-textual-snapshot.git@a2c6763b45283f76757a123342900accefcf04e8",
114 "boto3==1.43.85",
115 # extension tests require consistent version of duckdb.
116 "duckdb==1.5.5",
117 "flaky>=3.8.1",
118 # runs the schema `hsql --config schema` generates against real config
119 # files, so a schema that is not a schema fails here rather than in an
120 # editor. Not a runtime dependency: nothing in the package reads one.
121 "jsonschema>=4.20",
122 # parses the skill's frontmatter the way a harness loading it would. Not a
123 # runtime dependency either: `--skill` prints the file and reads nothing.
124 "pyyaml>=6",
125 ]
126
127
128 # For development of related libraries
129 # [tool.uv.sources]
130
131 # textual-fastdatatable = { path = "../textual-fastdatatable" }
132 # textual-textarea = { path = "../textual-textarea" }
133
134
135 [project.urls]
136
137 Homepage = "https://harlequin.sh"
138 Documentation = "https://harlequin.sh/docs/getting-started/index"
139 Repository = "https://github.com/tconbeer/harlequin"
140 "Bug Tracker" = "https://github.com/tconbeer/harlequin/issues"
141 Changelog = "https://github.com/tconbeer/harlequin/blob/main/CHANGELOG.md"
142
143
144 [project.scripts]
145
146 harlequin = "harlequin.cli:harlequin"
147 hsql = "harlequin.hsql:main"
148
149
150 [project.entry-points."harlequin.adapter"]
151
152 duckdb = "harlequin_duckdb:DuckDbAdapter"
153 sqlite = "harlequin_sqlite:HarlequinSqliteAdapter"
154
155
156 [project.entry-points."harlequin.keymap"]
157
158 vscode = "harlequin_vscode:VSCODE"
159
160
161 [build-system]
162
163 requires = ["hatchling"]
164 build-backend = "hatchling.build"
165
166
167 [tool.hatch.build.targets.wheel]
168
169 # The plugin manifest that makes the skill directory a plugin. hatchling skips
170 # dot-directories, and `.claude-plugin/` is where the plugin tooling looks.
171 force-include = { "src/harlequin/hsql/skill/.claude-plugin/plugin.json" = "harlequin/hsql/skill/.claude-plugin/plugin.json" }
172
173 packages = [
174 "src/harlequin",
175 "src/harlequin_duckdb",
176 "src/harlequin_sqlite",
177 "src/harlequin_vscode",
178 ]
179
180 [tool.hatch.build.targets.sdist]
181
182 force-include = { "src/harlequin/hsql/skill/.claude-plugin/plugin.json" = "src/harlequin/hsql/skill/.claude-plugin/plugin.json" }
183
184 only-include = [
185 "src",
186 "README.md",
187 "CHANGELOG.md",
188 "LICENSE",
189 "pyproject.toml"
190 ]
191
192
193 [tool.ruff]
194
195 target-version = "py310"
196
197
198 [tool.ruff.lint]
199
200 select = ["A", "B", "E", "F", "I"]
201
202
203 [tool.mypy]
204
205 python_version = "3.10"
206 files = [
207 "src/**/*.py",
208 "tests/**/*.py",
209 ]
210 mypy_path = "stubs,src"
211
212 show_column_numbers = true
213
214 # show error messages from unrelated files
215 follow_imports = "normal"
216
217 # be strict
218 disallow_untyped_calls = true
219 disallow_untyped_defs = true
220 check_untyped_defs = true
221 disallow_untyped_decorators = true
222 disallow_incomplete_defs = true
223 disallow_subclassing_any = true
224 strict_optional = true
225
226 warn_return_any = true
227 warn_no_return = true
228 warn_redundant_casts = true
229 warn_unused_ignores = true
230 warn_unused_configs = true
231
232 no_implicit_reexport = true
233 strict_equality = true
234
235
236 [tool.pytest.ini_options]
237
238 # Tests run in parallel, one worker per CPU. Pass -n0 to run them in a single
239 # process, e.g. when using a debugger or -s.
240 addopts = ["-n", "auto"]
241
242 markers = [
243 "online: requeries internet connection (deselect with '-m \"not online\"')",
244 "use_cache: override the autouse fixture the disables the buffer cache",
245 "py12: Only run on Python 3.12 or higher",
246 ]
247
248
249 [tool.importlinter]
250
251 root_packages = ["harlequin", "harlequin_duckdb", "harlequin_sqlite"]
252 include_external_packages = true
253 exclude_type_checking_imports = true
254
255
256 [[tool.importlinter.contracts]]
257
258 name = "The adapter API is reachable without the TUI"
259 type = "forbidden"
260 source_modules = [
261 "harlequin.adapter",
262 "harlequin.autocomplete",
263 "harlequin.catalog",
264 "harlequin.config",
265 "harlequin.exception",
266 "harlequin.keymap",
267 "harlequin.navigate",
268 "harlequin.options",
269 "harlequin.plugins",
270 "harlequin.redact",
271 "harlequin.ssh",
272 "harlequin.transaction_mode",
273 "harlequin_duckdb",
274 "harlequin_sqlite",
275 ]
276 forbidden_modules = [
277 "questionary",
278 "textual",
279 "textual_fastdatatable",
280 "textual_textarea",
281 "harlequin.app",
282 "harlequin.colors",
283 "harlequin.components",
284 "harlequin.copy_widgets",
285 "harlequin.keys_app",
286 "harlequin.messages",
287 ]
288 # import-linter reads the static graph, so it cannot see that these four are
289 # deferred into the function that needs them -- but a reader of this list can,
290 # and every one of them is a deliberate deferral with a comment at the import
291 # site. Any *new* route to Textual fails the contract instead of joining them.
292 # `tests/unit_tests/test_import_hygiene.py` is what proves the deferrals hold at
293 # run time.
294 ignore_imports = [
295 "harlequin.exception -> harlequin.colors", # pretty_print_warning()
296 "harlequin.options -> harlequin.copy_widgets", # to_widgets()
297 "harlequin.options -> harlequin.colors", # to_questionary()
298 "harlequin.options -> questionary", # to_questionary()
299 ]
300
301
302 [[tool.importlinter.contracts]]
303
304 # The headless execution core, and the two modules that write its results out.
305 # It may reach `textual_fastdatatable.backend` -- that is where result
306 # normalization lives, and as of 0.16.1 it costs no Textual -- but nothing here
307 # may reach Textual itself or any part of the app. `harlequin.export` is in the
308 # list from both directions: it is what a headless caller writes a file with,
309 # and it is what the app's export dialog calls, so the dependency has to point
310 # that way and not back.
311 name = "The execution core is reachable without the TUI"
312 type = "forbidden"
313 source_modules = [
314 "harlequin.export",
315 "harlequin.layout",
316 "harlequin.query",
317 "harlequin.statements",
318 ]
319 forbidden_modules = [
320 "questionary",
321 "textual",
322 "textual_textarea",
323 "harlequin.app",
324 "harlequin.colors",
325 "harlequin.components",
326 "harlequin.copy_widgets",
327 "harlequin.keys_app",
328 "harlequin.messages",
329 ]
330 # deferred into pretty_print_warning(), which nothing here calls; the run-time
331 # test in tests/unit_tests/test_import_hygiene.py is what proves it defers.
332 ignore_imports = ["harlequin.exception -> harlequin.colors"]
333 unmatched_ignore_imports_alerting = "error"
334
335
336 [[tool.importlinter.contracts]]
337
338 # The whole point of shipping hsql as a second console script rather than a flag
339 # on `harlequin` is that this becomes a rule CI can check, instead of a
340 # discipline every contributor has to remember.
341 name = "hsql does not reach the TUI"
342 type = "forbidden"
343 source_modules = ["harlequin.hsql"]
344 # `locale_manager` is not a TUI module, but it is the one trap on this path:
345 # the IDE calls set_locale() so a human sees grouped digits, and output that
346 # varied with LC_ALL is output a caller cannot predict. hsql casts through
347 # duckdb instead, and must never reach the other thing.
348 forbidden_modules = [
349 "questionary",
350 "sqlfmt",
351 "textual",
352 "textual_textarea",
353 "harlequin.app",
354 "harlequin.cli",
355 "harlequin.colors",
356 "harlequin.components",
357 "harlequin.config_wizard",
358 "harlequin.copy_widgets",
359 "harlequin.keys_app",
360 "harlequin.locale_manager",
361 "harlequin.messages",
362 ]
363 # deferred into pretty_print_warning(), which nothing here calls; the run-time
364 # test in tests/unit_tests/test_import_hygiene.py is what proves it defers.
365 # the same deliberate deferrals the adapter-API contract lists, each with a
366 # comment at its import site. tests/unit_tests/test_import_hygiene.py is what
367 # proves they defer; a *new* route to Textual fails this contract instead.
368 ignore_imports = [
369 "harlequin.exception -> harlequin.colors", # pretty_print_warning()
370 "harlequin.options -> harlequin.copy_widgets", # to_widgets()
371 "harlequin.options -> harlequin.colors", # to_questionary()
372 "harlequin.options -> questionary", # to_questionary()
373 ]
374 unmatched_ignore_imports_alerting = "error"
375
376
377 [[tool.importlinter.contracts]]
378
379 # Importing any harlequin.* submodule executes this package's __init__, so a
380 # single eager import there puts the whole TUI behind every consumer. The
381 # public names are resolved by a PEP 562 __getattr__ instead.
382 name = "The package root does not import either app"
383 type = "forbidden"
384 source_modules = ["harlequin"]
385 forbidden_modules = ["harlequin.app", "harlequin.keys_app"]
386 unmatched_ignore_imports_alerting = "error"