4 ms·
Nice work! These days I try to avoid interpreted CLI tools, you never know when they’re going to stop working. Rust/Go CLI tools basically work on Linux, Max,
by indemnity 6y ago
Nice work!
These days I try to avoid interpreted CLI tools, you never know when they’re going to stop working.
Rust/Go CLI tools basically work on Linux, Max, Windows without too much fuss.
Wish someone would rewrite Homebrew in Rust!
- chme 6y agoI never looked into Homebrew as I know that its mainly for MacOS. Since you are sort of making the connection for Homebrew to work without fuss on Linux and Windows as well, if implemented in Rust, I am asking myself what it would offer that a user of Linux and Windows is missing? Ordinary Linux distributions already have a package management and there is scoop and chocolaty for Windows.
- codetrotter 6y agoI didn’t read their comment that way. Although Homebrew does also exist for Linux, I think the absolute majority use it on macOS. Personally, being a user of Homebrew on macOS I’ve been thinking about wanting brew to be rewritten in Rust too. My own reason being that I think it would be faster when run, compared to the version they have of it currently which can be quite slow sometimes. And because I like Rust as a language and for its memory safety features. So I’d rather see brew implemented in Rust than in say C or C++, if a compiled language was to be used.
- antidocker 6y agoNo. Homebrew should use C++ and C++ is beautiful than that bogus Rust. I'm willing to war with Rust Cultists. Billion dollars would be spent on Ads in coming weeks. I will start from YouTube to show how cool is C++
- Xylakant 6y agoI don’t think that homebrew will ever get rewritten in anything other than ruby. It may be feasible to rewrite brew itself, but all the formulae are written in ruby, so moving away from it would insta-delete the entire ecosystem.
- indemnity 6y agoYeah, I can see how you could take that from my comment, it was a bit of a throwaway last line. I mainly want it to be rewritten in a compiled language for performance reasons, it's a sluggish beast. I haven't tried to use it on Linux (where it has some support), and definitely not on Windows (winget/chocolatey would be my port of call there). Examples of tools I use across operating systems that were written in Rust/Go, that pretty much are drop an executable somewhere and run: ripgrep, starship, tailscale, terraform, vault, etc. Whereas when something is written in Python, Ruby or similar, I'm rolling the dice, and I'm only an apt-get or dnf away from it breaking when I really need it.
- danmur 6y agoThere's truth in that, but it depends a bit how you install it. The OS packages are very reliable, and creating your own bundle (through a venv, or through something like pex) is pretty reliable too. (EDIT: talking about Python packages specifically, not so sure about other things)
- StavrosK 6y agoMy experience with Python has been that once you get past the initial setup (which may be tricky if you haven't figured your Python installation out yet), everything just works. As you say, if something doesn't work due to conflicting dependencies, usually creating a virtualenv solves it. I don't bother these days, as just installing everything with --user tends to always work.
- globular-toast 6y agoUse pipx. It's the only thing you should install with pip (and yes you should use --user to install it).
- StavrosK 6y agoYeah, I just read about it after seeing it around for years, and it looks fantastic. I might try it, but I've never had a problem installing apps, so I don't have a pressing need.
- globular-toast 6y agoTo be honest, the number of apps installed with python isn't really that high so you can get away with it most of the time. I like the fact that pipx solves the problem so I just do it once and forget about it. The real problems start when people write scripts and notebooks etc that use libraries that might just happen to be installed or, even worse, install new libraries. The only solution to that is often a scorched earth approach where you vow to never install anything outside a venv again.
- BiteCode_dev 6y agoIt's really a matter of culture. Things like httpie, jupyter, etc should be provided as pyz and binaries as well, not just pip installable, but python devs don't do that really often. It's a shame, because cli tools should be black boxes, people should not have to think about the implementation. I regularly see cli python tools that output stack traces on errors, and it should not happen. Anyway, if you want those tools to be always around, I really encourage you to grap a usb stick, and put them on there as pyz and binaries. It's always nice to have them at hand. Here is an example procedure for both (run them in a venv). For pyz files: python -m pip install shiv --user # (Yes, I realize how ironic this is). Then: python -m shiv httpie -o http.pyz -c http (download httpie, and creates a http.pyz file that will contains httpie and all it's dependancies, plus code to trigger the http command when called) This will let you do "python http.pyz" anywhere you have a modern python and enjoy httpie without the need to pip install it. For an exe (this is an example on linux, the commands are a bit different for windows and mac): python -m pip install nuitka httpie --user You need to have a C compiler and python headers around as well (gcc on linux will do, E.G: sudo apt install build-essential python3-dev on ubuntu). Then: python -m nuitka $(which http) --onefile --linux-onefile-icon /usr/share/pixmaps/python3.xpm --follow-imports --assume-yes-for-downloads Wait quite a bit. Now you have a nice stand alone AppImage you can call with ./http.bin to be used on any linux system, and not care if Python is installed to play with httpie. Here are the resulting files (available for 5 days) so you can see what it looks like: https://drop.chapril.org/download/a335a8e92f98ee02/#fHC1SvOwXrhIzTT93_Jtig https://drop.chapril.org/download/a335a8e92f98ee02/#fHC1SvOw...
- CameronNemo 6y agoIs this better than using pex?
- BiteCode_dev 6y agoPyz works with windows but not pex. Nuitka produces a standalone exe so no need to install python.
- acdha 6y agoI also like Rust tools but Python is quite manageable using either pyz or pipx: I use the latter to install each tool in its own virtual environment. Periodically I run “pipx upgrade-all” to install updates (including injected plugins) but otherwise spend almost no time on it.
- tyingq 6y agoThis looks like something to watch out for: https://github.com/rust-lang/rust/issues/62569 https://github.com/rust-lang/rust/issues/62569 Basically Rust ignores SIGPIPE, so if you don't use write!() or handle SIGPIPE yourself, large amounts of data going through a shell pipe can result in a panic. I wonder how many Rust CLI tools have the issue.