Complete guide to publish your Python client so users can install with pip install valkeyrie
# Install required tools
pip install --upgrade pip setuptools wheel twine build- Go to https://pypi.org/account/register/
- Create account
- Verify email
- Enable 2FA (recommended)
- Go to https://pypi.org/manage/account/
- Scroll to "API tokens"
- Click "Add API token"
- Name: "valkeyrie-upload"
- Scope: "Entire account" (or specific project after first upload)
- Copy the token (starts with
pypi-)
cd "Distributed Cache System\mini-redis\clients\python"
# Verify structure
dir
# Should see:
# - valkeyrie.py
# - setup.py
# - pyproject.toml
# - README.md
# - LICENSE
# - MANIFEST.in# Clean old builds
rmdir /s /q build dist valkeyrie.egg-info 2>nul
# Build package
python -m build
# This creates:
# dist/valkeyrie-1.0.0.tar.gz (source distribution)
# dist/valkeyrie-1.0.0-py3-none-any.whl (wheel)# Upload to TestPyPI first
python -m twine upload --repository testpypi dist/*
# Username: __token__
# Password: <your-testpypi-token>
# Test installation
pip install --index-url https://test.pypi.org/simple/ valkeyrie
# Test it works
python -c "from valkeyrie import ValkeyreClient; print('Success!')"# Upload to real PyPI
python -m twine upload dist/*
# Username: __token__
# Password: <your-pypi-token>Go to https://pypi.org/project/valkeyrie/
pip install valkeyriefrom valkeyrie import ValkeyreClient
with ValkeyreClient('localhost', 6379) as client:
client.set('hello', 'world')
print(client.get('hello'))-
Update version in
setup.pyandpyproject.toml:version="1.0.1" # Increment version
-
Rebuild and upload:
# Clean rmdir /s /q build dist valkeyrie.egg-info 2>nul # Build new version python -m build # Upload python -m twine upload dist/*
1.0.0β1.0.1- Bug fixes1.0.0β1.1.0- New features (backward compatible)1.0.0β2.0.0- Breaking changes
Create C:\Users\<username>\.pypirc:
[pypi]
username = __token__
password = pypi-YOUR_TOKEN_HERE
[testpypi]
username = __token__
password = pypi-YOUR_TESTPYPI_TOKEN_HEREThen simply run:
python -m twine upload dist/*# PowerShell
$env:TWINE_USERNAME = "__token__"
$env:TWINE_PASSWORD = "pypi-YOUR_TOKEN_HERE"
python -m twine upload dist/*Add installation badge to main README.md:
[](https://badge.fury.io/py/valkeyrie)
[](https://pepy.tech/project/valkeyrie)
## Installation
```bash
pip install valkeyrie
### Announce Your Package
- **Reddit**: r/Python, r/programming
- **Twitter/X**: #Python #OpenSource
- **LinkedIn**: Share with network
- **Dev.to**: Write a blog post
- **Hacker News**: Show HN post
### Monitor Usage
- **PyPI Stats**: https://pypi.org/project/valkeyrie/#history
- **Downloads**: https://pepy.tech/project/valkeyrie
- **GitHub Stars**: Track interest
---
## π Troubleshooting
### Error: "File already exists"
The version is already published. Increment version number.
### Error: "Invalid authentication credentials"
Check your API token:
- Must start with `pypi-`
- Username must be `__token__`
- Token must be active
### Error: "Distribution not found"
```bash
# Rebuild package
python -m build
# Reinstall in development mode for testing
pip install -e .- Ensure
README.mdexists - Verify
long_description_content_type="text/markdown"in setup.py - Check
MANIFEST.inincludes README.md
Before publishing, ensure:
- README.md with clear examples
- LICENSE file (MIT)
- Version number follows semver
- All imports work correctly
- No hardcoded credentials/secrets
- Type hints (optional but recommended)
- Docstrings in functions
- Test on fresh Python environment
Create .github/workflows/publish-pypi.yml:
name: Publish to PyPI
on:
release:
types: [published]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Build package
working-directory: clients/python
run: python -m build
- name: Publish to PyPI
working-directory: clients/python
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: twine upload dist/*Add PYPI_API_TOKEN to GitHub repository secrets.
# examples/quickstart.py
from valkeyrie import ValkeyreClient
def main():
with ValkeyreClient('localhost', 6379) as cache:
# Store user session
cache.set('session:user123', 'active')
cache.expire('session:user123', 3600)
# Check session
if cache.exists('session:user123'):
print("Session valid!")
if __name__ == '__main__':
main()Title: "Introducing Valkeyrie: A Redis-Compatible Python Client"
Content:
- Why you built it
- Key features
- Code examples
- Performance comparisons
- How to contribute
π Just published Valkeyrie to PyPI!
A lightweight, Redis-compatible Python client for distributed caching.
Install: pip install valkeyrie
β¨ Features:
- Simple API
- Full RESP protocol
- No dependencies
- Python 3.7+
Try it out: https://pypi.org/project/valkeyrie/
#Python #OpenSource #Redis #Caching
- β Published to PyPI
- β 10+ downloads
- β GitHub README updated
- β Social media posts
- β 100+ downloads
- β 50+ GitHub stars
- β 1-2 issues/feedback
- β Documentation site
- β 1000+ downloads
- β First external contributor
- β v1.1.0 with community features
- Respond within 24-48 hours
- Be friendly and helpful
- Link to documentation
- Fix bugs promptly
- Thank contributors
- Review code thoroughly
- Test before merging
- Credit in CHANGELOG
- Monthly dependency updates
- Security patches ASAP
- Feature releases quarterly
- Bug fix releases as needed
Before first publish:
- PyPI account created
- API token generated
- Package tested locally
- README is comprehensive
- LICENSE file included
- Version is 1.0.0
- Built successfully
- Uploaded to TestPyPI
- Tested installation from TestPyPI
- Uploaded to PyPI
- Installed and tested from PyPI
- GitHub README updated
- Announced on social media
Your package is now live on PyPI! Anyone can install it with:
pip install valkeyrieShare your achievement and help others discover your project! π
Questions? Open an issue on GitHub or check PyPI documentation: https://packaging.python.org/