Complete guide for setting up the Puzzel SMS Gateway Python Client using uv, a fast Python package installer and resolver.
- Fast: 10-100x faster than pip
- Reliable: Consistent dependency resolution
- Modern: Built with Rust for performance
- Compatible: Drop-in replacement for pip
- Python 3.10 or higher
- Terminal/Command Prompt access
curl -LsSf https://astral.sh/uv/install.sh | shpowershell -c "irm https://astral.sh/uv/install.ps1 | iex"uv --versionCreate a new Python project with uv:
# Create project with Python 3.13.1
uv init my-sms-project --app --python 3.13.1
# Navigate to project directory
cd my-sms-projectWhat this does:
- Creates a new directory
my-sms-project/ - Sets up project structure with
pyproject.toml - Configures Python 3.13.1 as the project Python version
--appflag indicates this is an application (not a library)
# Create virtual environment with seed packages
uv venv --python 3.13.1 --seedWhat this does:
- Creates
.venv/directory in your project - Installs Python 3.13.1 in the virtual environment
--seedensures pip, setuptools, and wheel are installed
Note:
uv inittypically creates.venv/automatically, but--seedexplicitly ensures that standard tools are available.
source .venv/bin/activate.venv\Scripts\Activate.ps1.venv\Scripts\activate.batVerification:
You should see (.venv) prefix in your terminal prompt:
(.venv) user@machine:~/my-sms-project$
# Check Python version
python -V
# Output: Python 3.13.1
# List installed packages
uv pip list
# or
pip list
# Check uv pip works
uv pip --version# Install the SMS Gateway client from PyPI
uv pip install puzzel-sms-gateway-clientFor development installation from source:
# Clone the repository
git clone https://github.com/PuzzelSolutions/smsgw-client-python.git
cd smsgw-client-python/Generated/Python
# Install in editable mode
uv pip install -e .# List all installed packages
uv pip list
# You should see:
# - kiota-abstractions
# - kiota-http
# - kiota-serialization-json
# - kiota-serialization-text
# - kiota-serialization-form
# - kiota-serialization-multipart
# - httpx
# - and their dependenciesAfter setup, your project should look like this:
my-sms-project/
├── .venv/ # Virtual environment
├── .python-version # Python version specification
├── pyproject.toml # Project configuration
├── README.md # Project README
└── src/ # Your source code
└── __init__.py
# Install a package
uv pip install package-name
# Install multiple packages
uv pip install package1 package2 package3
# Install from requirements.txt
uv pip install -r requirements.txt
# Install in development mode
uv pip install -e .# List installed packages
uv pip list
# Show package details
uv pip show package-name
# Freeze dependencies
uv pip freeze > requirements.txt
# Uninstall a package
uv pip uninstall package-name# Install all dependencies from pyproject.toml
uv pip sync
# Install with specific extras
uv pip install -e ".[dev]"Here's a complete example from start to finish:
# 1. Install uv
curl -LsSf https://astral.sh/uv/install.sh | sh
# 2. Create project
uv init sms-notification-service --app --python 3.13.1
cd sms-notification-service
# 3. Create and activate virtual environment
uv venv --python 3.13.1 --seed
source .venv/bin/activate
# 4. Verify setup
python -V
uv pip list
# 5. Install SMS Gateway client
uv pip install puzzel-sms-gateway-client
# 6. Create your first script
cat > send_sms.py << 'EOF'
import asyncio
from kiota_abstractions.authentication import AnonymousAuthenticationProvider
from kiota_http.httpx_request_adapter import HttpxRequestAdapter
from src.mt_http_client import MtHttpClient
from src.models.gateway_request import GatewayRequest
from src.models.message import Message
async def main():
auth_provider = AnonymousAuthenticationProvider()
request_adapter = HttpxRequestAdapter(auth_provider)
request_adapter.base_url = "https://your-gateway-server.com"
client = MtHttpClient(request_adapter)
request = GatewayRequest(
service_id=12345,
username="your_username",
password="your_password",
message=[Message(recipient="+47xxxxxxxxx", content="Hello from uv!")]
)
response = await client.gw.rs.send_messages.post(request)
print(f"Sent! Batch: {response.batch_reference}")
if __name__ == "__main__":
asyncio.run(main())
EOF
# 7. Run your script
python send_sms.pyuv works seamlessly with pyproject.toml. Here's an example configuration:
[project]
name = "sms-notification-service"
version = "0.1.0"
description = "SMS notification service using Puzzel Gateway"
requires-python = ">=3.10"
dependencies = [
"kiota-abstractions>=1.0.0",
"kiota-http>=1.0.0",
"kiota-serialization-json>=1.0.0",
]
[project.optional-dependencies]
dev = [
"pytest>=7.0.0",
"black>=23.0.0",
"mypy>=1.0.0",
]
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"Install with dev dependencies:
uv pip install -e ".[dev]"When you're done working:
deactivateTo completely remove the virtual environment:
# Make sure you're not in the virtual environment
deactivate
# Remove the directory
rm -rf .venv| Task | Command |
|---|---|
| Install uv | curl -LsSf https://astral.sh/uv/install.sh | sh |
| Create project | uv init <name> --app --python 3.13.1 |
| Create venv | uv venv --python 3.13.1 --seed |
| Activate (Unix) | source .venv/bin/activate |
| Activate (Windows) | .venv\Scripts\activate |
| Install package | uv pip install <package> |
| Install editable | uv pip install -e . |
| List packages | uv pip list |
| Freeze deps | uv pip freeze > requirements.txt |
| Uninstall | uv pip uninstall <package> |
| Deactivate | deactivate |
After installing uv, you may need to restart your terminal or reload your shell configuration:
# For bash
source ~/.bashrc
# For zsh
source ~/.zshrc
# Or just restart your terminalTry running with appropriate permissions or install to user directory:
curl -LsSf https://astral.sh/uv/install.sh | shIf the specified Python version isn't available:
# Check available Python versions
python3 --version
python3.13 --version
# Use available version
uv venv --python 3.12Make sure you're using the correct command for your OS and shell:
- macOS/Linux (bash/zsh):
source .venv/bin/activate - Windows PowerShell:
.venv\Scripts\Activate.ps1 - Windows CMD:
.venv\Scripts\activate.bat
Make sure your virtual environment is activated:
# Check if activated (should show .venv path)
which python
# If not activated
source .venv/bin/activate- Always use virtual environments - Isolate project dependencies
- Pin Python version - Use specific version in
uv init - Use pyproject.toml - Modern Python project configuration
- Commit .python-version - Share Python version with team
- Don't commit .venv/ - Add to
.gitignore - Use requirements.txt or pyproject.toml - Track dependencies
- Activate before working - Always activate venv before coding
# Old way
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
# New way with uv
uv venv --seed
source .venv/bin/activate
uv pip install -r requirements.txt# Old way
poetry install
poetry shell
# New way with uv
uv venv --seed
source .venv/bin/activate
uv pip install -e ".[dev]"After setting up with uv:
- Follow the 02 - Getting Started Guide to send your first SMS
- Check out the Example Files for code samples
- Review the 03 - Quick Reference for common operations
Need Help?
- Check the Main README
- Review the Troubleshooting Guide
- Contact Puzzel support