Skip to content

Commit

Permalink
Update scaf to use uv instead of docker
Browse files Browse the repository at this point in the history
  • Loading branch information
rehan892 committed Dec 23, 2024
1 parent a6dcf50 commit 6f2e686
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 13 deletions.
14 changes: 13 additions & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,18 @@ install_tilt() {
tilt version
}

install_uv() {
echo "Installing uv..."
curl -LsSf https://astral.sh/uv/install.sh | sh
if command_exists uv; then
echo "🎉 uv installed successfully 🎉"
uv --version
else
echo "🧨 Failed to install uv. 🧨"
exit 1
fi
}

install_scaf() {
# Install/re-install scaf
if [ -f "$TEMP_DOWNLOAD" ]; then
Expand Down Expand Up @@ -318,7 +330,7 @@ check_top_level_dependencies
[ -n "$DEBUG" ] && echo "Checking Git Config"
check_git_config

for tool in kubectl kind tilt; do
for tool in kubectl kind tilt uv; do
if ! command_exists $tool; then
echo "$tool is not installed."
install_$tool
Expand Down
32 changes: 20 additions & 12 deletions scaf
Original file line number Diff line number Diff line change
Expand Up @@ -229,19 +229,27 @@ if [[ "$SCAF_CHALLENGE" == "y" ]]; then
CHALLENGE_CONFIG=$(cat $CHALLENGE_CONFIG_PATH)
fi

IMAGE_TAG=${IMAGE_TAG:-latest}
docker run --rm $DOCKER_RUN_OPTIONS -v "$(pwd):/home/scaf/out" \
-e HOST_UID="$(id -u)" \
-e HOST_GID="$(id -g)" \
-e CHALLENGE_CONFIG="$CHALLENGE_CONFIG" \
docker.io/sixfeetup/scaf:$IMAGE_TAG \
cookiecutter \
$COOKIECUTTER_OPTIONS \
$REPO_URL \
--directory="$DEFAULT_DIRECTORY" \
project_slug="$COOKIECUTTER_SLUG" \
_challenge="$SCAF_CHALLENGE"
command_exists() {
command -v "$1" > /dev/null 2>&1
}

# Install required python dependencies
if ! command_exists pip; then
echo "pip is not installed. Installing pip..."
curl -sS https://bootstrap.pypa.io/get-pip.py | $PYTHON_CMD
PIP_ROOT_USER_ACTION=ignore
fi

if ! command_exists uv; then
echo "Installing uv..."
$PYTHON_CMD -m pip install --user uv
fi

echo "Installing cookiecutter and other dependencies..."
uv pip install --system black isort cookiecutter --prefix "/home/$USERNAME/.local/"

echo "Creating your project..."
cookiecutter $COOKIECUTTER_OPTIONS $REPO_URL --directory="$DEFAULT_DIRECTORY" project_slug="$COOKIECUTTER_SLUG" _challenge="$SCAF_CHALLENGE"

# Check if cookiecutter was successful
if [ $? -eq 0 ]; then
Expand Down

0 comments on commit 6f2e686

Please sign in to comment.