#!/bin/bash
# Setup script for PyPI publishing

set -e

echo "PyPI Setup Helper"
echo "================="
echo

# Check if we're in the right directory
if [ ! -f "pyproject.toml" ]; then
    echo "Error: Must run from flow-sdk root directory"
    exit 1
fi

# Create .pypirc template
echo "Creating .pypirc template..."
cat > ~/.pypirc.template << EOF
[distutils]
index-servers =
    pypi
    testpypi

[pypi]
username = __token__
password = # Add your PyPI token here

[testpypi]
username = __token__
password = # Add your Test PyPI token here
EOF

echo "✓ Created ~/.pypirc.template"
echo

echo "Next Steps:"
echo "1. Get your API tokens from:"
echo "   - PyPI: https://pypi.org/manage/account/token/"
echo "   - Test PyPI: https://test.pypi.org/manage/account/token/"
echo
echo "2. Copy template to .pypirc:"
echo "   cp ~/.pypirc.template ~/.pypirc"
echo "   chmod 600 ~/.pypirc"
echo
echo "3. Add your tokens to ~/.pypirc"
echo
echo "4. For GitHub Actions, add secrets:"
echo "   - PYPI_API_TOKEN"
echo "   - TEST_PYPI_API_TOKEN"
echo
echo "5. Reserve package names:"
echo "   cd scripts && python reserve_packages.py"