Browse Source

feat: install poetry when running setup.sh

pull/165/head
Samy Ghannad 1 year ago
parent
commit
a389c69ab9
  1. 16
      README.md
  2. 39
      setup.sh

16
README.md

@ -152,15 +152,7 @@ cd fabric
chmod +x setup.sh
```
5. Install poetry
ref.: https://python-poetry.org/docs/#installing-with-the-official-installer
```bash
curl -sSL https://install.python-poetry.org | python3 -
```
6. Run the `setup.sh`, which will do the following:
5. Run the `setup.sh`, which will do the following:
- Installs python dependencies.
- Creates aliases in your OS. It should update `~/.bashrc`, `/.zshrc`, and `~/.bash_profile` if they are present in your file system.
@ -169,9 +161,9 @@ curl -sSL https://install.python-poetry.org | python3 -
./setup.sh
```
7. Restart your shell to reload everything.
6. Restart your shell to reload everything.
8. Set your `OPENAI_API_KEY`.
7. Set your `OPENAI_API_KEY`.
```bash
fabric --setup
@ -179,7 +171,7 @@ fabric --setup
You'll be asked to enter your OpenAI API key, which will be written to `~/.config/fabric/.env`. Patterns will then be downloaded from Github, which will take a few moments.
9. Now you are up and running! You can test by pulling the help.
8. Now you are up and running! You can test by pulling the help.
```bash
# Making sure the paths are set up correctly

39
setup.sh

@ -7,6 +7,45 @@ if [ ! -f "pyproject.toml" ]; then
exit 1
fi
# Check if Poetry is already installed
if command -v poetry &> /dev/null
then
echo "Poetry is already installed."
else
# Prompt the user if they want to install Poetry
read -p "Poetry is not installed. Do you want to install it? (y/n): " choice
choice=$(echo "$choice" | tr '[:upper:]' '[:lower:]') # Convert to lowercase
if [[ $choice =~ ^(y|yes)$ ]]
then
echo "Installing Poetry..."
curl -sSL https://install.python-poetry.org | python3 -
# Detect the user's shell
if [[ "$SHELL" == *"/bash" ]]; then
config_file=".bashrc"
elif [[ "$SHELL" == *"/zsh" ]]; then
config_file=".zshrc"
fi
# Add Poetry to the PATH
if [[ -n "$config_file" ]]; then
if [[ ":$PATH:" != *":$HOME/.local/bin:"* ]]; then
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/$config_file
eval 'export PATH="$HOME/.local/bin:$PATH"'
fi
else
echo "Unable to determine the shell configuration file."
echo "Please manually add the following line to your shell configuration file:"
echo 'export PATH="$HOME/.local/bin:$PATH"'
fi
echo "Poetry has been installed successfully."
else
echo "Poetry installation skipped."
fi
fi
# Installs poetry-based python dependencies
echo "Installing python dependencies"
poetry install

Loading…
Cancel
Save