This guide explains how to publish the AGT Server package to PyPI so users can install it with pip install agt-server.
After publishing, users will be able to:
pip install agt-server
agt-server --help
agt-dashboard --help- TestPyPI: https://test.pypi.org/account/register/ (for testing)
- PyPI: https://pypi.org/account/register/ (for production)
pip install build twineMake sure your package is ready:
- All tests pass:
python test_package.py - Package builds successfully:
python -m build - CLI commands work:
agt-server --help
cd agt_server
python publish.pypython publish.py --testpython publish.py --publishIf you prefer to do it manually:
# Clean previous builds
rm -rf build/ dist/ *.egg-info/
# Build package
python -m build# Test installation from wheel
pip install dist/*.whl --force-reinstall
# Verify it works
python -c "import agt_server; print(agt_server.__version__)"
agt-server --help# Upload to test repository
twine upload --repository testpypi dist/*
# Test installation from TestPyPI
pip install --index-url https://test.pypi.org/simple/ agt-server# Upload to production
twine upload dist/*The publish.py script automates the entire process:
# Just build and test
python publish.py
# Upload to TestPyPI
python publish.py --test
# Upload to PyPI
python publish.py --publish
# Test then publish
python publish.py --test --publish# Skip building (use existing dist/ files)
python publish.py --test --skip-build
# Provide credentials
python publish.py --publish --username yourname --password yourpassThe package includes:
- ✅ All Python source code
- ✅ Command-line entry points (
agt-server,agt-dashboard) - ✅ Package metadata and dependencies
- ✅ README and documentation
- ✅ Dashboard templates and server configs
Excludes:
- ❌ Test files and directories
- ❌ Development artifacts
- ❌ Git history
- ❌ Build files
# Install from TestPyPI
pip install --index-url https://test.pypi.org/simple/ agt-server
# Test functionality
agt-server --help
agt-dashboard --help# Install from PyPI
pip install agt-server
# Test functionality
agt-server --help
agt-dashboard --help- The package will be published as
agt-serveron PyPI - Make sure this name is available (check https://pypi.org/project/agt-server/)
- If taken, update
nameinpyproject.tomlandsetup.py
- Each upload must have a unique version
- Update version in both
pyproject.tomlandsetup.py - Follow semantic versioning (e.g., 0.1.0, 0.1.1, 1.0.0)
- All dependencies in
requirements.txtwill be automatically installed - Make sure all dependencies are available on PyPI
- Consider version constraints (e.g.,
>=1.21.0vs==1.21.0)
- Never commit credentials to version control
- Use environment variables or interactive prompts for passwords
- Consider using API tokens instead of passwords
# In pyproject.toml
[project]
version = "0.1.1" # Increment version# In setup.py
setup(
version="0.1.1", # Increment version
# ... rest of config
)python publish.py --publish# Check if name is available
pip search agt-server # (if pip search works)
# Or check manually at https://pypi.org/project/agt-server/Solution: Choose a different name or contact the owner
# Check your credentials
twine check dist/*
# Try interactive login
twine upload --username yourname dist/*
# (will prompt for password)# Check if entry points were created
pip show agt-server
# Check PATH
which agt-server
# Reinstall
pip uninstall agt-server
pip install agt-server# Check package info
pip show agt-server
# List installed packages
pip list | grep agt
# Test imports
python -c "import agt_server; print(agt_server.__version__)"
# Test CLI
agt-server --help
agt-dashboard --help- Update your README with installation instructions
- Add PyPI badge:
[](https://badge.fury.io/py/agt-server) - Update any installation guides
- GitHub releases
- Social media
- Mailing lists
- Documentation updates
- PyPI download statistics
- GitHub stars and issues
- User feedback
Once published, users can install your package with:
pip install agt-serverAnd immediately start using:
# Start server
agt-server --game rps
# Start dashboard
agt-dashboard
# Use in Python
python -c "
from agt_server import AGTServer
print('Package works!')
"- PyPI Help: https://pypi.org/help/
- Python Packaging Guide: https://packaging.python.org/
- Twine Documentation: https://twine.readthedocs.io/
- Build Documentation: https://pypa-build.readthedocs.io/
- Test locally:
python publish.py - Test on TestPyPI:
python publish.py --test - Publish to PyPI:
python publish.py --publish - Verify installation:
pip install agt-server - Celebrate: 🎉 Your package is now available worldwide!