Live data from Hacker News

Harlequin: SQL IDE for Your Terminal

github.com

31–40 of 89 posts

Re: Harlequin: SQL IDE for Your Terminal

#31
post #19

Every time I notice something is a Python codebase I feel a letdown as it means it will likely break some other Python project from someone else I have on my dev machine which I may not have touched in a while but which I will find got silently broken when I most need it Especially if it's a nice TUI app like this looks EDIT: Guys, in my experience, virtual environments do not fix this problem in all cases . At least…

This is the problem that 'venv' (virtual environments) was designed to solve. You can run pip in an isolated virtual environment, in user mode (not as root) - see https://gist.github.com/saurabhshri/46e4069164b87a708b39d947...

See my sibling response(s). Also this comment criticizing the solution in that link you gave me:

https://gist.github.com/saurabhshri/46e4069164b87a708b39d947...

Re: Harlequin: SQL IDE for Your Terminal

#32

Every time I notice something is a Python codebase I feel a letdown as it means it will likely break some other Python project from someone else I have on my dev machine which I may not have touched in a while but which I will find got silently broken when I most need it Especially if it's a nice TUI app like this looks EDIT: Guys, in my experience, virtual environments do not fix this problem in all cases . At least…

This isn’t an issue if you use virtual environments. See also pipx for installing isolated Python apps.

See my sibling response(s).

Re: Harlequin: SQL IDE for Your Terminal

#33

Earlier quoted context omitted.

Hair pulling? It's the most barebones unix thing you can imagine. If you understand unix principles, you can use virtual environments and python. It used to be hard. A global site-packages or dist-packages dir is hard. Conda and all those tools make it worse. A virtualenv is a directory. It contains a copy of Python and everything needed. You don't even need to activate it. You can simply use the binaries that exist…

And this works with every existing Python project out there? What about `requirements.txt` projects?

requirements.txt is just a list of packages for pip. It doesn't even need to be called requirements.txt, it could be called poopoopeepee.txt. That name is just a convention.

You could do `for line in requirements.txt, pip install `. They are ostensibly the same. It is not a magical lockfile. It is unix. It is just a list if packages. If you are in a virtualenv, you will be fine.

either activate the venv,

    source venv_directory/bin/activate
    pip install -r requirements.txt
or, skip the convenience and use the binary directly:

    venv_directory/bin/pip install -r requirements.txt
virtualenv activation just sets the $PATH to refer to those binaries. you can use them directly.

the production deployment for my core python app lives in /srv/app, the venv lives in /srv/venv

To update packages on the system, it is as simple as

   cd /srv/app
   /srv/venv/bin/pip install -r requirements.txt
Then to invoke this with the correct runtime, it is as easy as

   /srv/venv/bin/gunicorn ...
In this example I am running the gunicorn application server. This is running the specific gunicorn version installed into my virtualenv.

The name `/srv/venv` is my decision. You can call that whatever you want and put it wherever you want. For instance, if you have two projects called application-foo and application-bar, you can have the following:

    /srv/application-foo/app - the codebase (ie, the github repo)
    /srv/application-foo/venv - the corresponding virtualenv
    /srv/application-bar/app
    /srv/application-bar/venv
Some people will even put their venv dir inside of their source tree and exclude it from git (add to .gitignore), but I do not like this approach because my deployments destroy the app dir and unzip the build into that location on each deploy.

I cannot speak for every python-based project (distinction from pip package) out there. A lot of people do not know what they are doing, open source is literally all the rope to hang yourself with. Anything is possible, and people without engineering experience will glue things together without understanding how they work.

If you are installing something via pip, then yes, you can create N virtualenvs and use them however you want. They are 100% isolated environments.

If you are using homebrew, apt-get, dnf/yum, arch etc... then those are going to obviously vary from distro to distro and that is outside the scope of this discussion.

I try to stick to Python's native tools as much as possible. Using a distribution package is going to cause issues, for sure. IE, don't install `apt-get install python-pil`, use a virtual environment and `pip install PIL`

Re: Harlequin: SQL IDE for Your Terminal

#34
post #7

Question: do people love TUI, because they love being in a terminal? Or ... is this a movement against application bloat, which has become all to common these days? EDIT: why the downvotes?

I like TUI because it usually works nicely with multiplexer like zellij or tmux. Open a new pane or tab where you can open a new set of TUI apps.

Like have Helix or Nvim open, but you want to quickly check your database queries code changes. You can just open a new tab run the this sql IDE, fire off some queries check the result if it matches go back to coding new features. If not change the code, check queries again etc etc.

Re: Harlequin: SQL IDE for Your Terminal

#35
post #4

Suggestion: under "works with your database" consider naming the databases rather than only offering a list of icons. Also seems to be a bit of hubris to claim a SQL IDE "works with your database" when SQL Server and Oracle, two of the database products with the largest market share, are not supported (yet?)

> SQL Server and Oracle

Alright so first off, for 90% of SQL Server's existence, Microsoft was openly open-source-hostile, so give me a fucking break with this. Microsoft used to be way worse than even Apple about keeping everything in their ecosystem- at least Apple is built on BSD underpinnings and was therefore also always compatible with POSIX stuff.

Oracle... last I checked on that monstrosity it had about 20 different clients all written at different times for different use cases over the long course of Oracle's history. So, which of these 20 different clients should one write a TUI for?

Re: Harlequin: SQL IDE for Your Terminal

#36

Every time I notice something is a Python codebase I feel a letdown as it means it will likely break some other Python project from someone else I have on my dev machine which I may not have touched in a while but which I will find got silently broken when I most need it Especially if it's a nice TUI app like this looks EDIT: Guys, in my experience, virtual environments do not fix this problem in all cases . At least…

every project you have should be in a virtual environment. it is not hard. https://docs.python.org/3.12/library/venv.html python -m venv ~/my-venvs/ source ~/my-venvs/name/bin/activate pip install but stuff like this would usually get installed globally, and your projects would instead have a venv. personally my favorite tool is pyenv, which allows you to have many versions of python on your machine as well as many v…

I made a simple CLI wrapper that automates this, like Poetry does, except my wrapper uses pip.

https://github.com/jzombie/pipper

Re: Harlequin: SQL IDE for Your Terminal

#37
post #7

Question: do people love TUI, because they love being in a terminal? Or ... is this a movement against application bloat, which has become all to common these days? EDIT: why the downvotes?

Speaking for myself, it wasn't a "movement against application bloat" so much as a "frustrated response to these darn bloated applications." There wasn't anything ideological about it, I literally ran out of memory a few times when using VSCode. The important thing is that editing plain text works perfectly well in a terminal, whereas you need a modern GUI for most other business-related software.

I switched to emacs during the pandemic because of Zoom and Slack (along with my horrible browser habits). VSCode is pretty reasonable on resources compared to many Electron apps, and I slightly prefer it to emacs in terms of overall experience. But emacs is also good, and there were just too many Zoom calls where my computer ran out of memory, with VSCode having a glaringly high footprint. I think at the time its terminal emulator was either excessively inefficient, or it had a specific resource leak. So maybe things have gotten better, but I've stuck with emacs regardless.

These days I can let a few dozen unread tabs in Firefox fill in the extra ~1GB of memory VSCode was formerly occupying :)

Re: Harlequin: SQL IDE for Your Terminal

#38
post #36

Earlier quoted context omitted.

every project you have should be in a virtual environment. it is not hard. https://docs.python.org/3.12/library/venv.html python -m venv ~/my-venvs/ source ~/my-venvs/name/bin/activate pip install but stuff like this would usually get installed globally, and your projects would instead have a venv. personally my favorite tool is pyenv, which allows you to have many versions of python on your machine as well as many v…

I made a simple CLI wrapper that automates this, like Poetry does, except my wrapper uses pip. https://github.com/jzombie/pipper

Have you seen Pipx or its predecessor Pipsi?

Although your tool looks more like Virtualenvwrapper.

It's good to have other options of course (and yours looks nice), but it's also good to at least make a case for improvement over what's already out there.

Re: Harlequin: SQL IDE for Your Terminal

#39

Earlier quoted context omitted.

Hair pulling? It's the most barebones unix thing you can imagine. If you understand unix principles, you can use virtual environments and python. It used to be hard. A global site-packages or dist-packages dir is hard. Conda and all those tools make it worse. A virtualenv is a directory. It contains a copy of Python and everything needed. You don't even need to activate it. You can simply use the binaries that exist…

And this works with every existing Python project out there? What about `requirements.txt` projects?

It works for installing dependencies from Pip, so yes, unless that Python project is doing something bizarre that it shouldn't be doing.

It's functionally identical to node_modules or Ruby Bundler or Perl local::lib.

It's so weird to me that people continue to hate Python for a problem that literally every programming language has had since shared libraries were invented.

Re: Harlequin: SQL IDE for Your Terminal

#40
post #3

I have been looking for a nice SQL TUI and this looks like it. Will give it a try. Thank you.

pspg is a pager intended to be used with SQL command line clients. It was originally created for Postgres (hence the name), but also works with MySQL and others

https://github.com/okbob/pspg

Post reply on HN