Litecli: CLI for SQLite Databases with auto-completion and syntax highlighting

161 pointsposted 6 days ago
by tosh

30 Comments

senkora

4 days ago

This uses the same TUI library as IPython, called prompt_toolkit.

It’s the best one for Python in my opinion. Pretty easy to work with.

devnonymous

3 days ago

Yep ! ...and if you want the same ux with Postgresal, MySQL or Mariadb you have pgcli and mycli.

There also a tmux and vim clone that uses prompt_toolkit iirc.

darkteflon

2 days ago

prompt_toolkit looks good. Have you tried Textual? Any thoughts on how they compare?

senkora

a day ago

I haven't tried Textual but I just gave it a look and it seems good as well.

My usecase involves embedding a text editor widget inside my TUI app with vim keybindings enabled, and I don't think that Textual yet has a way to do that. But on the other hand it looks like Textual has a way bigger library of pre-built widgets for full-screen applications.

prompt_toolkit started as a tool for REPLs and eventually grew a basic full-screen application mode, so there's excellent support for text editing and the widget stuff is a lot less mature. It looks like Textual started as a tool for full-screen apps and has a great widget library but the text-editing widget is much less mature.

My application started as a CLI and I gradually added TUI elements around the command bar, and prompt_toolkit is definitely the best for something like that. I think that if your plan is something more similar to a webapp and you want to rely on a component library then Textual would probably be better.

walthamstow

5 days ago

This whole suite of DBCLIs are brilliant. I use litecli and pgcli most often but they're all good.

prudentpomelo

4 days ago

Downloaded it this morning on my work machine and it worked like a dream. Multiline mode and vim bindings were the chefs kiss that brought it all together.

pdyc

5 days ago

is there a binary only utility like this that does not requires messing up with python?

rented_mule

4 days ago

If you install https://github.com/astral-sh/uv (it's really just two binaries... uv and uvx), then you can run many Python CLIs, and it will manage everything for you. This means resolving and downloading dependencies without touching your system Python. In this case, you'd type `uvx litecli`. If uvx can't find a suitable Python already installed, it will do its best to download a privately managed version. And it's very fast at doing all this.

synergy20

3 days ago

I assume it works like pipx, caches the download until a new reboot

rented_mule

3 days ago

Yes, uvx's behavior is a lot like pipx, but much faster to start up programs (just as uv is much faster than pip), whether cached or not.

darkteflon

2 days ago

Huh, I’m a big rye user but had no idea that uvx was a drop-in replacement for pipx. Thanks!

djbusby

3 days ago

I do all my Python stuff in a container. I've found it easier than the N+ other methods. As a bonus when creating the container one can basically just use the tools the project author likes (pip, ,etc) even legacy things from older scripts.

hprotagonist

3 days ago

`pipx run litecli`

saghm

3 days ago

The fact that there are already multiple comments with different tools recommended for how to easily deal with Python packages is a perfect example of why people like the parent commenter don't want to deal with Python in the first place. I'm sure that "just use pipx" works well for you and others, but for those of us who don't know the difference between the half dozen or so different package managers that seem to be mentioned whenever Python comes up, we don't have any clue whether pipx is the "right" choice or if "uv"/"uvx" like the sibling commenter recommends is better. We could spend time researching to figure that out, but that's exactly what we're trying to avoid in the first place!

rmbyrro

3 days ago

There's nothing inherently wrong with having options.

This is the classic trade-off between convention and configuration.

You can prefer a tech stack that values convention over configuration, while others prefer the opposite.

This is totally fine.

saghm

3 days ago

I don't disagree with your premise, but I'd argue that's not what's happening here. My perception that Python doesn't have half a dozen different tools for making package management better because the community values choice and prefers it to having a default option that does everything they want, it's that the default one isn't good enough for what people seem to want, and the community is trying to make up for that.

rmbyrro

2 days ago

If I had to bet, at least half Python projects use the standard packaging.

Python applications vary widly. Having a single standard option for packaging that is good enough for all isn't the core language goal.

darkteflon

2 days ago

pyproject.toml + rye/uv is excellent.

hprotagonist

3 days ago

with choice, comes responsibility.

with no choice comes responsibility too, it's just that neither are yours, and likely aren't what you'd want.

edit: at this time, incidentally, i'm choosing to not use the VC-backed out-of-ecosystem toolchain (ruff, uv); pipx and setuptools do just fine.

saghm

3 days ago

Unfortunately, for a lot of people (including myself), the choice is increasingly to just avoid Python whenever possible rather than try to delve into all of this. I didn't even know that _any_ of the tools were VC-backed.

hprotagonist

3 days ago

It's how language ecosystems work when there's no authority with real power at the top. Python doesn't have real power at the top. Of late the SC thinks it wants to be that power. The developer base, mostly made up of people accustomed to both a language and community that is historically allergic to the idea that you can be told what not to do, largely disagrees. So, you get a cambrian explosion.

C# doesn't have this problem, for example -- though it has others. My (very brief) contact with rust crates as a user suggests that rust does; elisp/emacs absolutely does, and in spades; js might but i've never written a line so i don't know.

end of the day, python solves my business needs, so I've learned to walk the tangle. So much so that it makes sense, usually...

dbtablesorrows

3 days ago

What's wrong with pipx install?

hprotagonist

3 days ago

nothing!

CRConrad

2 days ago

Lots.

Perhaps not with pipx itself, but as a symptom of what's wrong with Python (and most software nowadays) there are lots of problems with it: Everything is such huge stacks of stuff built on other stuff built on other stuff built on other stuff... All huge tottering heaps of infrastructure where shit can (and does) go wrong in every layer. It's package managers running in containers calling dynamically-linked libraries running on virtual machines calling package managers running in containers calling dynamically-linked libraries running on virtual machines...

With, say, Turbo Pascal you compiled your code into a .COM file, copied it to a floppy, and people ran it. Just your program. On their OS. No heaps of layers of infrastructure and toolchains to get knotted into a tangle of failing interdependencies. How the fuck can it be so impossible to build stuff like that nowadays?!?

Not that I'm blaming pipx (whatevertheheck that is; judging from the name seems to be a relative of pip's, which I've heard of) in particular, or even Python itself, more than anything else. Almost everything nowadays seems to be that way. I just wrote all this in the hope that it might explain why a lot of us (like for instance your interlocutor saghm in a sibling thread) are rather reluctant to pick up all the New[1] Shiny stuff. It all seems to so inevitably bring with it rat's nests -- colonies of rat's nests! -- of interdependent cruft tangled up into tight balls of mud and misery. You lose the will to even start trying anything out.

___

[1]: And yeah, OK, calling Python "New" might be problematic... If we'd gotten around to picking it up some fifteen years ago it might still have been. And maybe not accrued as many layers of cruft.

> With, say, Turbo Pascal you compiled your code into a .COM file, copied it to a floppy, and people ran it. Just your program. On their OS. No heaps of layers of infrastructure and toolchains to get knotted into a tangle of failing interdependencies. How the fuck can it be so impossible to build stuff like that nowadays?!?

Go or Java PicoCLI with graalvm gets you pretty close to this ideal. (Now Desktop GUI is a fallen idea and we are talking about CLIs).

Anyway you're blaming the wrong thing. What pipx and venv do in python is fairly simple stuff. It's pretty reliable on standard setups. The problems if any come from C libraries.

The NodeJS Electron stack / docker / kubernetes you can feel free to blame.

CRConrad

9 hours ago

> Go or Java PicoCLI with graalvm gets you pretty close to this ideal.

Oh yippee, only one unnecessary VM layer. :-(

> Now Desktop GUI is a fallen idea and we are talking about CLIs

??? WTF are you talking about? In the real -- i.e. boring old enterprisey -- world, people work in desktop GUIs. (Except of course where those have been replaced by shitty Web-browser UIs.)

frays

4 days ago

Thanks for sharing.

I should check out pgcli too when I use Postgres in the future.

faangguyindia

5 days ago

[flagged]

outlore

4 days ago

better tooling is not in competition to AI, actually both are in service of the same goal to assist the user

ptspts

5 days ago

It's still useful for the remaining 10%.