Skip to content

Commit

Permalink
add publish_to_pypi.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
samuela committed Feb 12, 2025
1 parent db7d217 commit 63afed1
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions publish_to_pypi.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

set -euo pipefail

# Check if we're in nix-shell/nix develop
if [[ -z "${IN_NIX_SHELL}" ]]; then
echo "Error: This script must be run from within nix develop"
echo "Please run 'nix develop' first, then try again"
exit 1
fi

echo "Building and publishing torch2jax to PyPI"
echo
echo "First, get a PyPI token from:"
echo "https://pypi.org/manage/project/torch2jax/settings/"
echo
read -sp "Enter your PyPI token: " TOKEN
echo

# Build the package
echo -e "\nBuilding package..."
python3 -m build

# Upload to PyPI using environment variable
echo -e "\nUploading to PyPI..."
TWINE_USERNAME="__token__" TWINE_PASSWORD="$TOKEN" python3 -m twine upload dist/*

echo -e "\nPackage successfully published to PyPI!"
echo
echo "SECURITY REMINDER: Please delete the token you just used from PyPI:"
echo "https://pypi.org/manage/project/torch2jax/settings/"
echo
read -p "Press Enter once you've deleted the token..."
echo "Done!"

0 comments on commit 63afed1

Please sign in to comment.