# 🚀 Publishing Quick Start

## The Fastest Way to Publish

### 1️⃣ Get PyPI Token (One-time Setup)

1. Go to **https://pypi.org/manage/account/token/**
2. Click **"Add API token"**
3. Name it: `irene-cipher-upload`
4. Copy the token (starts with `pypi-...`)

### 2️⃣ Set the Token

**Linux/macOS**:
```bash
export MATURIN_PYPI_TOKEN="pypi-YOUR_TOKEN_HERE"
```

**Windows (PowerShell)**:
```powershell
$env:MATURIN_PYPI_TOKEN="pypi-YOUR_TOKEN_HERE"
```

**Windows (CMD)**:
```cmd
set MATURIN_PYPI_TOKEN=pypi-YOUR_TOKEN_HERE
```

### 3️⃣ Publish!

**Using the script** (Recommended):
```bash
# Linux/macOS
chmod +x publish.sh
./publish.sh

# Windows
publish.bat
```

**Or manually**:
```bash
# Install maturin if needed
pip install maturin

# Build and publish in one command
maturin publish
```

### 4️⃣ Done! 🎉

Your package is now on PyPI at:
**https://pypi.org/project/irene-cipher/**

Install with:
```bash
pip install irene-cipher
```

---

## Before First Publish - Update URLs

Replace `YOUR_USERNAME` with your GitHub username in:

1. **Cargo.toml** (line 8):
   ```toml
   repository = "https://github.com/YOUR_USERNAME/irene-cipher"
   ```

2. **pyproject.toml** (lines 32-34):
   ```toml
   Homepage = "https://github.com/YOUR_USERNAME/irene-cipher"
   Repository = "https://github.com/YOUR_USERNAME/irene-cipher"
   ```

3. Search and replace in all `.md` files

---

## Test First (Recommended)

Use TestPyPI before publishing to production:

```bash
# Get TestPyPI token from https://test.pypi.org/manage/account/token/
export MATURIN_TESTPYPI_TOKEN="pypi-YOUR_TEST_TOKEN"

# Publish to TestPyPI
maturin publish --repository testpypi

# Test installation
pip install --index-url https://test.pypi.org/simple/ irene-cipher

# If it works, publish to real PyPI
maturin publish
```

---

## Troubleshooting

### "maturin: command not found"
```bash
pip install maturin
```

### "Token not set"
Make sure you exported the token in your **current terminal session**:
```bash
export MATURIN_PYPI_TOKEN="pypi-..."
```

### "Version already exists"
You can't overwrite a published version. Update version in:
- `Cargo.toml`: `version = "0.1.1"`
- `pyproject.toml`: `version = "0.1.1"`

Then republish.

### "Build failed"
Make sure Rust is installed:
```bash
# Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# Verify
rustc --version
```

---

## Next Steps After Publishing

1. ✅ Check your package page: https://pypi.org/project/irene-cipher/
2. ✅ Test installation: `pip install irene-cipher`
3. ✅ Create GitHub release with changelog
4. ✅ Add PyPI badge to README
5. ✅ Announce (optional)

---

## Full Documentation

See **[PUBLISHING.md](PUBLISHING.md)** for complete details including:
- Multi-platform wheels (Windows/macOS/Linux)
- GitHub Actions automation
- Version updates
- Security considerations

---

## Summary

```bash
# 1. Get token: https://pypi.org/manage/account/token/
# 2. Set token
export MATURIN_PYPI_TOKEN="pypi-YOUR_TOKEN"

# 3. Publish
maturin publish

# That's it!
```

**Questions?** Open an issue or see [PUBLISHING.md](PUBLISHING.md)
