|
| 1 | +# TPHATE Pip Distribution Update Guide |
| 2 | + |
| 3 | +This guide provides step-by-step instructions for updating the TPHATE package on PyPI after the dependency cleanup changes. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +1. **Accounts & Access** |
| 8 | + - PyPI account with upload permissions for the TPHATE package |
| 9 | + - TestPyPI account for testing (recommended) |
| 10 | + |
| 11 | +2. **Tools Installation** |
| 12 | + ```bash |
| 13 | + pip install --upgrade pip setuptools wheel twine |
| 14 | + ``` |
| 15 | + |
| 16 | +3. **Authentication Setup** |
| 17 | + ```bash |
| 18 | + # Configure PyPI credentials (one-time setup) |
| 19 | + # Option 1: Use API tokens (recommended) |
| 20 | + # Create API tokens at https://pypi.org/manage/account/token/ |
| 21 | + |
| 22 | + # Option 2: Use ~/.pypirc file |
| 23 | + cat > ~/.pypirc << EOF |
| 24 | + [distutils] |
| 25 | + index-servers = |
| 26 | + pypi |
| 27 | + testpypi |
| 28 | + |
| 29 | + [pypi] |
| 30 | + repository = https://upload.pypi.org/legacy/ |
| 31 | + username = __token__ |
| 32 | + password = pypi-YOUR_API_TOKEN_HERE |
| 33 | + |
| 34 | + [testpypi] |
| 35 | + repository = https://test.pypi.org/legacy/ |
| 36 | + username = __token__ |
| 37 | + password = pypi-YOUR_TEST_API_TOKEN_HERE |
| 38 | + EOF |
| 39 | + ``` |
| 40 | +
|
| 41 | +## Pre-Release Checklist |
| 42 | +
|
| 43 | +- [ ] All tests pass: `python -m pytest test/ -v` |
| 44 | +- [ ] Version updated in `tphate/version.py` (currently 1.2.1) |
| 45 | +- [ ] Changelog updated with release notes |
| 46 | +- [ ] Dependencies verified in `setup.py` (11 total, phate & scprep removed) |
| 47 | +- [ ] Clean workspace (no build artifacts) |
| 48 | +
|
| 49 | +## Release Process |
| 50 | +
|
| 51 | +### Step 1: Clean Build Environment |
| 52 | +```bash |
| 53 | +cd /Users/elb/Desktop/code_packages_maintainer_version/TPHATE/TPHATE |
| 54 | +
|
| 55 | +# Remove any existing build artifacts |
| 56 | +rm -rf build/ dist/ *.egg-info/ .pytest_cache/ |
| 57 | +find . -name "*.pyc" -delete |
| 58 | +find . -name "__pycache__" -type d -delete |
| 59 | +``` |
| 60 | +
|
| 61 | +### Step 2: Create Distribution Packages |
| 62 | +```bash |
| 63 | +# Activate virtual environment if needed |
| 64 | +source test_env/bin/activate |
| 65 | +
|
| 66 | +# Build source distribution and wheel |
| 67 | +python setup.py sdist bdist_wheel |
| 68 | +
|
| 69 | +# Verify the build |
| 70 | +ls -la dist/ |
| 71 | +``` |
| 72 | +
|
| 73 | +Expected output: |
| 74 | +``` |
| 75 | +tphate-1.2.1.tar.gz # Source distribution |
| 76 | +tphate-1.2.1-py3-none-any.whl # Universal wheel |
| 77 | +``` |
| 78 | +
|
| 79 | +### Step 3: Test the Distribution (Optional but Recommended) |
| 80 | +
|
| 81 | +#### Upload to TestPyPI First |
| 82 | +```bash |
| 83 | +# Upload to TestPyPI |
| 84 | +twine upload --repository testpypi dist/* |
| 85 | +
|
| 86 | +# Test installation from TestPyPI |
| 87 | +pip install --index-url https://test.pypi.org/simple/ tphate==1.2.1 |
| 88 | +
|
| 89 | +# Verify the test installation |
| 90 | +python -c "import tphate; print('Version:', tphate.__version__)" |
| 91 | +``` |
| 92 | +
|
| 93 | +### Step 4: Upload to Production PyPI |
| 94 | +```bash |
| 95 | +# Upload to production PyPI |
| 96 | +twine upload dist/* |
| 97 | +``` |
| 98 | +
|
| 99 | +### Step 5: Verify Production Release |
| 100 | +```bash |
| 101 | +# Test installation from production PyPI |
| 102 | +pip install --upgrade tphate |
| 103 | +
|
| 104 | +# Verify installation |
| 105 | +python -c " |
| 106 | +import tphate |
| 107 | +import numpy as np |
| 108 | +
|
| 109 | +print('✅ TPHATE Version:', tphate.__version__) |
| 110 | +
|
| 111 | +# Quick functionality test |
| 112 | +data = np.random.randn(50, 10) |
| 113 | +tphate_op = tphate.TPHATE(n_components=2, verbose=False) |
| 114 | +embedding = tphate_op.fit_transform(data) |
| 115 | +print('✅ Embedding shape:', embedding.shape) |
| 116 | +print('✅ Dependencies reduced: phate & scprep removed') |
| 117 | +print('✅ Release verification complete!') |
| 118 | +" |
| 119 | +``` |
| 120 | +
|
| 121 | +## Post-Release Tasks |
| 122 | +
|
| 123 | +### 1. Update Repository Tags |
| 124 | +```bash |
| 125 | +# Tag the release |
| 126 | +git add . |
| 127 | +git commit -m "Release v1.2.1: Remove unnecessary PHATE/SCPREP dependencies" |
| 128 | +git tag -a v1.2.1 -m "Version 1.2.1 - Dependency cleanup" |
| 129 | +git push origin main --tags |
| 130 | +``` |
| 131 | +
|
| 132 | +### 2. Update Documentation |
| 133 | +- [ ] Update GitHub README if needed |
| 134 | +- [ ] Update documentation site (if applicable) |
| 135 | +- [ ] Notify users of breaking changes (if applicable) |
| 136 | +
|
| 137 | +### 3. Monitor Release |
| 138 | +- [ ] Check PyPI package page: https://pypi.org/project/tphate/ |
| 139 | +- [ ] Monitor download statistics |
| 140 | +- [ ] Watch for user feedback or issues |
| 141 | +
|
| 142 | +## Rollback Procedure (if needed) |
| 143 | +
|
| 144 | +If issues are discovered after release: |
| 145 | +
|
| 146 | +```bash |
| 147 | +# Option 1: Quick patch release |
| 148 | +# 1. Fix the issue |
| 149 | +# 2. Increment version (e.g., 1.2.2) |
| 150 | +# 3. Follow release process above |
| 151 | +
|
| 152 | +# Option 2: Yank the problematic release (removes from new installs) |
| 153 | +# This can only be done through PyPI web interface: |
| 154 | +# https://pypi.org/manage/project/tphate/releases/ |
| 155 | +``` |
| 156 | +
|
| 157 | +## Key Changes in v1.2.1 |
| 158 | +
|
| 159 | +**Removed Dependencies:** |
| 160 | +- `phate` - Only used in docstring examples |
| 161 | +- `scprep>=1.0` - Only used for unused decorator |
| 162 | +
|
| 163 | +**Benefits:** |
| 164 | +- 15% fewer dependencies (13 → 11 packages) |
| 165 | +- Faster installation |
| 166 | +- Fewer potential conflicts |
| 167 | +- Cleaner dependency tree |
| 168 | +
|
| 169 | +**Migration for Users:** |
| 170 | +If users need PHATE or SCPREP functionality: |
| 171 | +```bash |
| 172 | +pip install tphate phate scprep |
| 173 | +``` |
| 174 | +
|
| 175 | +## Troubleshooting |
| 176 | +
|
| 177 | +**Common Issues:** |
| 178 | +
|
| 179 | +1. **Twine authentication errors:** |
| 180 | + - Verify API tokens are correct |
| 181 | + - Check ~/.pypirc configuration |
| 182 | +
|
| 183 | +2. **Version conflicts:** |
| 184 | + - Ensure version in `setup.py` matches `tphate/version.py` |
| 185 | + - Check that version doesn't already exist on PyPI |
| 186 | +
|
| 187 | +3. **Build errors:** |
| 188 | + - Verify all dependencies are installed |
| 189 | + - Check `setup.py` syntax |
| 190 | + - Ensure Python version compatibility |
| 191 | +
|
| 192 | +4. **Upload permission errors:** |
| 193 | + - Verify PyPI account has upload permissions for TPHATE |
| 194 | + - Check if you're a maintainer of the project |
| 195 | +
|
| 196 | +For additional help, consult: |
| 197 | +- [PyPI Documentation](https://packaging.python.org/) |
| 198 | +- [Twine Documentation](https://twine.readthedocs.io/) |
0 commit comments