B2_Command_Line_Tool
B2_Command_Line_Tool copied to clipboard
on MacOS binary release "b2-cli [-h]" command is executed after upload_file or download_file commands are used
Environment / versions:
./b2-cli version
b2 command line tool, version 3.3.0 (self-contained download for Mac)
python3 --version Python 3.8.9
macOS: 12.3.1 (on M1 apple silicon)
Steps:
- Call upload file command (e.g. ./b2-cli upload-file bucket_name ~/folder_path/test_file.jpeg
- Check output of the command
Expected: Response data should be displayed and command prompt returned
Actual:
Response data is displayed, then immediately after it, I see something like this in terminal: myname@machine ~ % b2-cli [-h]
and then a whole help page is printed to console and command prompt doesn't "return" (doesn't show on new line)
This is a bug in the macos binary, which is being phased out (in part because of this bug, but also because it's slow).
Please use brew install b2-tools
instead.
I lived with this bug for half a year.
Maybe this info should be posted somewhere? In the readme, standalone CLI is "the most straightforward way to use", pip install b2
an alternative.
Btw, what is the difference to brew install b2-tools
brew
installs from a macos repository where someone uploads it (not sure who), pip
installs it from pypi where it's being uploaded by github actions whenever a tag is pushed to this repo.
It's time to remove the macos binary and adjust the installation instructions.
Thanks for the clarification.
The binary is also on Backblaze's website. That's why I thought it's the way to go.
I find it very disappointing that this whole tail of installations has to be done for a simple cli tool. (python then pip OR home-brew with hundreds of directories created) Why can we not have a working executable? I also don't understand the connection of backblaze to this GitHub project. Backblaze make it seem the b2 CLI is theirs and is a professional offering.
Personally I'd be quite disappointed if the standalone releases went away.
Providing a binary is quick and simple, whereas homebrew is slow and complicated.
🤔 how long does running brew install b2-tools
take?
Sometimes upwards of 15 minutes if brew needs to be updated over a slow connection.
Also, with standalone releases I can pin a specific version. This is especially useful for CI jobs.
Homebrew integration with CI isn't very good, and there's no way to pin specific versions easily. Homebrew is probably fine for a developer machine, but it's not a good enough solution for running on servers or CI machines.
There are cases where I might have multiple scripts that specify different versions of a tool (like b2 cli), and homebrew doesn't handle this well either.
Due to the way python packages are wrapped up together by pyinstaller (a tool to turn a python program into an executable) for osx, the cli in the console version can be slower than we'd like it to be. The version installed from brew
and pip
is way faster. The linux binary is as fast as the version from pip
and the Windows binary is, admittedely, slightly slower, but the difference is so small that even I can't be bothered. On Windows I just use the binary myself.
Testing the osx binary slows down development, because the test suite that normally runs for a couple of minutes takes ages to execute on the osx binary version.
While I'm not in a hurry to remove the osx binary, I'd like to stop saying it's a recommended way. It's sort of a "if you have to", "that might be a best option in some circumstances" etc, but I'd argue that most osx B2 cli users won't be installing it while on a slow connection.
As for pinning versions, pip
is not bad and B2 cli as well as b2-sdk-python have a rather legendary track record in terms of backwards compatibility.
One way of using b2 cli with a pinned version may be through docker, which supports pinning and isolates environments so that the dependency hell that you've mentioned is not a problem.
Since MacOS binary has been since removed completely, we now encourage using other methods of B2 CLI installation, as listed above. A relative new addition is the official Docker image: https://github.com/Backblaze/B2_Command_Line_Tool#docker-image , which as mentioned offers better ability to pin to specific version.