DSPy: The framework for programming—not prompting—language models
Python
Minor tweaks
Omar Khattab963855b6ee99
diff --git a/README.md b/README.mdindex d7c2e0cd5..b98cb28ac 100644--- a/README.md+++ b/README.md@@ -86,3 +86,4 @@ We'll rebrand to the **DSPy** framework soon.<img align="center" src="docs/images/DSPy7.png" width="260px" /></p><p align="left">+diff --git a/private_docs/sync_to_public.sh b/private_docs/sync_to_public.shindex e8835a147..51958578d 100644--- a/private_docs/sync_to_public.sh+++ b/private_docs/sync_to_public.sh@@ -1,52 +1,59 @@#!/bin/bash-# Exit if insufficient arguments are provided+# Ensure the script exits on any error+set -e+if [ "$#" -lt 1 ]; then- echo "Usage: ./sync_to_public.sh <branch-name> [--squash]"+ echo "Usage: ./sync_to_public.sh <branch_name> [--squash]"exit 1fi-BRANCH_NAME=$1-SQUASH_COMMITS=false--# Check if the squash option is provided-if [ "$#" -eq 2 ] && [ "$2" == "--squash" ]; then- SQUASH_COMMITS=true-fi+BRANCH=$1+SQUASH=$2-# Variables-PRIVATE_REMOTE="origin"-PUBLIC_REMOTE="upstream"-CURRENT_DATE=$(date +%Y%m%d%H%M%S)-TEMP_BRANCH="temp-public-sync-$CURRENT_DATE"--# Ensure we are on the specified branch and have the latest changes-git checkout $BRANCH_NAME-git pull $PRIVATE_REMOTE $BRANCH_NAME--# If squash option is true, squash the commits-if [ "$SQUASH_COMMITS" = true ]; then- # Count the number of commits since the last public sync- NUM_COMMITS=$(git rev-list --count $PUBLIC_REMOTE/$BRANCH_NAME..HEAD)-- # Squash the last NUM_COMMITS into one- if [ "$NUM_COMMITS" -gt 1 ]; then- git reset --soft HEAD~$NUM_COMMITS && git commit- fi-fi+# Ensure we are in the correct branch+git checkout $BRANCH-# Create a new temporary branch+# Create a temporary branch for this sync process+TEMP_BRANCH="temp-public-sync-$(date +%Y%m%d%H%M%S)"git checkout -b $TEMP_BRANCH-# Remove private_* directories and commit-git rm -r private_* 2> /dev/null-git commit -m "Remove private content for public sync"+# Pull any new changes from the public repo (this should ideally be a fast-forward merge)+git pull upstream $BRANCH++# List the private directories to be removed+echo "The following private directories will be removed:"+find . -type d -name 'private_*'++# Ask for confirmation+read -p "Are you sure you want to remove these directories for public sync? [y/N] " response++if [[ $response =~ ^([yY][eE][sS]|[yY])$ ]]+then+ # Remove the private directories+ find . -type d -name 'private_*' -exec rm -r {} +++ # Stage the removal changes+ git add -A++ # Commit the removal of private directories (this will be a no-op if no private directories were present)+ git commit -m "Prepare for public sync" || echo "No private directories to remove"+else+ echo "Aborted removing private directories."+ exit 1+fi++# If squash option is provided, squash all the commits+if [ "$SQUASH" == "--squash" ]; then+ echo "Squashing commits..."+ git reset $(git commit-tree HEAD^{tree} -m "Squash all commits for public sync")+fi-# Push the temporary branch to the corresponding branch of the public repo-git push $PUBLIC_REMOTE $TEMP_BRANCH:$BRANCH_NAME+# Push the changes to the public repo+git push upstream $TEMP_BRANCH:$BRANCH-# Return to the specified branch and delete the temporary branch-git checkout $BRANCH_NAME+# Return to the original branch and delete the temporary branch+git checkout $BRANCHgit branch -D $TEMP_BRANCHecho "Sync completed successfully!"diff --git a/private_docs/workflow.md b/private_docs/workflow.mdindex a941e9fa2..038598460 100644--- a/private_docs/workflow.md+++ b/private_docs/workflow.md@@ -27,7 +27,7 @@ Step 3: **Add the Public Repository as an Upstream Remote**git remote add upstream https://github.com/stanfordnlp/dsp.git```-### 3) Development Workflow [you do this every day]+### 3) Development Workflow [relevant for what you do every day, especially Steps 2 and 3]This is what you do in the private repo day to day.@@ -36,40 +36,43 @@ Step 1: **Pull Latest Changes from Private Repository**Ensure you're always working with the latest data from the private repo:```bash-git checkout main-git pull origin main+git checkout <branch-name>+git pull origin <branch-name>```+Replace `<branch-name>` with the name of the branch you are working on.+Step 2: **Development** (this is the actual work!)Conduct your development as usual.-When adding sensitive or private content, make sure to place it within directories prefixed by `private_*`.--We already have `private_docs` for example.+When adding sensitive or private content, make sure to place it within directories prefixed by `private_*/`.+We already have `private_docs/` as an example.Step 3: **Commit Changes in Private Repository**```bashgit add .git commit -m "Your descriptive commit message"-git push origin main+git push origin <branch-name>```+Replace `<branch-name>` with the name of the branch you are working on.+### 4) Pulling Updates from the Public Repository [you do this when needed]-If the public repository receives contributions, you'll want to incorporate them into your private repository at some point:+If the public repository receives contributions, you'll want to incorporate them into your private repository:```bash-git checkout main-git pull upstream main # pull and merge anything from public upstream-git push origin main # push now any recent things to the private origin+git checkout <branch-name>+git pull upstream <branch-name> # pull and merge anything from public upstream+git push origin <branch-name> # push now any recent things to the private origin```-This is definitely important before syncing back to the public repo.+This is important before syncing back to the public repo. It ensures that both repositories are in sync and that you're working with the most recent changes.-You may sometimes do this with other branches.+You may sometimes do this with branches other than `main`.### 5) Syncing to Public Repository [you do this when needed]