Skip to content

Commit 78b69f0

Browse files
committed
Add support for aur installation
1 parent 6b9b547 commit 78b69f0

File tree

3 files changed

+85
-35
lines changed

3 files changed

+85
-35
lines changed

README.md

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ uv tool install sqlit-tui
8686
pip install "sqlit-tui"
8787
```
8888

89+
### Method 4: AUR (Arch Linux)
90+
91+
```bash
92+
yay -S python-sqlit-tui
93+
```
94+
8995
## Usage
9096

9197
```bash
@@ -215,32 +221,33 @@ See `CONTRIBUTING.md` for development setup, testing, CI, and CockroachDB quicks
215221

216222
Most of the time you can just run `sqlit` and connect. If a Python driver is missing, `sqlit` will show (and often run) the right install command for your environment.
217223

218-
| Database | Driver package | `pipx` | `pip` / venv |
219-
| :--- | :--- | :--- | :--- |
220-
| SQLite | *(built-in)* | *(built-in)* | *(built-in)* |
221-
| PostgreSQL / CockroachDB / Supabase | `psycopg2-binary` | `pipx inject sqlit-tui psycopg2-binary` | `python -m pip install psycopg2-binary` |
222-
| SQL Server | `pyodbc` | `pipx inject sqlit-tui pyodbc` | `python -m pip install pyodbc` |
223-
| MySQL | `mysql-connector-python` | `pipx inject sqlit-tui mysql-connector-python` | `python -m pip install mysql-connector-python` |
224-
| MariaDB | `mariadb` | `pipx inject sqlit-tui mariadb` | `python -m pip install mariadb` |
225-
| Oracle | `oracledb` | `pipx inject sqlit-tui oracledb` | `python -m pip install oracledb` |
226-
| DuckDB | `duckdb` | `pipx inject sqlit-tui duckdb` | `python -m pip install duckdb` |
227-
| ClickHouse | `clickhouse-connect` | `pipx inject sqlit-tui clickhouse-connect` | `python -m pip install clickhouse-connect` |
228-
| Turso | `libsql-client` | `pipx inject sqlit-tui libsql-client` | `python -m pip install libsql-client` |
229-
| Cloudflare D1 | `requests` | `pipx inject sqlit-tui requests` | `python -m pip install requests` |
230-
| Snowflake | `snowflake-connector-python` | `pipx inject sqlit-tui snowflake-connector-python` | `python -m pip install snowflake-connector-python` |
231-
| Firebird | `firebirdsql` | `pip install firebirdsql` | `python -m pip install firebirdsql` |
224+
| Database | Driver package | `pipx` | `pip` / venv | aur |
225+
| :---------------------------------- | :--------------------------- | :------------------------------------------------- | :------------------------------------------------- | :----------------------------------------- |
226+
| SQLite | *(built-in)* | *(built-in)* | *(built-in)* | *(built-in)* |
227+
| PostgreSQL / CockroachDB / Supabase | `psycopg2-binary` | `pipx inject sqlit-tui psycopg2-binary` | `python -m pip install psycopg2-binary` | `pacman -S python-psycopg2` |
228+
| SQL Server | `pyodbc` | `pipx inject sqlit-tui pyodbc` | `python -m pip install pyodbc` | `yay -S python-pyodbc` |
229+
| MySQL | `mysql-connector-python` | `pipx inject sqlit-tui mysql-connector-python` | `python -m pip install mysql-connector-python` | `pacman -S python-mysql-connector` |
230+
| MariaDB | `mariadb` | `pipx inject sqlit-tui mariadb` | `python -m pip install mariadb` | `yay -S python-mariadb-connector` |
231+
| Oracle | `oracledb` | `pipx inject sqlit-tui oracledb` | `python -m pip install oracledb` | `yay -S python-oracledb` |
232+
| DuckDB | `duckdb` | `pipx inject sqlit-tui duckdb` | `python -m pip install duckdb` | `yay -S python-duckdb` |
233+
| ClickHouse | `clickhouse-connect` | `pipx inject sqlit-tui clickhouse-connect` | `python -m pip install clickhouse-connect` | `yay -S python-clickhouse-connect` |
234+
| Turso | `libsql-client` | `pipx inject sqlit-tui libsql-client` | `python -m pip install libsql-client` | (not supported) |
235+
| Cloudflare D1 | `requests` | `pipx inject sqlit-tui requests` | `python -m pip install requests` | `pacman -S python-requests` |
236+
| Snowflake | `snowflake-connector-python` | `pipx inject sqlit-tui snowflake-connector-python` | `python -m pip install snowflake-connector-python` | `yay -S python-snowflake-connector-python` |
237+
| Firebird | `firebirdsql` | `pip install firebirdsql` | `python -m pip install firebirdsql` | (not supported) |
232238

233239
**Note:** SQL Server also requires the platform-specific ODBC driver. On your first connection attempt, `sqlit` can help you install it if it's missing.
234240

235241
### SSH Tunnel Support
236242

237243
SSH tunnel functionality requires additional dependencies. Install with the `ssh` extra:
238244

239-
| Method | Command |
240-
| :--- | :--- |
241-
| pipx | `pipx install 'sqlit-tui[ssh]'` |
242-
| uv | `uv tool install 'sqlit-tui[ssh]'` |
243-
| pip | `pip install 'sqlit-tui[ssh]'` |
245+
| Method | Command |
246+
| :----- | :------------------------------------------- |
247+
| pipx | `pipx install 'sqlit-tui[ssh]'` |
248+
| uv | `uv tool install 'sqlit-tui[ssh]'` |
249+
| pip | `pip install 'sqlit-tui[ssh]'` |
250+
| aur | `pacman -S python-paramiko python-sshtunnel` |
244251

245252
If you try to create an SSH connection without these dependencies, sqlit will detect this and show you the exact command to install them for your environment.
246253

aur/PKGBUILD

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,23 @@ license=('MIT')
99
depends=(
1010
'python>=3.10'
1111
'python-textual'
12-
'python-pyodbc'
12+
'python-textual-fastdatatable'
1313
'python-pyperclip'
14-
'python-sshtunnel'
15-
'python-paramiko'
1614
'python-keyring'
15+
'python-docker'
1716
)
1817
optdepends=(
19-
'python-psycopg2: PostgreSQL and CockroachDB support'
18+
'python-psycopg2: PostgreSQL, CockroachDB and Supabase support'
19+
'python-pyodbc: SQL Server support'
2020
'python-mysql-connector: MySQL support'
21+
'python-mariadb-connector: MariaDB support'
2122
'python-oracledb: Oracle support'
22-
'python-mariadb: MariaDB support'
2323
'python-duckdb: DuckDB support'
24+
'python-clickhouse-connect: ClickHouse support'
25+
'python-requests: Cloudflare D1 support'
26+
'python-snowflake-connector-python: Snowflake support'
27+
'python-paramiko: SSH tunnel support'
28+
'python-sshtunnel: SSH tunnel support'
2429
)
2530
makedepends=('python-build' 'python-installer' 'python-hatchling')
2631
source=("https://files.pythonhosted.org/packages/source/s/sqlit-tui/sqlit_tui-${pkgver}.tar.gz")

sqlit/install_strategy.py

Lines changed: 49 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,16 @@ def _user_site_enabled() -> bool:
8181
return False
8282

8383

84+
def _is_arch_linux() -> bool:
85+
"""Check if running on Arch Linux or derivative."""
86+
try:
87+
with open("/etc/os-release") as f:
88+
content = f.read().lower()
89+
return "arch" in content or "manjaro" in content or "endeavouros" in content
90+
except (FileNotFoundError, PermissionError):
91+
return False
92+
93+
8494
def _install_paths_writable() -> bool:
8595
try:
8696
paths = sysconfig.get_paths()
@@ -99,19 +109,47 @@ def _install_paths_writable() -> bool:
99109
return False
100110

101111

112+
def _get_arch_package_name(package_name: str) -> str | None:
113+
"""Map PyPI package name to Arch Linux package name."""
114+
mapping = {
115+
"psycopg2-binary": "python-psycopg2",
116+
"psycopg2": "python-psycopg2",
117+
"pyodbc": "python-pyodbc",
118+
"mysql-connector-python": "python-mysql-connector",
119+
"mariadb": "python-mariadb-connector",
120+
"oracledb": "python-oracledb",
121+
"duckdb": "python-duckdb",
122+
"clickhouse-connect": "python-clickhouse-connect",
123+
"snowflake-connector-python": "python-snowflake-connector-python",
124+
"requests": "python-requests",
125+
"paramiko": "python-paramiko",
126+
"sshtunnel": "python-sshtunnel",
127+
}
128+
return mapping.get(package_name)
129+
130+
102131
def _format_manual_instructions(package_name: str, reason: str) -> str:
103132
"""Format manual installation instructions with rich markup."""
104-
return (
105-
f"{reason}\n\n"
106-
f"[bold]Install the driver using your preferred package manager:[/]\n\n"
107-
f" [cyan]pip[/] pip install {package_name}\n"
108-
f" [cyan]pipx[/] pipx inject sqlit-tui {package_name}\n"
109-
f" [cyan]uv[/] uv pip install {package_name}\n"
110-
f" [cyan]uvx[/] uvx --with {package_name} sqlit-tui\n"
111-
f" [cyan]poetry[/] poetry add {package_name}\n"
112-
f" [cyan]pdm[/] pdm add {package_name}\n"
113-
f" [cyan]conda[/] conda install {package_name}"
114-
)
133+
lines = [
134+
f"{reason}\n",
135+
"[bold]Install the driver using your preferred package manager:[/]\n",
136+
f" [cyan]pip[/] pip install {package_name}",
137+
f" [cyan]pipx[/] pipx inject sqlit-tui {package_name}",
138+
f" [cyan]uv[/] uv pip install {package_name}",
139+
f" [cyan]uvx[/] uvx --with {package_name} sqlit-tui",
140+
f" [cyan]poetry[/] poetry add {package_name}",
141+
f" [cyan]pdm[/] pdm add {package_name}",
142+
f" [cyan]conda[/] conda install {package_name}",
143+
]
144+
145+
# Add Arch Linux instructions if on Arch
146+
if _is_arch_linux():
147+
arch_pkg = _get_arch_package_name(package_name)
148+
if arch_pkg:
149+
lines.append(f" [cyan]pacman[/] pacman -S {arch_pkg}")
150+
lines.append(f" [cyan]yay[/] yay -S {arch_pkg}")
151+
152+
return "\n".join(lines)
115153

116154

117155
def detect_strategy(*, extra_name: str, package_name: str) -> InstallStrategy:

0 commit comments

Comments
 (0)