harlequin 2.0.0__tar.gz → 2.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. harlequin-2.0.2/PKG-INFO +212 -0
  2. harlequin-2.0.2/README.md +160 -0
  3. {harlequin-2.0.0 → harlequin-2.0.2}/pyproject.toml +6 -6
  4. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin/app.py +12 -2
  5. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin/app_base.py +10 -0
  6. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin/cli.py +3 -7
  7. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin/components/help_screen.md +1 -1
  8. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin/exception.py +4 -4
  9. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin/export.py +3 -5
  10. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin/keys_app.py +1 -1
  11. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin/plugins.py +1 -2
  12. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin/windows_timezone.py +1 -4
  13. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin_sqlite/adapter.py +1 -1
  14. harlequin-2.0.0/PKG-INFO +0 -126
  15. harlequin-2.0.0/README.md +0 -76
  16. {harlequin-2.0.0 → harlequin-2.0.2}/LICENSE +0 -0
  17. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin/__init__.py +0 -0
  18. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin/__main__.py +0 -0
  19. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin/actions.py +0 -0
  20. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin/adapter.py +0 -0
  21. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin/app.tcss +0 -0
  22. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin/autocomplete/__init__.py +0 -0
  23. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin/autocomplete/completers.py +0 -0
  24. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin/autocomplete/completion.py +0 -0
  25. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin/autocomplete/constants.py +0 -0
  26. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin/bindings.py +0 -0
  27. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin/cache.py +0 -0
  28. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin/catalog.py +0 -0
  29. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin/catalog_cache.py +0 -0
  30. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin/colors.py +0 -0
  31. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin/components/__init__.py +0 -0
  32. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin/components/code_editor.py +0 -0
  33. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin/components/confirm_modal.py +0 -0
  34. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin/components/data_catalog/__init__.py +0 -0
  35. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin/components/data_catalog/database_tree.py +0 -0
  36. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin/components/data_catalog/file_tree.py +0 -0
  37. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin/components/data_catalog/s3_tree.py +0 -0
  38. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin/components/data_catalog/tree.py +0 -0
  39. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin/components/error_modal.py +0 -0
  40. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin/components/export_screen.py +0 -0
  41. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin/components/help_screen.py +0 -0
  42. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin/components/history_screen.py +0 -0
  43. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin/components/results_viewer.py +0 -0
  44. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin/components/run_query_bar.py +0 -0
  45. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin/config.py +0 -0
  46. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin/config_wizard.py +0 -0
  47. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin/copy_formats.py +0 -0
  48. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin/copy_widgets.py +0 -0
  49. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin/driver.py +0 -0
  50. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin/editor_cache.py +0 -0
  51. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin/global.tcss +0 -0
  52. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin/history.py +0 -0
  53. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin/keymap.py +0 -0
  54. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin/keys_app.tcss +0 -0
  55. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin/locale_manager.py +0 -0
  56. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin/messages.py +0 -0
  57. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin/options.py +0 -0
  58. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin/py.typed +0 -0
  59. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin/transaction_mode.py +0 -0
  60. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin_duckdb/__init__.py +0 -0
  61. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin_duckdb/adapter.py +0 -0
  62. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin_duckdb/catalog.py +0 -0
  63. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin_duckdb/cli_options.py +0 -0
  64. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin_duckdb/completions.py +0 -0
  65. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin_duckdb/interactions.py +0 -0
  66. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin_duckdb/py.typed +0 -0
  67. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin_sqlite/__init__.py +0 -0
  68. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin_sqlite/catalog.py +0 -0
  69. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin_sqlite/cli_options.py +0 -0
  70. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin_sqlite/completions.py +0 -0
  71. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin_sqlite/interactions.py +0 -0
  72. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin_sqlite/py.typed +0 -0
  73. {harlequin-2.0.0 → harlequin-2.0.2}/src/harlequin_vscode/__init__.py +0 -0
@@ -0,0 +1,212 @@
1
+ Metadata-Version: 2.1
2
+ Name: harlequin
3
+ Version: 2.0.2
4
+ Summary: The SQL IDE for Your Terminal.
5
+ Home-page: https://harlequin.sh
6
+ License: MIT
7
+ Author: Ted Conbeer
8
+ Author-email: tconbeer@users.noreply.github.com
9
+ Requires-Python: >=3.9,<3.14.0
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.9
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Provides-Extra: adbc
18
+ Provides-Extra: bigquery
19
+ Provides-Extra: cassandra
20
+ Provides-Extra: databricks
21
+ Provides-Extra: mysql
22
+ Provides-Extra: odbc
23
+ Provides-Extra: postgres
24
+ Provides-Extra: s3
25
+ Provides-Extra: trino
26
+ Requires-Dist: boto3 (>=1.34.22,<2.0.0) ; extra == "s3"
27
+ Requires-Dist: click (>=8.1.3,<9.0.0)
28
+ Requires-Dist: duckdb (>=0.8.0)
29
+ Requires-Dist: harlequin-adbc (>=0.1) ; extra == "adbc"
30
+ Requires-Dist: harlequin-bigquery (>=1.0.3) ; extra == "bigquery"
31
+ Requires-Dist: harlequin-cassandra (>=0.1.2) ; extra == "cassandra"
32
+ Requires-Dist: harlequin-databricks (>=0.5.2) ; extra == "databricks"
33
+ Requires-Dist: harlequin-mysql (>=1.0) ; extra == "mysql"
34
+ Requires-Dist: harlequin-odbc (>=0.2) ; extra == "odbc"
35
+ Requires-Dist: harlequin-postgres (>=1.0) ; extra == "postgres"
36
+ Requires-Dist: harlequin-trino (>=0.1) ; extra == "trino"
37
+ Requires-Dist: importlib_metadata (>=8.0) ; python_full_version < "3.10.0"
38
+ Requires-Dist: numpy (>=1.21.0,<2.0.0) ; python_full_version < "3.12.0"
39
+ Requires-Dist: numpy (>=1.26.0,<2.0.0) ; python_full_version >= "3.12.0"
40
+ Requires-Dist: platformdirs (>=3.10,<5.0)
41
+ Requires-Dist: pyarrow (>=18.1.0) ; python_full_version >= "3.12.0"
42
+ Requires-Dist: questionary (>=2.0.1,<3.0.0)
43
+ Requires-Dist: rich-click (>=1.7.1,<2.0.0)
44
+ Requires-Dist: shandy-sqlfmt (>=0.19.0)
45
+ Requires-Dist: textual (==0.89.1)
46
+ Requires-Dist: textual-fastdatatable (==0.12.0)
47
+ Requires-Dist: textual-textarea (==0.15.0)
48
+ Requires-Dist: tomlkit (>=0.12.5,<0.14.0)
49
+ Project-URL: Repository, https://github.com/tconbeer/harlequin
50
+ Description-Content-Type: text/markdown
51
+
52
+ # Harlequin
53
+
54
+ [![PyPI](https://img.shields.io/pypi/v/harlequin)](https://pypi.org/project/harlequin/)
55
+
56
+ ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/harlequin)
57
+ ![Runs on Linux | MacOS | Windows](https://img.shields.io/badge/runs%20on-Linux%20%7C%20MacOS%20%7C%20Windows-blue)
58
+
59
+ The SQL IDE for Your Terminal.
60
+
61
+ ![Harlequin](./harlequin.svg)
62
+
63
+ > [!TIP]
64
+ > This README contains a small subset of the docs available at
65
+ > [harlequin.sh](https://harlequin.sh/docs/getting-started/index).
66
+
67
+ ## Installing Harlequin
68
+
69
+ Harlequin is a Python program, and there are many ways to install and run it. We strongly recommend using [uv](https://docs.astral.sh/uv):
70
+
71
+ 1. [Install uv](https://docs.astral.sh/uv/getting-started/installation/#standalone-installer). From a POSIX shell, run:
72
+
73
+ ```bash
74
+ curl -LsSf https://astral.sh/uv/install.sh | sh
75
+ ```
76
+
77
+ Or using Windows Powershell:
78
+
79
+ ```powershell
80
+ powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
81
+ ```
82
+
83
+ 2. Install Harlequin as a tool using `uv`:
84
+
85
+ ```bash
86
+ uv tool install harlequin
87
+ ```
88
+
89
+ This command will install Harlequin into an isolated environment and add it to your PATH so you can easily run the executable.
90
+
91
+ ### Other Installation Methods
92
+
93
+ Alternatively, if you know what you're doing, after installing Python 3.9 or above, install Harlequin using `pip`, `pipx`, `poetry`, or any other program that can install Python packages from PyPI:
94
+
95
+ ```bash
96
+ pip install harlequin
97
+ ```
98
+
99
+ There is also a [Homebrew formula](https://formulae.brew.sh/formula/harlequin) for Harlequin, although this is maintained by the community and is not as rigorously tested as the Python installations. Note that the formula includes several Harlequin adapter packages (Postgres, MySQL, and ODBC) and their dependencies, which is convenient but increases the application size.
100
+
101
+ ```bash
102
+ brew install harlequin
103
+ ```
104
+
105
+ ## Installing Database Adapters
106
+
107
+ Harlequin can connect to dozens of databases using adapter plug-ins. Adapters are distributed as their own Python packages that need to be installed into the same environment as Harlequin.
108
+
109
+ For a list of known adapters provided either by the Harlequin maintainers or the broader community, see the [adapters](adapters) page.
110
+
111
+ The adapter docs also include installation instructions. Some adapters can be installed as Harlequin extras, like `postgres`. If you used `uv` to install Harlequin:
112
+
113
+ ```bash
114
+ uv tool install 'harlequin[postgres]'
115
+ ```
116
+
117
+ You can install multiple extras:
118
+
119
+ ```bash
120
+ uv tool install 'harlequin[postgres,mysql,s3]'
121
+ ```
122
+
123
+ ## Running Harlequin
124
+
125
+ Once Harlequin is installed, you run it from the command line. The arguments and options you pass in at the command line affect Harlequin's behavior, like what database adapter it uses, which database it connects to, whether or not the file picker is visible, and more. Assuming you have installed Harlequin so that it is on your [PATH](<https://en.wikipedia.org/wiki/PATH_(variable)>) (`uv tool install harlequin` does this automatically), you run Harlequin by typing a command of this form into your shell:
126
+
127
+ ```bash
128
+ harlequin [OPTIONS] [CONN_STR]
129
+ ```
130
+
131
+ where `[OPTIONS]` is 0 or more pairs of the form `--[option-name] [option-value]`, and `[CONN_STR]` is 0 or more connection strings. `[OPTIONS]` are composed of both Harlequin options and adapter options. For a full list of options, run Harlequin with the `--help` option:
132
+
133
+ ```bash
134
+ harlequin --help
135
+ ```
136
+
137
+ ## Using Harlequin with DuckDB
138
+
139
+ Harlequin defaults to using its DuckDB database adapter, which ships with Harlequin and includes the full DuckDB in-process database.
140
+
141
+ To open an in-memory DuckDB session, run Harlequin with no arguments:
142
+
143
+ ```bash
144
+ harlequin
145
+ ```
146
+
147
+ To open one or more DuckDB database files, pass in relative or absolute paths as connection strings (Harlequin will create DuckDB databases if they do not exist):
148
+
149
+ ```bash
150
+ harlequin "path/to/duck.db" "another_duck.db"
151
+ ```
152
+
153
+ If you want to control the version of DuckDB that Harlequin uses, see the [Troubleshooting](troubleshooting/duckdb-version-mismatch) page.
154
+
155
+ ## Using Harlequin with SQLite and Other Adapters
156
+
157
+ Harlequin also ships with a SQLite3 adapter. To use that adapter, you specify the `--adapter sqlite` option. Like DuckDB, you can open an in-memory SQLite database by omitting the connection string:
158
+
159
+ ```bash
160
+ harlequin --adapter sqlite
161
+ ```
162
+
163
+ You can open one or more SQLite database files by passing in their paths as connection strings; note that the `--adapter` option has a short alias, `-a`:
164
+
165
+ ```bash
166
+ harlequin -a sqlite "path/to/sqlite.db" "another_sqlite.db"
167
+ ```
168
+
169
+ Other adapters can be installed as plug-ins; for more information, see the [installation guide](index#installing-database-adapters), and the guides for individual [adapters](../adapters). Each adapter can define its own options, which you can view using `harlequin --help`.
170
+
171
+ ## Configuring Harlequin
172
+
173
+ Harlequin contains a large number of options that allow you to [set the theme](../themes), [customize key bindings](../keymaps/index), [show remote and local files](../files/index.md), set the locale for number formatting, and much more. These can always be entered at the command line, but it can be convenient to define a configuration as a profile instead. For more information on configuring Harlequin, see [Using Config Files](../config-file).
174
+
175
+ ## Using Harlequin with Django
176
+
177
+ [django-harlequin](https://pypi.org/project/django-harlequin/) provides a command to launch Harlequin using Django’s database configuration, like:
178
+
179
+ ```bash
180
+ ./manage.py harlequin
181
+ ```
182
+
183
+ ## Keep Reading at [harlequin.sh](https://harlequin.sh/docs/getting-started/usage)
184
+
185
+ Visit [harlequin.sh](https://harlequin.sh/docs/getting-started/usage) for an overview of features and full documentation, starting with a guided walkthrough of how to edit and execute queries, use the data catalog, export data, and more.
186
+
187
+ ## Getting Help
188
+
189
+ To view all command-line options for Harlequin and all installed adapters, after installation, simply type:
190
+
191
+ ```bash
192
+ harlequin --help
193
+ ```
194
+
195
+ To view a subset of these docs (and a link back here) from within the app, press <Key>F1</Key>.
196
+
197
+ See the [Troubleshooting](troubleshooting/index) guide for help with key bindings, appearance issues, copy-paste, etc.
198
+
199
+ [GitHub Discussions](https://github.com/tconbeer/harlequin/discussions) are a good place to ask questions, request features, and say hello.
200
+
201
+ [GitHub Issues](https://github.com/tconbeer/harlequin/issues) are the best place to report bugs.
202
+
203
+ ## Sponsoring Harlequin
204
+
205
+ Please consider [sponsoring Harlequin's author](https://github.com/sponsors/tconbeer), so he can continue to dedicate time to Harlequin.
206
+
207
+ ## Contributing
208
+
209
+ Thanks for your interest in Harlequin! Harlequin is primarily maintained by [Ted Conbeer](https://github.com/tconbeer), but he welcomes all contributions!
210
+
211
+ Please see [`CONTRIBUTING.md`](./CONTRIBUTING.md) for more information.
212
+
@@ -0,0 +1,160 @@
1
+ # Harlequin
2
+
3
+ [![PyPI](https://img.shields.io/pypi/v/harlequin)](https://pypi.org/project/harlequin/)
4
+
5
+ ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/harlequin)
6
+ ![Runs on Linux | MacOS | Windows](https://img.shields.io/badge/runs%20on-Linux%20%7C%20MacOS%20%7C%20Windows-blue)
7
+
8
+ The SQL IDE for Your Terminal.
9
+
10
+ ![Harlequin](./harlequin.svg)
11
+
12
+ > [!TIP]
13
+ > This README contains a small subset of the docs available at
14
+ > [harlequin.sh](https://harlequin.sh/docs/getting-started/index).
15
+
16
+ ## Installing Harlequin
17
+
18
+ Harlequin is a Python program, and there are many ways to install and run it. We strongly recommend using [uv](https://docs.astral.sh/uv):
19
+
20
+ 1. [Install uv](https://docs.astral.sh/uv/getting-started/installation/#standalone-installer). From a POSIX shell, run:
21
+
22
+ ```bash
23
+ curl -LsSf https://astral.sh/uv/install.sh | sh
24
+ ```
25
+
26
+ Or using Windows Powershell:
27
+
28
+ ```powershell
29
+ powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
30
+ ```
31
+
32
+ 2. Install Harlequin as a tool using `uv`:
33
+
34
+ ```bash
35
+ uv tool install harlequin
36
+ ```
37
+
38
+ This command will install Harlequin into an isolated environment and add it to your PATH so you can easily run the executable.
39
+
40
+ ### Other Installation Methods
41
+
42
+ Alternatively, if you know what you're doing, after installing Python 3.9 or above, install Harlequin using `pip`, `pipx`, `poetry`, or any other program that can install Python packages from PyPI:
43
+
44
+ ```bash
45
+ pip install harlequin
46
+ ```
47
+
48
+ There is also a [Homebrew formula](https://formulae.brew.sh/formula/harlequin) for Harlequin, although this is maintained by the community and is not as rigorously tested as the Python installations. Note that the formula includes several Harlequin adapter packages (Postgres, MySQL, and ODBC) and their dependencies, which is convenient but increases the application size.
49
+
50
+ ```bash
51
+ brew install harlequin
52
+ ```
53
+
54
+ ## Installing Database Adapters
55
+
56
+ Harlequin can connect to dozens of databases using adapter plug-ins. Adapters are distributed as their own Python packages that need to be installed into the same environment as Harlequin.
57
+
58
+ For a list of known adapters provided either by the Harlequin maintainers or the broader community, see the [adapters](adapters) page.
59
+
60
+ The adapter docs also include installation instructions. Some adapters can be installed as Harlequin extras, like `postgres`. If you used `uv` to install Harlequin:
61
+
62
+ ```bash
63
+ uv tool install 'harlequin[postgres]'
64
+ ```
65
+
66
+ You can install multiple extras:
67
+
68
+ ```bash
69
+ uv tool install 'harlequin[postgres,mysql,s3]'
70
+ ```
71
+
72
+ ## Running Harlequin
73
+
74
+ Once Harlequin is installed, you run it from the command line. The arguments and options you pass in at the command line affect Harlequin's behavior, like what database adapter it uses, which database it connects to, whether or not the file picker is visible, and more. Assuming you have installed Harlequin so that it is on your [PATH](<https://en.wikipedia.org/wiki/PATH_(variable)>) (`uv tool install harlequin` does this automatically), you run Harlequin by typing a command of this form into your shell:
75
+
76
+ ```bash
77
+ harlequin [OPTIONS] [CONN_STR]
78
+ ```
79
+
80
+ where `[OPTIONS]` is 0 or more pairs of the form `--[option-name] [option-value]`, and `[CONN_STR]` is 0 or more connection strings. `[OPTIONS]` are composed of both Harlequin options and adapter options. For a full list of options, run Harlequin with the `--help` option:
81
+
82
+ ```bash
83
+ harlequin --help
84
+ ```
85
+
86
+ ## Using Harlequin with DuckDB
87
+
88
+ Harlequin defaults to using its DuckDB database adapter, which ships with Harlequin and includes the full DuckDB in-process database.
89
+
90
+ To open an in-memory DuckDB session, run Harlequin with no arguments:
91
+
92
+ ```bash
93
+ harlequin
94
+ ```
95
+
96
+ To open one or more DuckDB database files, pass in relative or absolute paths as connection strings (Harlequin will create DuckDB databases if they do not exist):
97
+
98
+ ```bash
99
+ harlequin "path/to/duck.db" "another_duck.db"
100
+ ```
101
+
102
+ If you want to control the version of DuckDB that Harlequin uses, see the [Troubleshooting](troubleshooting/duckdb-version-mismatch) page.
103
+
104
+ ## Using Harlequin with SQLite and Other Adapters
105
+
106
+ Harlequin also ships with a SQLite3 adapter. To use that adapter, you specify the `--adapter sqlite` option. Like DuckDB, you can open an in-memory SQLite database by omitting the connection string:
107
+
108
+ ```bash
109
+ harlequin --adapter sqlite
110
+ ```
111
+
112
+ You can open one or more SQLite database files by passing in their paths as connection strings; note that the `--adapter` option has a short alias, `-a`:
113
+
114
+ ```bash
115
+ harlequin -a sqlite "path/to/sqlite.db" "another_sqlite.db"
116
+ ```
117
+
118
+ Other adapters can be installed as plug-ins; for more information, see the [installation guide](index#installing-database-adapters), and the guides for individual [adapters](../adapters). Each adapter can define its own options, which you can view using `harlequin --help`.
119
+
120
+ ## Configuring Harlequin
121
+
122
+ Harlequin contains a large number of options that allow you to [set the theme](../themes), [customize key bindings](../keymaps/index), [show remote and local files](../files/index.md), set the locale for number formatting, and much more. These can always be entered at the command line, but it can be convenient to define a configuration as a profile instead. For more information on configuring Harlequin, see [Using Config Files](../config-file).
123
+
124
+ ## Using Harlequin with Django
125
+
126
+ [django-harlequin](https://pypi.org/project/django-harlequin/) provides a command to launch Harlequin using Django’s database configuration, like:
127
+
128
+ ```bash
129
+ ./manage.py harlequin
130
+ ```
131
+
132
+ ## Keep Reading at [harlequin.sh](https://harlequin.sh/docs/getting-started/usage)
133
+
134
+ Visit [harlequin.sh](https://harlequin.sh/docs/getting-started/usage) for an overview of features and full documentation, starting with a guided walkthrough of how to edit and execute queries, use the data catalog, export data, and more.
135
+
136
+ ## Getting Help
137
+
138
+ To view all command-line options for Harlequin and all installed adapters, after installation, simply type:
139
+
140
+ ```bash
141
+ harlequin --help
142
+ ```
143
+
144
+ To view a subset of these docs (and a link back here) from within the app, press <Key>F1</Key>.
145
+
146
+ See the [Troubleshooting](troubleshooting/index) guide for help with key bindings, appearance issues, copy-paste, etc.
147
+
148
+ [GitHub Discussions](https://github.com/tconbeer/harlequin/discussions) are a good place to ask questions, request features, and say hello.
149
+
150
+ [GitHub Issues](https://github.com/tconbeer/harlequin/issues) are the best place to report bugs.
151
+
152
+ ## Sponsoring Harlequin
153
+
154
+ Please consider [sponsoring Harlequin's author](https://github.com/sponsors/tconbeer), so he can continue to dedicate time to Harlequin.
155
+
156
+ ## Contributing
157
+
158
+ Thanks for your interest in Harlequin! Harlequin is primarily maintained by [Ted Conbeer](https://github.com/tconbeer), but he welcomes all contributions!
159
+
160
+ Please see [`CONTRIBUTING.md`](./CONTRIBUTING.md) for more information.
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "harlequin"
3
- version = "2.0.0"
3
+ version = "2.0.2"
4
4
  description = "The SQL IDE for Your Terminal."
5
5
  authors = ["Ted Conbeer <tconbeer@users.noreply.github.com>"]
6
6
  license = "MIT"
@@ -23,7 +23,7 @@ python = ">=3.9,<3.14.0"
23
23
 
24
24
  # textual and component libraries
25
25
  textual = "==0.89.1"
26
- textual-fastdatatable = "==0.11.0"
26
+ textual-fastdatatable = "==0.12.0"
27
27
  textual-textarea = "==0.15.0"
28
28
 
29
29
  # click
@@ -61,18 +61,18 @@ harlequin-bigquery = { version = ">=1.0.3", optional = true }
61
61
  harlequin-trino = { version = ">=0.1", optional = true }
62
62
  harlequin-databricks = { version = ">=0.5.2", optional = true }
63
63
  harlequin-adbc = { version = ">=0.1", optional = true }
64
- # harlequin-cassandra = { version = ">=0.1", optional = true }
64
+ harlequin-cassandra = { version = ">=0.1.2", optional = true }
65
65
  # harlequin-nebulagraph = { version = ">=0.1", optional = true }
66
66
 
67
67
  [tool.poetry.group.dev.dependencies]
68
68
  pre-commit = "^3.3.1"
69
69
  textual-dev = { version="^1.0.1", python="<3.12.0" }
70
- harlequin-postgres = "^1"
70
+ harlequin-postgres = "^1.1.1"
71
71
  harlequin-mysql = "^1"
72
72
  pyinstrument = "^5"
73
73
 
74
74
  [tool.poetry.group.static.dependencies]
75
- ruff = "^0.6"
75
+ ruff = ">=0.6,<0.10"
76
76
  mypy = "^1.11.0"
77
77
  pandas-stubs = "^2"
78
78
  boto3-stubs = "^1.34.23"
@@ -96,7 +96,7 @@ bigquery = ["harlequin-bigquery"]
96
96
  trino = ["harlequin-trino"]
97
97
  databricks = ["harlequin-databricks"]
98
98
  adbc = ["harlequin-adbc"]
99
- # cassandra = ["harlequin-cassandra"]
99
+ cassandra = ["harlequin-cassandra"]
100
100
  # nebulagraph = ["harlequin-nebulagraph"]
101
101
 
102
102
  [tool.poetry.plugins."harlequin.adapter"]
@@ -20,7 +20,7 @@ from typing import (
20
20
  from textual import on, work
21
21
  from textual.app import App, ComposeResult
22
22
  from textual.containers import Horizontal, Vertical
23
- from textual.css.query import DOMQuery
23
+ from textual.css.query import DOMQuery, NoMatches
24
24
  from textual.dom import DOMNode
25
25
  from textual.driver import Driver
26
26
  from textual.lazy import Lazy
@@ -470,7 +470,17 @@ class Harlequin(AppBase):
470
470
  if message.active_editor is not None:
471
471
  self.editor = message.active_editor
472
472
  else:
473
- self.editor = self.editor_collection.current_editor
473
+ try:
474
+ self.editor = self.editor_collection.current_editor
475
+ except NoMatches:
476
+ # This shouldn't happen, but sometimes on Windows we
477
+ # get into this state where we receive EditorSwitched
478
+ # but current_editor raises NoMatches because it
479
+ # can't find the ContentSwitcher. Recycle the event
480
+ # to try again.
481
+ callback = partial(self.post_message, message)
482
+ self.set_timer(delay=0.1, callback=callback)
483
+ return
474
484
  self.editor.focus()
475
485
 
476
486
  def on_text_area_selection_changed(self) -> None:
@@ -64,3 +64,13 @@ class AppBase(App, inherit_bindings=False):
64
64
  Changes the default screen to re-order bindings, with global bindings first.
65
65
  """
66
66
  return ScreenBase(id="_default")
67
+
68
+ def _handle_exception(self, error: Exception) -> None:
69
+ """
70
+ Prevents tracebacks from being printed due to exceptions that
71
+ occur after App.exit() is called.
72
+ See https://github.com/Textualize/textual/issues/5325
73
+ """
74
+ if self._exit:
75
+ return
76
+ return super()._handle_exception(error)
@@ -223,8 +223,7 @@ def build_cli() -> click.Command:
223
223
  "-f",
224
224
  type=click.Path(exists=True, file_okay=False, dir_okay=True, path_type=Path),
225
225
  help=(
226
- "The path to a directory to show in a file tree viewer "
227
- "in the Data Catalog."
226
+ "The path to a directory to show in a file tree viewer in the Data Catalog."
228
227
  ),
229
228
  )
230
229
  @click.option(
@@ -249,8 +248,7 @@ def build_cli() -> click.Command:
249
248
  @click.option(
250
249
  "--config",
251
250
  help=(
252
- "Run the configuration wizard to create or update a Harlequin "
253
- "config file."
251
+ "Run the configuration wizard to create or update a Harlequin config file."
254
252
  ),
255
253
  is_flag=True,
256
254
  callback=_config_wizard_callback,
@@ -258,9 +256,7 @@ def build_cli() -> click.Command:
258
256
  )
259
257
  @click.option(
260
258
  "--keys",
261
- help=(
262
- "Run the key binding config app to create or update a Harlequin " "keymap."
263
- ),
259
+ help=("Run the key binding config app to create or update a Harlequin keymap."),
264
260
  is_flag=True,
265
261
  callback=_keys_app_callback,
266
262
  expose_value=True,
@@ -30,7 +30,7 @@ Like DuckDB, you can also open an in-memory database by omitting the paths:
30
30
  harlequin -a sqlite
31
31
  ```
32
32
 
33
- Other adapters can be installed using `pip install <adapter package>` or `pipx inject harlequin <adapter package>`, depending on how you installed Harlequin. Several adapters are under active development; for a list of known adapters provided either by the Harlequin maintainers or the broader community, see the [adapters](https://harlequin.sh/docs/adapters) page.
33
+ Other adapters must be installed into the same environment as Harlequin; instructions will depend on how you installed Harlequin. For a list of known adapters provided either by the Harlequin maintainers or the broader community, see the [adapters](https://harlequin.sh/docs/adapters) page.
34
34
 
35
35
 
36
36
  ### Getting Help
@@ -49,9 +49,9 @@ class HarlequinLocaleError(HarlequinError):
49
49
 
50
50
 
51
51
  def pretty_print_error(error: HarlequinError) -> None:
52
- from rich import print
52
+ from rich import print as rich_print
53
53
 
54
- print(pretty_error_message(error))
54
+ rich_print(pretty_error_message(error))
55
55
 
56
56
 
57
57
  def pretty_error_message(error: HarlequinError) -> Panel:
@@ -64,11 +64,11 @@ def pretty_error_message(error: HarlequinError) -> Panel:
64
64
 
65
65
 
66
66
  def pretty_print_warning(title: str, message: str) -> None:
67
- from rich import print
67
+ from rich import print as rich_print
68
68
 
69
69
  from harlequin.colors import GREEN
70
70
 
71
- print(
71
+ rich_print(
72
72
  Panel.fit(
73
73
  message,
74
74
  title=title,
@@ -45,7 +45,7 @@ def _export_csv(
45
45
  except (duckdb.Error, OSError) as e:
46
46
  raise HarlequinCopyError(
47
47
  str(e),
48
- title=("DuckDB raised an error when writing your query " "to a CSV file."),
48
+ title=("DuckDB raised an error when writing your query to a CSV file."),
49
49
  ) from e
50
50
 
51
51
 
@@ -66,9 +66,7 @@ def _export_parquet(
66
66
  except (duckdb.Error, OSError) as e:
67
67
  raise HarlequinCopyError(
68
68
  str(e),
69
- title=(
70
- "DuckDB raised an error when writing your query " "to a Parquet file."
71
- ),
69
+ title=("DuckDB raised an error when writing your query to a Parquet file."),
72
70
  ) from e
73
71
 
74
72
 
@@ -104,7 +102,7 @@ def _export_json(
104
102
  except (duckdb.Error, OSError) as e:
105
103
  raise HarlequinCopyError(
106
104
  str(e),
107
- title=("DuckDB raised an error when writing your query " "to a JSON file."),
105
+ title=("DuckDB raised an error when writing your query to a JSON file."),
108
106
  ) from e
109
107
 
110
108
 
@@ -584,7 +584,7 @@ class HarlequinKeys(AppBase):
584
584
  def format_action(action: str) -> str:
585
585
  component_name, _, action_name = action.rpartition(".")
586
586
  component_display_name = (
587
- f'{" ".join(w.capitalize() for w in component_name.split("_"))}: '
587
+ f"{' '.join(w.capitalize() for w in component_name.split('_'))}: "
588
588
  if component_name
589
589
  else ""
590
590
  )
@@ -57,8 +57,7 @@ def _load_plugins(
57
57
  ep_class = ep.load()
58
58
  except ImportError as e:
59
59
  print(
60
- f"Harlequin could not load the installed plug-in named {e.name}."
61
- f"\n\n{e}"
60
+ f"Harlequin could not load the installed plug-in named {e.name}.\n\n{e}"
62
61
  )
63
62
  else:
64
63
  plugins[ep.name] = ep_class
@@ -40,10 +40,7 @@ def check_and_install_tzdata() -> None:
40
40
  try:
41
41
  # tz database is missing. We need to install it.
42
42
  response = urlopen(
43
- # "https://www.iana.org/time-zones/repository/tzdata-latest.tar.gz"
44
- # see #652
45
- # TODO: unpin this.
46
- "https://data.iana.org/time-zones/releases/tzdata2024a.tar.gz"
43
+ "https://www.iana.org/time-zones/repository/tzdata-latest.tar.gz"
47
44
  )
48
45
  with TemporaryDirectory() as tmpdir:
49
46
  tar_path = Path(tmpdir) / "tzdata.tar.gz"
@@ -521,5 +521,5 @@ class HarlequinSqliteAdapter(HarlequinAdapter):
521
521
  return f"select load_extension('{args[0]}', '{args[1]}');"
522
522
  else:
523
523
  raise sqlite3.ProgrammingError(
524
- "Could not execute .load with following args: " f"{args}"
524
+ f"Could not execute .load with following args: {args}"
525
525
  )
harlequin-2.0.0/PKG-INFO DELETED
@@ -1,126 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: harlequin
3
- Version: 2.0.0
4
- Summary: The SQL IDE for Your Terminal.
5
- Home-page: https://harlequin.sh
6
- License: MIT
7
- Author: Ted Conbeer
8
- Author-email: tconbeer@users.noreply.github.com
9
- Requires-Python: >=3.9,<3.14.0
10
- Classifier: License :: OSI Approved :: MIT License
11
- Classifier: Programming Language :: Python :: 3
12
- Classifier: Programming Language :: Python :: 3.9
13
- Classifier: Programming Language :: Python :: 3.10
14
- Classifier: Programming Language :: Python :: 3.11
15
- Classifier: Programming Language :: Python :: 3.12
16
- Classifier: Programming Language :: Python :: 3.13
17
- Provides-Extra: adbc
18
- Provides-Extra: bigquery
19
- Provides-Extra: databricks
20
- Provides-Extra: mysql
21
- Provides-Extra: odbc
22
- Provides-Extra: postgres
23
- Provides-Extra: s3
24
- Provides-Extra: trino
25
- Requires-Dist: boto3 (>=1.34.22,<2.0.0) ; extra == "s3"
26
- Requires-Dist: click (>=8.1.3,<9.0.0)
27
- Requires-Dist: duckdb (>=0.8.0)
28
- Requires-Dist: harlequin-adbc (>=0.1) ; extra == "adbc"
29
- Requires-Dist: harlequin-bigquery (>=1.0.3) ; extra == "bigquery"
30
- Requires-Dist: harlequin-databricks (>=0.5.2) ; extra == "databricks"
31
- Requires-Dist: harlequin-mysql (>=1.0) ; extra == "mysql"
32
- Requires-Dist: harlequin-odbc (>=0.2) ; extra == "odbc"
33
- Requires-Dist: harlequin-postgres (>=1.0) ; extra == "postgres"
34
- Requires-Dist: harlequin-trino (>=0.1) ; extra == "trino"
35
- Requires-Dist: importlib_metadata (>=8.0) ; python_full_version < "3.10.0"
36
- Requires-Dist: numpy (>=1.21.0,<2.0.0) ; python_full_version < "3.12.0"
37
- Requires-Dist: numpy (>=1.26.0,<2.0.0) ; python_full_version >= "3.12.0"
38
- Requires-Dist: platformdirs (>=3.10,<5.0)
39
- Requires-Dist: pyarrow (>=18.1.0) ; python_full_version >= "3.12.0"
40
- Requires-Dist: questionary (>=2.0.1,<3.0.0)
41
- Requires-Dist: rich-click (>=1.7.1,<2.0.0)
42
- Requires-Dist: shandy-sqlfmt (>=0.19.0)
43
- Requires-Dist: textual (==0.89.1)
44
- Requires-Dist: textual-fastdatatable (==0.11.0)
45
- Requires-Dist: textual-textarea (==0.15.0)
46
- Requires-Dist: tomlkit (>=0.12.5,<0.14.0)
47
- Project-URL: Repository, https://github.com/tconbeer/harlequin
48
- Description-Content-Type: text/markdown
49
-
50
- # Harlequin
51
-
52
- [![PyPI](https://img.shields.io/pypi/v/harlequin)](https://pypi.org/project/harlequin/)
53
-
54
- ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/harlequin)
55
- ![Runs on Linux | MacOS | Windows](https://img.shields.io/badge/runs%20on-Linux%20%7C%20MacOS%20%7C%20Windows-blue)
56
-
57
- The SQL IDE for Your Terminal.
58
-
59
- ![Harlequin](./harlequin.svg)
60
-
61
- ## Installing Harlequin
62
-
63
- After installing Python 3.8 or above, install Harlequin using `pip` or `pipx` with:
64
-
65
- ```bash
66
- pipx install harlequin
67
- ```
68
-
69
- ## Using Harlequin with DuckDB
70
-
71
- From any shell, to open one or more DuckDB database files:
72
-
73
- ```bash
74
- harlequin "path/to/duck.db" "another_duck.db"
75
- ```
76
-
77
- To open an in-memory DuckDB session, run Harlequin with no arguments:
78
-
79
- ```bash
80
- harlequin
81
- ```
82
-
83
- If you want to control the version of DuckDB that Harlequin uses, see the [Troubleshooting](https://harlequin.sh/docs/troubleshooting/duckdb-version-mismatch) page.
84
-
85
- ## Using Harlequin with SQLite and Other Adapters
86
-
87
- Harlequin also ships with a SQLite3 adapter. You can open one or more SQLite database files with:
88
-
89
- ```bash
90
- harlequin -a sqlite "path/to/sqlite.db" "another_sqlite.db"
91
- ```
92
-
93
- Like DuckDB, you can also open an in-memory database by omitting the paths:
94
-
95
- ```bash
96
- harlequin -a sqlite
97
- ```
98
-
99
- Other adapters can be installed using `pip install <adapter package>` or `pipx inject harlequin <adapter package>`, depending on how you installed Harlequin. For a list of known adapters provided either by the Harlequin maintainers or the broader community, see the [adapters](https://harlequin.sh/docs/adapters) page in the docs.
100
-
101
- ## Getting Help
102
-
103
- To view all command-line options for Harlequin and all installed adapters, after installation, simply type:
104
-
105
- ```bash
106
- harlequin --help
107
- ```
108
-
109
- To view a list of all key bindings (keyboard shortcuts) within the app, press <Key>F1</Key>. You can also view this list outside the app [in the docs](https://harlequin.sh/docs/bindings).
110
-
111
- COLOR, KEY BINDING, OR COPY-PASTE PROBLEMS? See [Troubleshooting](https://harlequin.sh/docs/troubleshooting/index) in the docs.
112
-
113
- ## More info at [harlequin.sh](https://harlequin.sh)
114
-
115
- Visit [harlequin.sh](https://harlequin.sh) for an overview of features and full documentation.
116
-
117
- ## Sponsoring Harlequin
118
-
119
- Please consider [sponsoring Harlequin's author](https://github.com/sponsors/tconbeer), so he can continue to dedicate time to Harlequin.
120
-
121
- ## Contributing
122
-
123
- Thanks for your interest in Harlequin! Harlequin is primarily maintained by [Ted Conbeer](https://github.com/tconbeer), but he welcomes all contributions!
124
-
125
- Please see [`CONTRIBUTING.md`](./CONTRIBUTING.md) for more information.
126
-
harlequin-2.0.0/README.md DELETED
@@ -1,76 +0,0 @@
1
- # Harlequin
2
-
3
- [![PyPI](https://img.shields.io/pypi/v/harlequin)](https://pypi.org/project/harlequin/)
4
-
5
- ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/harlequin)
6
- ![Runs on Linux | MacOS | Windows](https://img.shields.io/badge/runs%20on-Linux%20%7C%20MacOS%20%7C%20Windows-blue)
7
-
8
- The SQL IDE for Your Terminal.
9
-
10
- ![Harlequin](./harlequin.svg)
11
-
12
- ## Installing Harlequin
13
-
14
- After installing Python 3.8 or above, install Harlequin using `pip` or `pipx` with:
15
-
16
- ```bash
17
- pipx install harlequin
18
- ```
19
-
20
- ## Using Harlequin with DuckDB
21
-
22
- From any shell, to open one or more DuckDB database files:
23
-
24
- ```bash
25
- harlequin "path/to/duck.db" "another_duck.db"
26
- ```
27
-
28
- To open an in-memory DuckDB session, run Harlequin with no arguments:
29
-
30
- ```bash
31
- harlequin
32
- ```
33
-
34
- If you want to control the version of DuckDB that Harlequin uses, see the [Troubleshooting](https://harlequin.sh/docs/troubleshooting/duckdb-version-mismatch) page.
35
-
36
- ## Using Harlequin with SQLite and Other Adapters
37
-
38
- Harlequin also ships with a SQLite3 adapter. You can open one or more SQLite database files with:
39
-
40
- ```bash
41
- harlequin -a sqlite "path/to/sqlite.db" "another_sqlite.db"
42
- ```
43
-
44
- Like DuckDB, you can also open an in-memory database by omitting the paths:
45
-
46
- ```bash
47
- harlequin -a sqlite
48
- ```
49
-
50
- Other adapters can be installed using `pip install <adapter package>` or `pipx inject harlequin <adapter package>`, depending on how you installed Harlequin. For a list of known adapters provided either by the Harlequin maintainers or the broader community, see the [adapters](https://harlequin.sh/docs/adapters) page in the docs.
51
-
52
- ## Getting Help
53
-
54
- To view all command-line options for Harlequin and all installed adapters, after installation, simply type:
55
-
56
- ```bash
57
- harlequin --help
58
- ```
59
-
60
- To view a list of all key bindings (keyboard shortcuts) within the app, press <Key>F1</Key>. You can also view this list outside the app [in the docs](https://harlequin.sh/docs/bindings).
61
-
62
- COLOR, KEY BINDING, OR COPY-PASTE PROBLEMS? See [Troubleshooting](https://harlequin.sh/docs/troubleshooting/index) in the docs.
63
-
64
- ## More info at [harlequin.sh](https://harlequin.sh)
65
-
66
- Visit [harlequin.sh](https://harlequin.sh) for an overview of features and full documentation.
67
-
68
- ## Sponsoring Harlequin
69
-
70
- Please consider [sponsoring Harlequin's author](https://github.com/sponsors/tconbeer), so he can continue to dedicate time to Harlequin.
71
-
72
- ## Contributing
73
-
74
- Thanks for your interest in Harlequin! Harlequin is primarily maintained by [Ted Conbeer](https://github.com/tconbeer), but he welcomes all contributions!
75
-
76
- Please see [`CONTRIBUTING.md`](./CONTRIBUTING.md) for more information.
File without changes