Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[installation] Add instructions for how to use VisiData with UV #2591

Open
frosencrantz opened this issue Oct 31, 2024 · 8 comments
Open

[installation] Add instructions for how to use VisiData with UV #2591

frosencrantz opened this issue Oct 31, 2024 · 8 comments

Comments

@frosencrantz
Copy link
Contributor

@reagle recently had an issue with installing VisiData with uv #2560 that turned out to be an issue with the 3.1 release. I think the amazing thing from his bug was how easy it was to run Visidata with the latest release.

uv is easy to use, and can quickly install a usable version of VisiData. As @reagle showed, it is as simple as:

uvx visidata

If you want to add some additional packages you need to add --with flags per package. There might be an easier way to make uv install VisiData with a fuller set of packages than the default, so users can work with more than the default file formats.

Feature request: Update the instructions in https://github.com/saulpw/visidata/blob/develop/README.md to include uv instructions.

@reagle
Copy link
Contributor

reagle commented Oct 31, 2024

I won't speak to whether uvx or pipx merit special mention, but I don't think uv tool/uvx permits optional dependencies beyond those specified via --with. pipx can Install extras (in brackets, as defined by the packager) akin to what pip does.

@frosencrantz
Copy link
Contributor Author

It looks like you can do a one-time--with for uv tool/uvx, but you need to do uv install tool first.

https://docs.astral.sh/uv/concepts/tools/#the-uv-tool-interface says:

Tools can be invoked without installation using uv tool run, in which case their dependencies are installed in a temporary virtual environment isolated from the current project.

Because it is very common to run tools without installing them, a uvx alias is provided for uv tool run — the two commands are exactly equivalent. ...

Tools can also be installed with uv tool install, in which case their executables are available on the PATH — an isolated virtual environment is still used, but it is not removed when the command completes.

It is a good question should uvor pipx deserve special mention. I do not know, it does feel relevant right now. The uv tool is impressively fast. If someone is using that as one of their installation tools, it is fast and easy to try out VisiData. That seems useful for new and existing users.

@frosencrantz
Copy link
Contributor Author

With uv it is as simple as running:

uvx visidata https://raw.githubusercontent.com/jsvine/intro-to-visidata/refs/heads/master/datasets/faa-wildlife-strikes.csv

If you want to load additional file formats, you will need to install the necessary modules:

uv tool install visidata --with lxml --with zstandard
uvx visidata https://www.visidata.org/docs/formats/

@daviewales
Copy link
Contributor

daviewales commented Nov 13, 2024

If you document uv tool you might consider documenting pipx too while you're at it.

Also note, if you are using uv tool install, it adds the executable to the PATH, so you can just call it directly without uvx:

The example above should be:

uv tool install visidata --with lxml --with zstandard
visidata https://www.visidata.org/docs/formats/

The same with pipx:

pipx install visidata --preinstall lxml --preinstall zstandard
visidata https://www.visidata.org/docs/formats/

Or alternatively, you can inject the optional dependencies after installing as required:

pipx install visidata
pipx inject visidata lxml zstandard
visidata https://www.visidata.org/docs/formats/

@anjakefala
Copy link
Collaborator

anjakefala commented Nov 13, 2024

If you document uv tool you might consider documenting pipx too while you're at it.

This is probably the biggest reason we're not going to document it. =( There are a lot of pip alternative tools (poetry is another example), and I don't know if it's necessary for, or the place of, our documentation to cover them.

@daviewales
Copy link
Contributor

That's fair. Although I wouldn't consider most of the others to be in the same category as pipx and uv tool. The others are generally project management tools, while pipx and uv tool are mainly useful to add executables to your PATH.

@frosencrantz
Copy link
Contributor Author

@daviewales thank you I did not know that the command will be in my path. I was trying uv with its builtin pip, but it does seem like the "uvx" format makes it easy to use.

@anjakefala if the main README.md is not a good location, maybe the github wiki or visidata.org might be a good place for these additional instructions. Also, thank you for considering this.

@daviewales
Copy link
Contributor

uvx is essentially a shortcut for uv tool run, which is similar to pipx run. Both these run an uninstalled command directly without permanently installing it or adding it to the PATH. But uv tool install and pipx install are more permanent and add the scripts to PATH.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants