Just dropped: Fabric 2.0!
As announced by the creator of Fabric on GitHub, the entire codebase has been migrated to Go. This change offers several advantages, the most significant being a much simpler installation process. If you were hesitant about using Fabric after reading my first post, perhaps now is a good time to give it a try.
About the New Installation Process
The main difference is the new programming language. Switching from Python to Go allows the code to be compiled as an executable, which is not typically possible with Python. The developers of Fabric have managed to reduce the installation process to a single command. It should also be possible to package the application as an executable and offer it for download as a released version. However, you will still need to have the Go language installed on your machine to compile it locally.
Prerequisites
Let's begin the new installation process with a much shorter list of prerequisites.
API Keys
You will always need API keys to connect to the different AI models you want to set up in Fabric. In my case, I'm only interested in OpenAI and YouTube. Refer back to my first post if you need help obtaining these API keys.
Install Go
To install Go, you can either visit their website and download the installer or perform a CLI installation.
- Windows (using PowerShell):
winget install golang.go- Linux (Debian-based):
sudo apt install golang-go- Mac:
brew install goPre-Migration Cleanup
If you are transitioning from the Python version of the software, you will need to uninstall it first. Open your terminal and run the following command:
pipx uninstall fabricYou may also need to clean up any aliases pointing to the software. I removed the following lines from my .bashrc file:
# Created by pipx on 2024-07-28 11:57:57
export PATH="$PATH:/home/dirgosalga/.local/bin"
if [ -f "/home/dirgosalga/.config/fabric/fabric-bootstrap.inc" ]; then . "/home/dirgosalga/.config/fabric/fabric-bootstrap.inc"; fi
Installation
To install Fabric, run:
go install github.com/danielmiessler/fabric@latestAfterward, complete the setup process by running: fabric --setup.
The yt command is now a separate program. Fortunately, installation remains simple. Just run:
go install github.com/danielmiessler/yt@latestBefore using yt, you need to set up the API key. Open your Fabric .env file located in your home directory. The program will prompt you if you try to run yt without an API key:
2024/08/17 15:12:22 Error: YOUTUBE_API_KEY not found in ~/.config/fabric/.env. To add, please run "echo YOUTUBE_API_KEY="[Your API Key]" >> ~/.config/fabric/.env".
Add the following line at the bottom of the .env file (don't include the brackets):
YOUTUBE_API_KEY=[Your API Key]
And that's it! I expect that adding the API key through a setup routine will be available in a future version, as is already the case for Fabric.
Conclusion
That was a short guide on installing the new version of Fabric written in Go. Have fun with it!