Skip to main content
Deploy your Python Arcade Suite to Streamlit Cloud for free, production-ready hosting with automatic CI/CD from GitHub.

Overview

Streamlit Cloud is a platform specifically designed for deploying Streamlit applications. It offers:

Free Hosting

Host public apps at no cost

Automatic CI/CD

Deploy automatically from GitHub commits

Easy Setup

No server configuration required

Built-in Monitoring

Access logs and performance metrics
The live demo of Python Arcade Suite is hosted at: https://simplegames-46v2swaudmtbld5233dwbp.streamlit.app/

Prerequisites

Before deploying to Streamlit Cloud, you’ll need:
1

GitHub Account

Create a free account at github.com if you don’t have one.
2

Streamlit Cloud Account

Sign up for free at share.streamlit.io using your GitHub account.
3

Repository Access

Either fork the Python Arcade repository or push your own version to GitHub.
Your GitHub repository must be public for Streamlit Cloud’s free tier, or you’ll need a Streamlit Cloud Teams account for private repositories.

Deployment Process

1

Prepare Your Repository

Ensure your GitHub repository has the required files:
  • streamlit_app.py (main application file)
  • requirements.txt (Python dependencies)
  • All game modules (blackjack/, Hangman/, Rock_paper_or_scissors/)
The entry point must be named streamlit_app.py or you’ll need to specify a different filename during deployment.
2

Sign In to Streamlit Cloud

  1. Navigate to share.streamlit.io
  2. Click “Sign in with GitHub”
  3. Authorize Streamlit to access your GitHub repositories
Streamlit Cloud needs repository access to pull your code and set up automatic deployments.
3

Create a New App

  1. Click “New app” from your Streamlit Cloud dashboard
  2. Select your deployment method:
    • From existing repo: Use code already on GitHub
    • Start from template: Begin with a sample app
For Python Arcade Suite, choose “From existing repo”.
4

Configure Deployment Settings

Fill in the deployment configuration:
  • Repository: Select your Python Arcade repository
  • Branch: Choose main or your preferred branch
  • Main file path: Enter streamlit_app.py
Repository: your-username/Python_Arcade
Branch: main
Main file path: streamlit_app.py
You can optionally set a custom subdomain under Advanced settings.
5

Advanced Configuration (Optional)

Click “Advanced settings” to configure:
  • Python version: Specify version (default is 3.9)
  • Environment variables: Add secrets or config values
  • Custom domain: Use your own domain name (Teams plan)
For Python Arcade Suite, the default settings work perfectly.
6

Deploy the App

  1. Click “Deploy!”
  2. Streamlit Cloud will:
    • Clone your repository
    • Install dependencies from requirements.txt
    • Launch your application
The deployment typically takes 2-5 minutes.
You can watch the build logs in real-time during deployment.
7

Access Your Live App

Once deployment completes, you’ll receive a URL like:
https://your-app-name-random-id.streamlit.app/
Share this URL with anyone - your app is now live!

Configuration Requirements

requirements.txt

Your requirements.txt must list all Python dependencies:
streamlit
If you add new dependencies locally, update requirements.txt using:
pip freeze > requirements.txt
However, it’s often better to manually curate this file to include only direct dependencies.

Repository Structure

Ensure your repository maintains this structure:
Python_Arcade/
├── streamlit_app.py          # Required: Main entry point
├── requirements.txt          # Required: Dependencies
├── README.md                 # Recommended: Project documentation
├── blackjack/
│   └── streamlit_game.py
├── Hangman/
│   └── streamlit_game.py
└── Rock_paper_or_scissors/
    └── streamlit_game.py

Optional: Streamlit Configuration

Create .streamlit/config.toml for custom settings:
[theme]
primaryColor = "#FF4B4B"
backgroundColor = "#FFFFFF"
secondaryBackgroundColor = "#F0F2F6"
textColor = "#262730"
font = "sans serif"

[server]
headless = true
enableCORS = false
port = 8501

Continuous Deployment (CI/CD)

Streamlit Cloud automatically redeploys your app when you push changes to GitHub:
1

Make Changes Locally

Edit your code on your local machine and test thoroughly.
2

Commit and Push

git add .
git commit -m "Add new game feature"
git push origin main
3

Automatic Deployment

Streamlit Cloud detects the push and automatically:
  • Pulls the latest code
  • Reinstalls dependencies if requirements.txt changed
  • Restarts the application
Deployments typically complete within 2-3 minutes.
4

Verify Changes

Visit your app URL to confirm the updates are live.
Active users will see a brief “Reconnecting” message during redeployment.

Monitoring and Logs

Accessing Logs

  1. Go to your Streamlit Cloud dashboard
  2. Click on your app
  3. Select the “Logs” tab
Logs display:
  • Application startup messages
  • Print statements and errors
  • Streamlit system messages
  • Deployment events
Logs are retained for the current session only. For persistent logging, consider external services.

App Analytics

Streamlit Cloud provides basic analytics:
  • Viewer count: Number of active viewers
  • Resource usage: CPU and memory consumption
  • Uptime: App availability status
Access analytics from your app’s dashboard page.

Health Checks

Streamlit Cloud automatically monitors:
  • App responsiveness
  • Error rates
  • Resource limits
Apps on the free tier have resource limits. If your app exceeds limits, it may temporarily shut down.

Updating Your Deployment

Manual Reboot

If your app isn’t responding:
  1. Go to your app’s dashboard
  2. Click the ”⋮” menu (three dots)
  3. Select “Reboot app”

Changing Settings

To modify deployment settings:
  1. Click “Settings” from your app dashboard
  2. Update configuration (branch, Python version, etc.)
  3. Click “Save” - the app will redeploy automatically

Rolling Back Changes

To revert to a previous version:
# Find the commit you want to revert to
git log --oneline

# Revert to that commit
git revert <commit-hash>
git push origin main
Streamlit Cloud will automatically deploy the reverted version.

Custom Domains (Teams Plan)

While the free tier provides a *.streamlit.app subdomain, Teams plan users can configure custom domains:
  1. Navigate to SettingsDomain
  2. Enter your custom domain (e.g., arcade.yourdomain.com)
  3. Add the provided CNAME record to your DNS settings
  4. Wait for DNS propagation (up to 48 hours)
Custom domains require a Streamlit Cloud Teams subscription.

Resource Limits

Streamlit Cloud free tier has the following limits:
ResourceLimit
CPU1 core (shared)
Memory1 GB RAM
StorageLimited to app size
AppsUnlimited public apps
Apps that consistently exceed resource limits may be throttled or suspended.

Best Practices

Optimize Performance

Use @st.cache_data and @st.cache_resource to reduce computation

Handle Secrets Securely

Store API keys in Streamlit Cloud secrets, not in code

Test Before Pushing

Always test changes locally before deploying

Monitor Logs

Regularly check logs for errors and warnings

Troubleshooting

Deployment Failed

Problem: App fails to deploy with errors Solutions:
  • Check build logs for specific error messages
  • Verify requirements.txt has all dependencies
  • Ensure Python version compatibility
  • Check for syntax errors in code

App Running Slowly

Problem: App is slow or unresponsive Solutions:
  • Implement caching with @st.cache_data
  • Reduce computational complexity
  • Optimize session state usage
  • Consider upgrading to a Teams plan for more resources

Module Import Errors

Problem: ModuleNotFoundError in production Solutions:
# Add missing dependency to requirements.txt
echo "missing-package" >> requirements.txt
git add requirements.txt
git commit -m "Add missing dependency"
git push

App Goes to Sleep

Problem: App becomes inactive after no usage Solutions:
  • Free tier apps sleep after inactivity (expected behavior)
  • App wakes automatically when accessed
  • Upgrade to Teams plan for always-on apps

Security Considerations

Never commit sensitive information (API keys, passwords, tokens) to your repository.

Using Secrets

For sensitive configuration:
  1. Go to app SettingsSecrets
  2. Add secrets in TOML format:
    api_key = "your-secret-key"
    database_url = "your-connection-string"
    
  3. Access in code:
    import streamlit as st
    api_key = st.secrets["api_key"]
    

Next Steps

Local Development

Set up local development environment

Streamlit Docs

Explore Streamlit’s documentation

Streamlit Cloud

Learn more about Streamlit Cloud features

Community Forum

Get help from the Streamlit community

Additional Resources

Build docs developers (and LLMs) love